summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@Sun.COM>2009-10-22 17:29:01 +0200
committerArmin Le Grand <Armin.Le.Grand@Sun.COM>2009-10-22 17:29:01 +0200
commit44d4c2c3acee48f2f9419ab5a4334aa5440f8779 (patch)
treecae3c7a74a45964642bc8a089915a22294a31951 /sw
parentb0a85159e5f99baee901adad447a157f65e507b4 (diff)
parentf71bb16fc284f022a844b575a8db75be7a4aafb1 (diff)
commit after rebase to DEV300m62
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/IDocumentContentOperations.hxx41
-rw-r--r--sw/inc/IDocumentExternalData.hxx (renamed from sw/inc/fmthbsh.hxx)62
-rw-r--r--sw/inc/PostItMgr.hxx15
-rw-r--r--sw/inc/bookmrk.hxx218
-rw-r--r--sw/inc/breakit.hxx19
-rw-r--r--sw/inc/calc.hxx2
-rw-r--r--sw/inc/cmdid.h2
-rw-r--r--sw/inc/dbgoutsw.hxx12
-rw-r--r--sw/inc/doc.hxx96
-rw-r--r--sw/inc/docsh.hxx2
-rw-r--r--sw/inc/editsh.hxx10
-rw-r--r--sw/inc/fmtfld.hxx6
-rwxr-xr-xsw/inc/fmtmeta.hxx218
-rw-r--r--sw/inc/hintids.hxx46
-rw-r--r--sw/inc/index.hxx4
-rw-r--r--sw/inc/ndarr.hxx2
-rw-r--r--sw/inc/ndhints.hxx29
-rw-r--r--sw/inc/ndtxt.hxx141
-rw-r--r--sw/inc/pch/precompiled_sw.hxx1
-rw-r--r--sw/inc/postit.hxx10
-rw-r--r--sw/inc/printdata.hxx2
-rw-r--r--sw/inc/redline.hxx8
-rw-r--r--sw/inc/rolbck.hxx14
-rw-r--r--sw/inc/swcalwrp.hxx5
-rw-r--r--sw/inc/swevent.hxx14
-rw-r--r--sw/inc/swtypes.hxx3
-rw-r--r--sw/inc/txatbase.hxx295
-rw-r--r--sw/inc/txtatr.hxx54
-rw-r--r--sw/inc/txtftn.hxx2
-rw-r--r--sw/inc/txtinet.hxx3
-rw-r--r--sw/inc/undobj.hxx10
-rw-r--r--sw/inc/unocoll.hxx13
-rw-r--r--sw/inc/unocrsrhelper.hxx3
-rw-r--r--sw/inc/unofield.hxx6
-rw-r--r--sw/inc/unomap.hxx3
-rw-r--r--sw/inc/unoobj.hxx170
-rw-r--r--sw/inc/unoport.hxx208
-rw-r--r--sw/inc/unoprnms.hxx3
-rwxr-xr-xsw/qa/complex/writer/TextPortionEnumerationTest.java3858
-rwxr-xr-xsw/qa/complex/writer/makefile.mk9
-rwxr-xr-xsw/qa/complex/writer/testdocuments/TESTMETA.odtbin0 -> 8678 bytes
-rwxr-xr-xsw/sdi/_annotsh.sdi4
-rw-r--r--sw/sdi/_basesh.sdi4
-rw-r--r--sw/sdi/_docsh.sdi1
-rw-r--r--sw/sdi/drwtxtsh.sdi4
-rw-r--r--sw/sdi/makefile.mk12
-rw-r--r--sw/sdi/swriter.sdi45
-rw-r--r--sw/sdi/viewsh.sdi10
-rw-r--r--sw/sdi/wdocsh.sdi1
-rw-r--r--sw/sdi/wviewsh.sdi10
-rw-r--r--sw/source/core/access/accpara.cxx14
-rw-r--r--sw/source/core/access/accportions.cxx6
-rw-r--r--sw/source/core/bastyp/breakit.cxx37
-rw-r--r--sw/source/core/bastyp/calc.cxx12
-rw-r--r--sw/source/core/bastyp/index.cxx6
-rw-r--r--sw/source/core/bastyp/init.cxx66
-rw-r--r--sw/source/core/crsr/bookmrk.cxx59
-rw-r--r--sw/source/core/crsr/callnk.cxx6
-rw-r--r--sw/source/core/crsr/crstrvl.cxx21
-rw-r--r--sw/source/core/crsr/findattr.cxx20
-rw-r--r--sw/source/core/crsr/findtxt.cxx24
-rw-r--r--sw/source/core/crsr/pam.cxx14
-rw-r--r--sw/source/core/crsr/swcrsr.cxx44
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx109
-rw-r--r--sw/source/core/doc/doc.cxx142
-rw-r--r--sw/source/core/doc/docbm.cxx18
-rw-r--r--sw/source/core/doc/doccomp.cxx7
-rw-r--r--sw/source/core/doc/docdde.cxx210
-rw-r--r--sw/source/core/doc/docdesc.cxx4
-rw-r--r--sw/source/core/doc/docedt.cxx512
-rw-r--r--sw/source/core/doc/docfly.cxx26
-rw-r--r--sw/source/core/doc/docfmt.cxx137
-rw-r--r--sw/source/core/doc/docglbl.cxx4
-rw-r--r--sw/source/core/doc/docglos.cxx2
-rw-r--r--sw/source/core/doc/doclay.cxx92
-rw-r--r--sw/source/core/doc/docnew.cxx10
-rw-r--r--sw/source/core/doc/docnum.cxx75
-rw-r--r--sw/source/core/doc/docredln.cxx36
-rw-r--r--sw/source/core/doc/docruby.cxx19
-rw-r--r--sw/source/core/doc/docsort.cxx6
-rw-r--r--sw/source/core/doc/doctxm.cxx31
-rw-r--r--sw/source/core/doc/extinput.cxx31
-rw-r--r--sw/source/core/doc/makefile.mk2
-rw-r--r--sw/source/core/doc/notxtfrm.cxx4
-rw-r--r--sw/source/core/doc/poolfmt.cxx16
-rw-r--r--sw/source/core/docnode/ndcopy.cxx362
-rw-r--r--sw/source/core/docnode/ndsect.cxx60
-rw-r--r--sw/source/core/docnode/ndtbl.cxx5
-rw-r--r--sw/source/core/docnode/node.cxx8
-rw-r--r--sw/source/core/docnode/nodes.cxx138
-rw-r--r--sw/source/core/docnode/section.cxx5
-rw-r--r--sw/source/core/edit/acorrect.cxx49
-rw-r--r--sw/source/core/edit/autofmt.cxx43
-rw-r--r--sw/source/core/edit/edatmisc.cxx12
-rw-r--r--sw/source/core/edit/edattr.cxx38
-rw-r--r--sw/source/core/edit/eddel.cxx6
-rw-r--r--sw/source/core/edit/edfld.cxx27
-rw-r--r--sw/source/core/edit/edglbldc.cxx5
-rw-r--r--sw/source/core/edit/edglss.cxx9
-rw-r--r--sw/source/core/edit/editsh.cxx26
-rw-r--r--sw/source/core/edit/edlingu.cxx33
-rw-r--r--sw/source/core/edit/ednumber.cxx6
-rw-r--r--sw/source/core/edit/edsect.cxx4
-rw-r--r--sw/source/core/edit/edtox.cxx9
-rw-r--r--sw/source/core/fields/cellfml.cxx10
-rw-r--r--sw/source/core/fields/ddetbl.cxx4
-rw-r--r--sw/source/core/fields/docufld.cxx10
-rw-r--r--sw/source/core/fields/fldbas.cxx2
-rw-r--r--sw/source/core/fields/postithelper.cxx5
-rw-r--r--sw/source/core/fields/reffld.cxx4
-rw-r--r--sw/source/core/frmedt/fecopy.cxx18
-rw-r--r--sw/source/core/frmedt/fedesc.cxx2
-rw-r--r--sw/source/core/frmedt/feshview.cxx4
-rw-r--r--sw/source/core/frmedt/fews.cxx4
-rw-r--r--sw/source/core/frmedt/tblsel.cxx5
-rw-r--r--sw/source/core/inc/GetMetricVal.hxx2
-rw-r--r--sw/source/core/inc/bookmrk.hxx12
-rw-r--r--sw/source/core/inc/frmtool.hxx17
-rw-r--r--sw/source/core/inc/mvsave.hxx5
-rw-r--r--sw/source/core/inc/swfont.hxx4
-rw-r--r--sw/source/core/inc/txttypes.hxx1
-rwxr-xr-xsw/source/core/inc/unometa.hxx345
-rw-r--r--sw/source/core/layout/flowfrm.cxx51
-rw-r--r--sw/source/core/layout/frmtool.cxx31
-rw-r--r--sw/source/core/layout/layact.cxx3
-rw-r--r--sw/source/core/layout/laycache.cxx3
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks.cxx2
-rw-r--r--sw/source/core/table/swnewtable.cxx5
-rw-r--r--sw/source/core/table/swtable.cxx12
-rw-r--r--sw/source/core/text/atrhndl.hxx2
-rw-r--r--sw/source/core/text/atrstck.cxx31
-rw-r--r--sw/source/core/text/guess.cxx6
-rw-r--r--sw/source/core/text/inftxt.cxx3
-rw-r--r--sw/source/core/text/itratr.cxx23
-rw-r--r--sw/source/core/text/itrcrsr.cxx24
-rw-r--r--sw/source/core/text/itrform2.cxx48
-rw-r--r--sw/source/core/text/itrform2.hxx2
-rw-r--r--sw/source/core/text/itrpaint.cxx1
-rw-r--r--sw/source/core/text/porfld.cxx19
-rw-r--r--sw/source/core/text/porfld.hxx4
-rw-r--r--sw/source/core/text/porlay.cxx28
-rw-r--r--sw/source/core/text/pormulti.cxx24
-rw-r--r--sw/source/core/text/portxt.cxx10
-rw-r--r--sw/source/core/text/redlnitr.cxx11
-rw-r--r--sw/source/core/text/txtdrop.cxx18
-rw-r--r--sw/source/core/text/txtfld.cxx71
-rw-r--r--sw/source/core/text/txtfrm.cxx24
-rw-r--r--sw/source/core/text/txthyph.cxx4
-rw-r--r--sw/source/core/tox/txmsrt.cxx10
-rw-r--r--sw/source/core/txtnode/atrfld.cxx3
-rw-r--r--sw/source/core/txtnode/atrflyin.cxx1
-rw-r--r--sw/source/core/txtnode/atrftn.cxx3
-rw-r--r--sw/source/core/txtnode/atrref.cxx5
-rw-r--r--sw/source/core/txtnode/atrtox.cxx5
-rw-r--r--sw/source/core/txtnode/fmtatr1.cxx97
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx345
-rw-r--r--sw/source/core/txtnode/fntcache.cxx8
-rw-r--r--sw/source/core/txtnode/fntcap.cxx10
-rw-r--r--sw/source/core/txtnode/makefile.mk4
-rw-r--r--sw/source/core/txtnode/ndhints.cxx66
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx981
-rw-r--r--sw/source/core/txtnode/swfont.cxx12
-rw-r--r--sw/source/core/txtnode/thints.cxx981
-rw-r--r--sw/source/core/txtnode/txatbase.cxx16
-rw-r--r--sw/source/core/txtnode/txatritr.cxx22
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx87
-rw-r--r--sw/source/core/txtnode/txtedt.cxx115
-rw-r--r--sw/source/core/undo/docundo.cxx31
-rw-r--r--sw/source/core/undo/rolbck.cxx88
-rw-r--r--sw/source/core/undo/unattr.cxx34
-rw-r--r--sw/source/core/undo/undel.cxx12
-rw-r--r--sw/source/core/undo/undo.src4
-rw-r--r--sw/source/core/undo/undobj.cxx24
-rw-r--r--sw/source/core/undo/undobj1.cxx25
-rw-r--r--sw/source/core/undo/undraw.cxx11
-rw-r--r--sw/source/core/undo/unins.cxx34
-rw-r--r--sw/source/core/undo/unmove.cxx16
-rw-r--r--sw/source/core/undo/unovwr.cxx23
-rw-r--r--sw/source/core/undo/unsect.cxx11
-rw-r--r--sw/source/core/undo/unsort.cxx6
-rw-r--r--sw/source/core/undo/untbl.cxx11
-rw-r--r--sw/source/core/undo/untblk.cxx11
-rw-r--r--sw/source/core/unocore/unobkm.cxx19
-rw-r--r--sw/source/core/unocore/unochart.cxx2
-rw-r--r--sw/source/core/unocore/unocoll.cxx29
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx44
-rw-r--r--sw/source/core/unocore/unodraw.cxx39
-rw-r--r--sw/source/core/unocore/unoevent.cxx121
-rw-r--r--sw/source/core/unocore/unofield.cxx69
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx2
-rw-r--r--sw/source/core/unocore/unoframe.cxx2
-rw-r--r--sw/source/core/unocore/unoftn.cxx15
-rw-r--r--sw/source/core/unocore/unoidx.cxx36
-rw-r--r--sw/source/core/unocore/unomap.cxx20
-rw-r--r--sw/source/core/unocore/unoobj.cxx255
-rw-r--r--sw/source/core/unocore/unoobj2.cxx339
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx1
-rw-r--r--sw/source/core/unocore/unoport.cxx467
-rw-r--r--sw/source/core/unocore/unoportenum.cxx1082
-rw-r--r--sw/source/core/unocore/unoprnms.cxx3
-rw-r--r--sw/source/core/unocore/unoredline.cxx4
-rw-r--r--sw/source/core/unocore/unorefmk.cxx1078
-rw-r--r--sw/source/core/unocore/unosect.cxx2
-rw-r--r--sw/source/core/unocore/unotext.cxx117
-rw-r--r--sw/source/core/view/viewsh.cxx10
-rw-r--r--sw/source/core/view/vprint.cxx18
-rw-r--r--sw/source/filter/ascii/ascatr.cxx19
-rw-r--r--sw/source/filter/ascii/parasc.cxx6
-rw-r--r--sw/source/filter/basflt/fltini.cxx4
-rw-r--r--sw/source/filter/html/css1atr.cxx16
-rw-r--r--sw/source/filter/html/htmlatr.cxx34
-rw-r--r--sw/source/filter/html/htmlbas.cxx31
-rw-r--r--sw/source/filter/html/htmlfld.cxx4
-rw-r--r--sw/source/filter/html/htmlfldw.cxx8
-rw-r--r--sw/source/filter/html/htmlftn.cxx9
-rw-r--r--sw/source/filter/html/htmlgrin.cxx23
-rw-r--r--sw/source/filter/html/htmlsect.cxx4
-rw-r--r--sw/source/filter/html/htmltab.cxx5
-rw-r--r--sw/source/filter/html/swhtml.cxx39
-rw-r--r--sw/source/filter/html/swhtml.hxx2
-rw-r--r--sw/source/filter/rtf/rtfatr.cxx37
-rw-r--r--sw/source/filter/rtf/rtffld.cxx48
-rw-r--r--sw/source/filter/rtf/rtffly.cxx8
-rw-r--r--sw/source/filter/rtf/rtftbl.cxx3
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx36
-rw-r--r--sw/source/filter/writer/writer.cxx4
-rw-r--r--sw/source/filter/ww1/fltshell.cxx30
-rw-r--r--sw/source/filter/ww8/WW8FibData.cxx65
-rw-r--r--sw/source/filter/ww8/WW8FibData.hxx54
-rw-r--r--sw/source/filter/ww8/WW8Sttbf.cxx121
-rw-r--r--sw/source/filter/ww8/WW8Sttbf.hxx148
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx3
-rw-r--r--sw/source/filter/ww8/makefile.mk8
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx10
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx4
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx34
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx35
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx33
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx3
-rw-r--r--sw/source/filter/ww8/ww8glsy.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx151
-rw-r--r--sw/source/filter/ww8/ww8par.hxx3
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx11
-rw-r--r--sw/source/filter/ww8/ww8par2.hxx1
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx74
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx53
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx21
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx2
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx4
-rw-r--r--sw/source/filter/xml/swxml.cxx72
-rw-r--r--sw/source/filter/xml/xmltbli.cxx2
-rw-r--r--sw/source/ui/app/appopt.cxx17
-rw-r--r--sw/source/ui/app/docsh.cxx79
-rw-r--r--sw/source/ui/app/docsh2.cxx19
-rw-r--r--sw/source/ui/app/docshini.cxx8
-rw-r--r--sw/source/ui/app/docstyle.cxx3
-rw-r--r--sw/source/ui/app/mn.src10
-rw-r--r--sw/source/ui/app/swmodule.cxx5
-rw-r--r--sw/source/ui/cctrl/actctrl.cxx9
-rw-r--r--sw/source/ui/config/fontcfg.cxx31
-rw-r--r--sw/source/ui/config/optdlg.src6
-rw-r--r--sw/source/ui/config/usrpref.cxx4
-rw-r--r--sw/source/ui/config/viewopt.cxx3
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx8
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx20
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx4
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx8
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx190
-rw-r--r--sw/source/ui/dochdl/swdtflvr.cxx1
-rw-r--r--sw/source/ui/docvw/PostItMgr.cxx57
-rw-r--r--sw/source/ui/docvw/docvw.src4
-rw-r--r--sw/source/ui/docvw/edtwin.cxx7
-rw-r--r--sw/source/ui/docvw/postit.cxx165
-rw-r--r--sw/source/ui/docvw/srcedtw.cxx12
-rw-r--r--sw/source/ui/fldui/fldmgr.cxx2
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx2
-rw-r--r--sw/source/ui/inc/actctrl.hxx6
-rw-r--r--sw/source/ui/inc/regionsw.hxx18
-rw-r--r--sw/source/ui/inc/wrtsh.hxx2
-rw-r--r--sw/source/ui/lingu/olmenu.cxx3
-rw-r--r--sw/source/ui/misc/pgfnote.cxx3
-rw-r--r--sw/source/ui/misc/redlndlg.src2
-rw-r--r--sw/source/ui/ribbar/inputwin.cxx6
-rwxr-xr-xsw/source/ui/shells/annotsh.cxx16
-rw-r--r--sw/source/ui/shells/basesh.cxx14
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx13
-rw-r--r--sw/source/ui/shells/drwtxtsh.cxx5
-rw-r--r--sw/source/ui/shells/shells.src6
-rw-r--r--sw/source/ui/shells/textfld.cxx4
-rw-r--r--sw/source/ui/shells/textsh.cxx11
-rw-r--r--sw/source/ui/shells/textsh1.cxx33
-rw-r--r--sw/source/ui/uiview/pview.cxx8
-rw-r--r--sw/source/ui/uiview/srcview.cxx15
-rw-r--r--sw/source/ui/uiview/uivwimp.cxx38
-rw-r--r--sw/source/ui/uiview/view.cxx66
-rw-r--r--sw/source/ui/uiview/view2.cxx2
-rw-r--r--sw/source/ui/uiview/viewprt.cxx20
-rw-r--r--sw/source/ui/uno/swdetect.cxx2
-rw-r--r--sw/source/ui/uno/unoatxt.cxx6
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx4
-rw-r--r--sw/source/ui/uno/unomod.cxx42
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx20
-rw-r--r--sw/source/ui/utlui/content.cxx15
-rw-r--r--sw/source/ui/utlui/initui.cxx3
-rw-r--r--sw/source/ui/utlui/numfmtlb.cxx2
-rw-r--r--sw/source/ui/utlui/uitool.cxx3
-rw-r--r--sw/source/ui/utlui/utlui.src4
-rw-r--r--sw/source/ui/wrtsh/select.cxx21
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx95
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx7
-rw-r--r--sw/uiconfig/sglobal/accelerator/en-GB/default.xml2
-rw-r--r--sw/uiconfig/sglobal/accelerator/en-US/default.xml2
-rw-r--r--sw/uiconfig/swform/accelerator/en-US/default.xml2
-rw-r--r--sw/uiconfig/swreport/accelerator/en-GB/default.xml2
-rw-r--r--sw/uiconfig/swreport/accelerator/en-US/default.xml2
-rw-r--r--sw/uiconfig/swriter/accelerator/en-GB/default.xml2
-rw-r--r--sw/uiconfig/swriter/accelerator/en-US/default.xml2
-rw-r--r--sw/uiconfig/swxform/accelerator/en-GB/default.xml2
-rw-r--r--sw/uiconfig/swxform/accelerator/en-US/default.xml2
-rw-r--r--sw/util/makefile.mk1
323 files changed, 13371 insertions, 5312 deletions
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 9228e12d992c..eb3559f355ed 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -67,11 +67,19 @@
DOC_NO_DELFRMS = 0x08
};
+ // constants for inserting text
+ enum InsertFlags
+ { INS_DEFAULT = 0x00 // no extras
+ , INS_EMPTYEXPAND = 0x01 // expand empty hints at insert position
+ , INS_NOHINTEXPAND = 0x02 // do not expand any hints at insert pos
+ , INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position
+ };
+
public:
/** Kopieren eines Bereiches im oder in ein anderes Dokument !
Die Position kann auch im Bereich liegen !!
*/
- virtual bool Copy(SwPaM&, SwPosition&, bool bCopyAll ) const = 0;
+ virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll ) const = 0;
/** Loesche die Section, in der der Node steht.
*/
@@ -79,7 +87,7 @@
/** loeschen eines BereichesSwFlyFrmFmt
*/
- virtual bool Delete(SwPaM&) = 0;
+ virtual bool DeleteRange(SwPaM&) = 0;
/** loeschen gesamter Absaetze
*/
@@ -96,34 +104,24 @@
/** verschieben eines Bereiches
*/
- virtual bool Move(SwPaM&, SwPosition&, SwMoveFlags) = 0;
+ virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
/** verschieben ganzer Nodes
*/
- virtual bool Move(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0;
+ virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0;
/** verschieben eines Bereiches
*/
virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) = 0;
- /** Ueberschreiben eines einzelnen Zeichens. rRg.Start() bezeichnet
- den Node und die Position in dem Node, an der eingefuegt wird,
- */
- virtual bool Overwrite(const SwPaM &rRg, sal_Unicode c) = 0;
-
/** Ueberschreiben eines Strings in einem bestehenden Textnode.
*/
virtual bool Overwrite(const SwPaM &rRg, const String& rStr) = 0;
- /** Einfuegen eines einzelnen Zeichens. rRg.Start() bezeichnet
- den Node und die Position in dem Node, an der eingefuegt wird.
- */
- virtual bool Insert(const SwPaM &rRg, sal_Unicode c) = 0;
-
- /** Einfuegen eines Strings in einen bestehenden
- Textnode. Der Text wird kopiert.
+ /** Insert string into existing text node at position rRg.Point().
*/
- virtual bool Insert(const SwPaM &rRg, const String&, bool bHintExpand) = 0;
+ virtual bool InsertString(const SwPaM &rRg, const String&,
+ const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0;
/** change text to Upper/Lower/Hiragana/Katagana/...
*/
@@ -171,7 +169,8 @@
z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&"
--> "xx\t<Tab>..zzz..&"
*/
- virtual bool Replace(SwPaM& rPam, const String& rNewStr, bool bRegExpRplc) = 0;
+ virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
+ const bool bRegExReplace) = 0;
/** Einfuegen eines Attributs. Erstreckt sich rRg ueber
mehrere Nodes, wird das Attribut aufgespaltet, sofern
@@ -187,11 +186,13 @@
hinzugefuegt. Wenn das Attribut nicht eingefuegt werden
konnte, liefert die Methode sal_False.
*/
- virtual bool Insert(const SwPaM &rRg, const SfxPoolItem&, sal_uInt16 nFlags) = 0;
+ virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
+ const sal_uInt16 nFlags) = 0;
/**
*/
- virtual bool Insert(const SwPaM &rRg, const SfxItemSet&, sal_uInt16 nFlags) = 0;
+ virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
+ const sal_uInt16 nFlags) = 0;
/** Removes any leading white space from the paragraph
*/
diff --git a/sw/inc/fmthbsh.hxx b/sw/inc/IDocumentExternalData.hxx
index 32c4df8c4007..d84c07a677d4 100644
--- a/sw/inc/fmthbsh.hxx
+++ b/sw/inc/IDocumentExternalData.hxx
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: fmthbsh.hxx,v $
- * $Revision: 1.5 $
+ * $RCSfile: $
+ * $Revision:$
*
* This file is part of OpenOffice.org.
*
@@ -27,48 +27,46 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _FMTHBSH_HXX
-#define _FMTHBSH_HXX
+#ifndef INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX
+#define INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX
+#include <hash_map>
+#include <boost/shared_ptr.hpp>
-#include <svtools/poolitem.hxx>
+namespace sw
+{
+enum tExternalDataType { FIB, STTBF_ASSOC };
-// ATT_SOFTHYPH ******************************
-// Attribut fuer benutzerdefinierte Trennstellen.
+struct ExternalDataTypeHash
+{
+ size_t operator()(tExternalDataType eType) const { return eType; }
+};
-class SwFmtSoftHyph : public SfxPoolItem
+class ExternalData
{
public:
- SwFmtSoftHyph();
-
- // "pure virtual Methoden" vom SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
-
- inline SwFmtSoftHyph& operator=(const SwFmtSoftHyph&) {
- return *this;
- }
+ ExternalData() {}
+ virtual ~ExternalData() {}
};
-// ATT_HARDBLANK ******************************
-// Attribut fuer geschuetzte Leerzeichen.
+typedef ::boost::shared_ptr<ExternalData> tExternalDataPointer;
+}
-class SW_DLLPUBLIC SwFmtHardBlank : public SfxPoolItem
+
+class IDocumentExternalData
{
- sal_Unicode cChar;
-public:
- SwFmtHardBlank( sal_Unicode cCh, BOOL bCheck = TRUE );
+protected:
+ typedef ::std::hash_map<sw::tExternalDataType, sw::tExternalDataPointer, sw::ExternalDataTypeHash>
+ tExternalData;
- // "pure virtual Methoden" vom SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ tExternalData m_externalData;
+ virtual ~IDocumentExternalData() {};
- inline sal_Unicode GetChar() const { return cChar; }
- inline SwFmtHardBlank& operator=(const SwFmtHardBlank& rHB)
- { cChar = rHB.GetChar(); return *this; }
+public:
+ virtual void setExternalData(sw::tExternalDataType eType,
+ sw::tExternalDataPointer pPayload) = 0;
+ virtual sw::tExternalDataPointer getExternalData(sw::tExternalDataType eType) = 0;
};
-
-#endif
-
+#endif //INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 88251c0576cd..e01041edafcd 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -177,12 +177,11 @@ class SwPostItMgr: public SfxListener
bool HasScrollbars() const;
void Focus(SfxBroadcaster& rBC);
- sal_Int32 GetInitialAnchorDistance() const;
- sal_Int32 GetScrollSize() const;
- sal_Int32 GetSpaceBetween() const;
+ sal_Int32 GetInitialAnchorDistance() const;
+ sal_Int32 GetScrollSize() const;
+ sal_Int32 GetSpaceBetween() const;
void SetReadOnlyState();
- DECL_LINK( CalcHdl, void*);
-
+ DECL_LINK( CalcHdl, void*);
protected:
public:
@@ -263,6 +262,12 @@ class SwPostItMgr: public SfxListener
sal_uInt16 Replace(SvxSearchItem* pItem);
sal_uInt16 SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
sal_uInt16 FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
+
+ void AssureStdModeAtShell();
};
#endif
+
+
+
+
diff --git a/sw/inc/bookmrk.hxx b/sw/inc/bookmrk.hxx
deleted file mode 100644
index 3b459f61c081..000000000000
--- a/sw/inc/bookmrk.hxx
+++ /dev/null
@@ -1,218 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: bookmrk.hxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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 _BOOKMRK_HXX
-#define _BOOKMRK_HXX
-
-#include "hintids.hxx" //die Ids der Attribute, vor macitem damit die
- //die Attribut richtig angezogen werden.
-#include <svtools/macitem.hxx>
-
-#ifndef _KEYCOD_HXX //autogen
-#include <vcl/keycod.hxx>
-#endif
-#ifndef _TOOLS_REF_HXX
-#include <tools/ref.hxx>
-#endif
-#include <IDocumentBookmarkAccess.hxx>
-#include <calbck.hxx>
-#include <pam.hxx>
-
-#ifndef SW_DECL_SWSERVEROBJECT_DEFINED
-#define SW_DECL_SWSERVEROBJECT_DEFINED
-SV_DECL_REF( SwServerObject )
-#endif
-
-
-struct SwPosition; // fwd Decl. wg. UI
-
-class SwBookmark : public SwModify
-{
- SwPosition *pPos1, *pPos2; // wird im CTOR gesetzt, im DTOR geloescht
- // pPos1 is always != 0, pPos2 may be 0
- SwServerObjectRef refObj; // falls DataServer -> Pointer gesetzt
-
-protected:
- String aName;
- String aShortName;
- KeyCode aCode;
- IDocumentBookmarkAccess::BookmarkType eMarkType;
-
- SwBookmark( const SwPosition& aPos,
- const KeyCode& rCode,
- const String& rName, const String& rShortName);
-
-public:
- TYPEINFO();
-
- SwBookmark( const SwPosition& aPos );
- // --> OD 2007-09-26 #i81002#
- SwBookmark( const SwPaM& aPaM,
- const KeyCode& rCode,
- const String& rName, const String& rShortName);
- // <--
-
- // Beim Loeschen von Text werden Bookmarks mitgeloescht!
- virtual ~SwBookmark();
-
- // --> OD 2007-10-10 #i81002#
- // made virtual and thus no longer inline
- virtual const SwPosition& GetBookmarkPos() const;
- virtual const SwPosition* GetOtherBookmarkPos() const;
- // <--
-
- // nicht undofaehig
- const String& GetName() const { return aName; }
- // nicht undofaehig
- const String& GetShortName() const { return aShortName; }
- // nicht undofaehig
- const KeyCode& GetKeyCode() const { return aCode; }
-
- // Vergleiche auf Basis der Dokumentposition
- BOOL operator < (const SwBookmark &) const;
- BOOL operator ==(const SwBookmark &) const;
- // falls man wirklich auf gleiche Position abfragen will.
- BOOL IsEqualPos( const SwBookmark &rBM ) const;
-
- BOOL IsFormFieldMark() const { return IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT == eMarkType; }
- BOOL IsBookMark() const { return IDocumentBookmarkAccess::BOOKMARK == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT == eMarkType; }
-// // --> OD 2007-10-17 #TESTING#
-// BOOL IsBookMark() const
-// {
-// return IDocumentBookmarkAccess::BOOKMARK == eMarkType ||
-// IsCrossRefMark();
-// }
-// // <--
- BOOL IsMark() const { return IDocumentBookmarkAccess::MARK == eMarkType; }
- BOOL IsUNOMark() const { return IDocumentBookmarkAccess::UNO_BOOKMARK == eMarkType; }
- // --> OD 2007-10-11 #i81002# - bookmark type for cross-references
- BOOL IsCrossRefMark() const { return IDocumentBookmarkAccess::CROSSREF_BOOKMARK == eMarkType; }
- // <--
- void SetType( IDocumentBookmarkAccess::BookmarkType eNewType ) { eMarkType = eNewType; }
- IDocumentBookmarkAccess::BookmarkType GetType() const { return eMarkType; }
-
- // Daten Server-Methoden
- void SetRefObject( SwServerObject* pObj );
- const SwServerObject* GetObject() const { return &refObj; }
- SwServerObject* GetObject() { return &refObj; }
- BOOL IsServer() const { return refObj.Is(); }
-
- // --> OD 2007-10-10 #i81002#
- // made virtual and thus no longer inline
- // to access start and end of a bookmark.
- // start and end may be the same
- virtual const SwPosition* BookmarkStart() const;
- virtual const SwPosition* BookmarkEnd() const;
- // <--
-
- // --> OD 2007-09-26 #i81002#
- virtual void SetBookmarkPos( const SwPosition* pNewPos1 );
- virtual void SetOtherBookmarkPos( const SwPosition* pNewPos2 );
- // <--
-
-private:
- // fuer METWARE:
- // es wird (vorerst) nicht kopiert und nicht zugewiesen
- SwBookmark(const SwBookmark &);
- SwBookmark &operator=(const SwBookmark &);
-};
-
-class SwMark: public SwBookmark
-{
-public:
- SwMark( const SwPosition& aPos,
- const KeyCode& rCode,
- const String& rName, const String& rShortName);
-};
-
-class SW_DLLPUBLIC SwFieldBookmark : public SwBookmark
-{
-private:
- int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List
- int ffres;
- bool ffprot;
- bool ffsize; // 0 = Auto, 1=Exact (see ffhps)
- int fftypetxt; // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation
- bool ffrecalc;
- int ffmaxlen; // Number of characters for text field. Zero means unlimited.
- int ffhps; // Check box size (half-point sizes).
-
- String ffname;
- String ffhelptext;
-
-public:
- SwFieldBookmark(const SwPosition& aPos,
- const KeyCode& rCode,
- const String& rName, const String& rShortName,
- IDocumentBookmarkAccess::BookmarkType eMark);
-
- void SetFieldType(int fftype);
- int GetFieldType();
-
- void SetChecked(bool checked);
- bool IsChecked();
-
- void SetFFName(String aNewName) {
- this->ffname=aNewName;
- }
-
- String GetFFName()
- {
- return ffname;
- }
-
- int GetFFRes() {
- return ffres;
- }
-
- void SetFFRes(int nNew) {
- this->ffres=nNew;
- }
-
- void SetFFHelpText(String newffhelptext) {
- this->ffhelptext=newffhelptext;
- }
-
- String GetFFHelpText() {
- return ffhelptext;
- }
-};
-
-class SwUNOMark: public SwBookmark
-{
-public:
- // --> OD 2007-09-26 #i81002#
- SwUNOMark( const SwPaM& aPaM,
- const KeyCode& rCode,
- const String& rName, const String& rShortName);
- // <--
-};
-
-
-#endif
diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx
index 7855b8a68728..3b89f3540d7c 100644
--- a/sw/inc/breakit.hxx
+++ b/sw/inc/breakit.hxx
@@ -50,6 +50,9 @@ class String;
class SW_DLLPUBLIC SwBreakIt
{
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF;
+ mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak;
+ com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xCTLDetect;
+
com::sun::star::lang::Locale * m_pLocale;
com::sun::star::i18n::ForbiddenCharacters * m_pForbidden;
@@ -60,6 +63,9 @@ class SW_DLLPUBLIC SwBreakIt
void _GetLocale( const LanguageType aLang );
void _GetForbidden( const LanguageType aLang );
+ void createBreakIterator() const;
+ void createScriptTypeDetector();
+
// forbidden and not implemented.
SwBreakIt();
SwBreakIt( const SwBreakIt &);
@@ -79,15 +85,18 @@ public:
public:
static SwBreakIt * Get();
- // @@@ backward compatibility @@@
- com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak;
- com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xCTLDetect;
-
- const com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > & GetBreakIter()
+ com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > GetBreakIter()
{
+ createBreakIterator();
return xBreak;
}
+ com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > GetScriptTypeDetector()
+ {
+ createScriptTypeDetector();
+ return xCTLDetect;
+ }
+
const com::sun::star::lang::Locale& GetLocale( const LanguageType aLang )
{
if( !m_pLocale || aLast != aLang )
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 0e82be668074..91f1e538d355 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -188,7 +188,7 @@ class SwCalc
xub_StrLen nCommandPos;
SwDoc& rDoc;
- LocaleDataWrapper* pLclData;
+ const LocaleDataWrapper* pLclData;
CharClass* pCharClass;
USHORT nListPor;
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 6ae8e73cfb8d..05ff8add5dd8 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -153,7 +153,6 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
#define FN_GOTO (FN_EDIT + 11) /* Gehe zu */
#define FN_PASTE (FN_EDIT + 13) /* Einfuegen */
-#define FN_PASTESPECIAL (FN_EDIT + 14) /* Verknuepfung einfuegen */
#define FN_PASTESPECIAL_DLG (FN_EDIT + 15) /* Verknuepfung einfuegen */
#define FN_NUMBER_BULLETS (FN_EDIT + 21) /* Bullets */
#define FN_REPEAT (FN_EDIT + 22) /* Letzten Befehl wiederholen */
@@ -911,6 +910,7 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
#define FN_UNO_PARA_CONT_PREV_SUBTREE (FN_EXTRA2 + 109)
#define FN_UNO_PARA_NUM_STRING (FN_EXTRA2 + 110)
#define FN_UNO_TABLE_NAME (FN_EXTRA2 + 111)
+#define FN_UNO_META (FN_EXTRA2 + 112)
/*--------------------------------------------------------------------
Bereich: Hilfe
diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
index 329c81b7fb38..7d8d9ca4a5a3 100644
--- a/sw/inc/dbgoutsw.hxx
+++ b/sw/inc/dbgoutsw.hxx
@@ -35,6 +35,11 @@
#include <hash_map>
#include <tox.hxx>
class String;
+
+namespace rtl
+{
+class OUString;
+}
class SwNode;
class SwTxtAttr;
class SwpHints;
@@ -54,6 +59,7 @@ class SwNumRuleTbl;
class SwNumRule;
class SwOutlineNodes;
class SwTxtFmtColl;
+class SwNodeRange;
#define DBG_OUT_HERE printf("%s(%d):", __FILE__, __LINE__)
#define DBG_OUT_HERE_FN printf("%s(%d) %s:", __FILE__, __LINE__, __FUNCTION__)
@@ -68,6 +74,7 @@ extern bool bDbgOutPrintAttrSet;
SW_DLLPUBLIC const char * dbg_out(const void * pVoid);
SW_DLLPUBLIC const char * dbg_out(const String & aStr);
+SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr);
SW_DLLPUBLIC const char * dbg_out(const SwRect & rRect);
SW_DLLPUBLIC const char * dbg_out(const SwFrmFmt & rFrmFmt);
SW_DLLPUBLIC const char * dbg_out(const SwNode & rNode);
@@ -88,6 +95,7 @@ SW_DLLPUBLIC const char * dbg_out(const SwNumRule & rRule);
SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt);
SW_DLLPUBLIC const char * dbg_out(const SwFrmFmts & rFrmFmts);
SW_DLLPUBLIC const char * dbg_out(const SwNumRuleTbl & rTbl);
+SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange);
template<typename tKey, typename tMember, typename fHashFunction>
String lcl_dbg_out(const std::hash_map<tKey, tMember, fHashFunction> & rMap)
@@ -118,7 +126,7 @@ const char * dbg_out(const std::hash_map<tKey, tMember, fHashFunction> & rMap)
{
return dbg_out(lcl_dbg_out(rMap));
}
-const char * dbg_out(const SwFormToken & rToken);
-const char * dbg_out(const SwFormTokens & rTokens);
+SW_DLLPUBLIC const char * dbg_out(const SwFormToken & rToken);
+SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens);
#endif // DEBUG
#endif // __DBGOUTSW_HXX
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index bd452fbaf15c..de82d9056ff9 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -58,6 +58,7 @@
#include <IDocumentListsAccess.hxx>
class SwList;
// <--
+#include <IDocumentExternalData.hxx>
#define _SVSTDARR_STRINGSDTOR
#include <svtools/svstdarr.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
@@ -218,6 +219,9 @@ class IGrammarContact;
namespace sw { namespace mark {
class MarkManager;
}}
+namespace sw {
+ class MetaFieldManager;
+}
namespace com { namespace sun { namespace star {
namespace i18n {
@@ -268,8 +272,9 @@ class SW_DLLPUBLIC SwDoc :
public IDocumentOutlineNodes,
// <--
// --> OD 2008-03-12 #refactorlists#
- public IDocumentListsAccess
+ public IDocumentListsAccess,
// <--
+ public IDocumentExternalData
{
friend void _InitCore();
@@ -298,6 +303,7 @@ class SW_DLLPUBLIC SwDoc :
mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator;
const ::boost::scoped_ptr< ::sw::mark::MarkManager> pMarkManager;
+ const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
// -------------------------------------------------------------------
// die Pointer
@@ -614,8 +620,8 @@ private:
// nur fuer den internen Gebrauch deshalb privat.
// Kopieren eines Bereiches im oder in ein anderes Dokument !
// Die Position darf nicht im Bereich liegen !!
- sal_Bool _Copy( SwPaM&, SwPosition&,
- sal_Bool MakeNewFrms /*= sal_True*/, bool bCopyAll, SwPaM* pCpyRng /*= 0*/ ) const; // in ndcopy.cxx
+ bool CopyImpl( SwPaM&, SwPosition&, const bool MakeNewFrms /*= true */,
+ const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/ ) const;
SwFlyFrmFmt* _MakeFlySection( const SwPosition& rAnchPos,
const SwCntntNode& rNode, RndStdIds eRequestId,
@@ -627,9 +633,10 @@ private:
const SfxItemSet* pGrfAttrSet,
SwFrmFmt* = 0 );
- void _CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex,
- const SwNodeIndex& rSttIdx,
- sal_Bool bCopyFlyAtFly = sal_False ) const; // steht im ndcopy.cxx
+ void CopyFlyInFlyImpl( const SwNodeRange& rRg,
+ const xub_StrLen nEndContentIndex,
+ const SwNodeIndex& rStartIdx,
+ const bool bCopyFlyAtFly = false ) const;
sal_Int8 SetFlyFrmAnchor( SwFrmFmt& rFlyFmt, SfxItemSet& rSet, sal_Bool bNewFrms );
// --> OD 2005-01-13 #i40550#
@@ -639,7 +646,7 @@ private:
FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt );
void CopyFmtArr( const SvPtrarr& rSourceArr, SvPtrarr& rDestArr,
FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt );
- void _CopyPageDescHeaderFooter( sal_Bool bCpyHeader,
+ void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt );
SwFmt* FindFmtByName( const SvPtrarr& rFmtArr,
const String& rName ) const;
@@ -702,6 +709,11 @@ private:
void InitTOXTypes();
void Paste( const SwDoc& );
+ bool DeleteAndJoinImpl(SwPaM&, const bool);
+ bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
+ bool DeleteRangeImpl(SwPaM&, const bool unused = false);
+ bool ReplaceRangeImpl(SwPaM&, String const&, const bool);
+
public:
/** Life cycle
@@ -878,9 +890,9 @@ public:
/** IDocumentContentOperations
*/
- virtual bool Copy(SwPaM&, SwPosition&, bool bCopyAll) const;
+ virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll) const;
virtual void DeleteSection(SwNode* pNode);
- virtual bool Delete(SwPaM&);
+ virtual bool DeleteRange(SwPaM&);
virtual bool DelFullPara(SwPaM&);
// --> OD 2009-08-20 #i100466#
// Add optional parameter <bForceJoinNext>, default value <false>
@@ -888,13 +900,12 @@ public:
virtual bool DeleteAndJoin( SwPaM&,
const bool bForceJoinNext = false );
// <--
- virtual bool Move(SwPaM&, SwPosition&, SwMoveFlags);
- virtual bool Move(SwNodeRange&, SwNodeIndex&, SwMoveFlags);
+ virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags);
+ virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags);
virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags);
- virtual bool Overwrite(const SwPaM &rRg, sal_Unicode c);
virtual bool Overwrite(const SwPaM &rRg, const String& rStr);
- virtual bool Insert(const SwPaM &rRg, sal_Unicode c);
- virtual bool Insert(const SwPaM &rRg, const String&, bool bHintExpand);
+ virtual bool InsertString(const SwPaM &rRg, const String&,
+ const enum InsertFlags nInsertMode = INS_EMPTYEXPAND );
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
@@ -902,8 +913,10 @@ public:
virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*);
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
- virtual bool Insert(const SwPaM &rRg, const SfxPoolItem&, sal_uInt16 nFlags);
- virtual bool Insert(const SwPaM &rRg, const SfxItemSet&, sal_uInt16 nFlags);
+ virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
+ const SetAttrMode nFlags);
+ virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
+ const SetAttrMode nFlags);
virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj);
virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&);
virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
@@ -911,7 +924,8 @@ public:
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart);
virtual bool AppendTxtNode(SwPosition& rPos);
virtual void SetModified(SwPaM &rPaM);
- virtual bool Replace(SwPaM& rPam, const String& rNewStr, bool bRegExpRplc);
+ virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
+ const bool bRegExReplace);
virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos );
/** IDocumentStylePoolAccess
@@ -1034,6 +1048,12 @@ public:
const String sNewListStyleName );
// <--
+ /** IDocumentExternalData */
+ virtual void setExternalData(::sw::tExternalDataType eType,
+ ::sw::tExternalDataPointer pPayload);
+ virtual ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType);
+
+
/** INextInterface here
*/
@@ -1358,11 +1378,11 @@ public:
// kopiere die Kopzeile (mit dem Inhalt!) aus dem SrcFmt
// ins DestFmt ( auch ueber Doc grenzen hinaus!)
void CopyHeader( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
- { _CopyPageDescHeaderFooter( sal_True, rSrcFmt, rDestFmt ); }
+ { CopyPageDescHeaderFooterImpl( true, rSrcFmt, rDestFmt ); }
// kopiere die Fusszeile (mit dem Inhalt!) aus dem SrcFmt
// ins DestFmt ( auch ueber Doc grenzen hinaus!)
void CopyFooter( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
- { _CopyPageDescHeaderFooter( sal_False, rSrcFmt, rDestFmt ); }
+ { CopyPageDescHeaderFooterImpl( false, rSrcFmt, rDestFmt ); }
//fuer Reader
@@ -1394,7 +1414,7 @@ public:
// Methoden fuer die Verzeichnisse:
// - Verzeichnismarke einfuegen loeschen travel
sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& ) const;
- void Delete( const SwTOXMark* pTOXMark );
+ void DeleteTOXMark( const SwTOXMark* pTOXMark );
const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
SwTOXSearch eDir, sal_Bool bInReadOnly );
@@ -1510,13 +1530,16 @@ public:
// <--
void SetCounted( const SwPaM&, bool bCounted);
- /**
- Replace numbering rules in a PaM by another numbering rule.
+ // --> OD 2009-08-25 #i86492#
+ // no longer needed.
+ // SwDoc::SetNumRule( rPaM, rNumRule, false, <ListId>, sal_True, true ) have to be used instead.
+// /**
+// Replace numbering rules in a PaM by another numbering rule.
- \param rPaM PaM to replace the numbering rules in
- \param rNumRule numbering rule to replace the present numbering rules
- */
- void ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule);
+// \param rPaM PaM to replace the numbering rules in
+// \param rNumRule numbering rule to replace the present numbering rules
+// */
+// void ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule);
void MakeUniqueNumRules(const SwPaM & rPaM);
@@ -1576,8 +1599,8 @@ public:
- FALSE: search backward
\param bNum - TRUE: search for enumeration
- FALSE: search for itemize
- \param bOutline - TRUE: search for non-outline numbering rule
- - FALSE: search for outline numbering rule
+ \param bOutline - TRUE: search for outline numbering rule
+ - FALSE: search for non-outline numbering rule
\param nNonEmptyAllowed number of non-empty paragraphs allowed between
rPos and found paragraph
@@ -1589,13 +1612,13 @@ public:
input parameter - boolean, indicating, if start node, determined by given
start position has to be investigated or not.
*/
- const SwNumRule * SearchNumRule(SwPosition & rPos,
- BOOL bForward,
- BOOL bNum,
- BOOL bOutline,
+ const SwNumRule * SearchNumRule(const SwPosition & rPos,
+ const bool bForward,
+ const bool bNum,
+ const bool bOutline,
int nNonEmptyAllowed,
String& sListId,
- bool bInvestigateStartNode = false );
+ const bool bInvestigateStartNode = false );
// Absaetze ohne Numerierung, aber mit Einzuegen
sal_Bool NoNum( const SwPaM& );
@@ -1767,9 +1790,9 @@ public:
inline void SetOle2Link(const Link& rLink) {aOle2Link = rLink;}
inline const Link& GetOle2Link() const {return aOle2Link;}
- // SS fuer Bereiche
- SwSection* Insert( const SwPaM& rRange, const SwSection& rNew,
- const SfxItemSet* pAttr = 0, sal_Bool bUpdate = sal_True );
+ // insert section (the ODF kind of section, not the nodesarray kind)
+ SwSection* InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
+ const SfxItemSet* pAttr = 0, bool bUpdate = true);
sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
const SwNode** ppSttNd = 0 ) const;
SwSection* GetCurrSection( const SwPosition& rPos ) const;
@@ -2091,6 +2114,7 @@ public:
}
::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
+ ::sw::MetaFieldManager & GetMetaFieldManager();
SwDoc* CreateCopy() const;
};
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 6bfd5437a20e..6ed3f6d652bd 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -151,6 +151,8 @@ public:
static SfxInterface *_GetInterface() { return GetStaticInterface(); }
+ static rtl::OUString GetEventName( sal_Int32 nId );
+
//Das Doc wird fuer SO-Datenaustausch benoetigt!
SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, sal_Bool _bScriptingSupport = sal_True );
SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD );
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index a3c7b7489dd1..1ce87e0df410 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -181,7 +181,7 @@ class SW_DLLPUBLIC SwEditShell: public SwCrsrShell
public:
// Editieren (immer auf allen selektierten Bereichen)
void Insert( sal_Unicode, BOOL bOnlyCurrCrsr = FALSE );
- void Insert( const String &);
+ void Insert2( const String &, const bool bForceExpandHints = false );
void Overwrite( const String & );
// Ersetz einen selektierten Bereich in einem TextNode mit dem
@@ -332,7 +332,7 @@ public:
{ return (SwCharFmt*)SwEditShell::GetFmtFromPool( nId ); }
// Felder
- void Insert(SwField&);
+ void Insert2(SwField&, const bool bForceExpandHints = false);
SwField* GetCurFld() const;
void UpdateFlds( SwField & ); // ein einzelnes Feld
@@ -512,9 +512,9 @@ public:
// --> OD 2008-03-18 #refactorlists# - add output parameter <sListId>
// in case a list style is found, <sListId> holds the list id, to which the
// text node belongs, which applies the found list style.
- const SwNumRule * SearchNumRule(BOOL bForward,
- BOOL bNum,
- BOOL bOutline,
+ const SwNumRule * SearchNumRule(const bool bForward,
+ const bool bNum,
+ const bool bOutline,
int nNonEmptyAllowed,
String& sListId );
// <--
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 496df5c56a1c..2ca982e80c0b 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -39,6 +39,7 @@
class SwField;
class SwTxtFld;
+class SwView;
// ATT_FLD ***********************************
class SW_DLLPUBLIC SwFmtFld : public SfxPoolItem, public SwClient, public SfxBroadcaster
@@ -103,16 +104,19 @@ class SW_DLLPUBLIC SwFmtFldHint : public SfxHint
const SwFmtFld* pFld;
sal_Int16 nWhich;
+ const SwView* pView;
public:
- SwFmtFldHint( const SwFmtFld* p, sal_Int16 n )
+ SwFmtFldHint( const SwFmtFld* p, sal_Int16 n, const SwView* pV = 0)
: pFld(p)
, nWhich(n)
+ , pView(pV)
{}
TYPEINFO();
const SwFmtFld* GetField() const { return pFld; }
sal_Int16 Which() const { return nWhich; }
+ const SwView* GetView() const { return pView; }
};
#endif
diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx
new file mode 100755
index 000000000000..952181d0498c
--- /dev/null
+++ b/sw/inc/fmtmeta.hxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fmtmeta.hxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_FMTMETA_HXX
+#define SW_FMTMETA_HXX
+
+#include <svtools/poolitem.hxx>
+#include <sfx2/Metadatable.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+#include <vector>
+
+
+namespace com { namespace sun { namespace star {
+ namespace text {
+ class XTextField;
+ }
+}}}
+
+
+/**
+ * The classes that make up a meta entity are:
+ * <dl>
+ * <dt>SwTxtMeta</dt><dd>the text hint</dd>
+ * <dt>SwFmtMeta</dt><dd>the pool item</dd>
+ * <dt>sw::Meta</dt><dd>the metadatable entity itself</dd>
+ * <dt>SwXMeta</dt><dd>the UNO wrapper object</dd>
+ * </dl>
+ *
+ * The text hint contains the pool item (as usual) and has a pointer to the
+ * text node at which it is attached.
+ * The pool item has a shared pointer to the metadatable entity, and a reverse
+ * pointer to the text attribute at which it is attached.
+ * The pool item is non-poolable; it may only be attached to one text
+ * attribute.
+ * Of all the pool items that refer to a metadatable entity, only one may be
+ * in the document content at any time. Others may be in the undo array, or in
+ * undo objects.
+ * The metadatable entity has a reverse pointer to the pool item that is
+ * currently in the document. It also registers as a client at the text node
+ * at which it is attached via this pool item and its text attribute.
+ * The UNO wrapper object registers as a client at the metadatable entity.
+ *
+ * Copying the metadatable entity proceeds in the following way:
+ * <ol>
+ * <li>The pool item is cloned (because it is non-poolable); the clone
+ * points to the same metadatable entity, but the metadatable entity's
+ * reverse pointer is unchanged.</li>
+ * <li>A new text hint is created, taking over the new pool item.
+ * Unfortunately, this also makes the metadatable entity point at the
+ * cloned pool item.</li>
+ * <li>The text hint is inserted into the hints array of some text node.</li>
+ * <li>The DoCopy() method must be called at the new pool item:
+ * it will clone the metadatable entity (using RegisterAsCopyOf),
+ * and fix the reverse pointer of the original to point at the
+ * original pool item.
+ * This is necessary, because first, a metadatable entity may
+ * only be inserted once into a document, and second, the copy may be
+ * inserted into a different document than the source document!</li>
+ * </ol>
+ */
+
+class SwTxtMeta;
+class SwXMeta;
+class SwXMetaField;
+namespace sw {
+ class Meta;
+}
+
+class SwFmtMeta
+ : public SfxPoolItem
+{
+private:
+ friend class SwTxtMeta; // needs SetTxtAttr
+ friend class ::sw::Meta; // needs m_pTxtAttr
+
+ ::boost::shared_ptr< ::sw::Meta > m_pMeta;
+ SwTxtMeta * m_pTxtAttr;
+
+ SwTxtMeta * GetTxtAttr() { return m_pTxtAttr; }
+ void SetTxtAttr(SwTxtMeta * const i_pTxtAttr);
+
+ explicit SwFmtMeta( const USHORT i_nWhich );
+
+public:
+ // takes ownership
+ explicit SwFmtMeta( ::boost::shared_ptr< ::sw::Meta > const & i_pMeta,
+ const USHORT i_nWhich );
+ virtual ~SwFmtMeta();
+
+ // SfxPoolItem
+ virtual int operator==( const SfxPoolItem & ) const;
+ virtual SfxPoolItem * Clone( SfxItemPool *pPool = 0 ) const;
+// TYPEINFO();
+
+ // notify clients registered at m_pMeta that this meta is being removed
+ void NotifyRemoval();
+ static SwFmtMeta * CreatePoolDefault( const USHORT i_nWhich );
+ ::sw::Meta * GetMeta() { return m_pMeta.get(); }
+ /// this method <em>must</em> be called when the hint is actually copied
+ void DoCopy( SwFmtMeta & rOriginalMeta );
+};
+
+
+namespace sw {
+
+class MetaFieldManager;
+
+class Meta
+ : public ::sfx2::Metadatable
+ , public SwModify
+{
+protected:
+ friend class ::SwFmtMeta; // SetFmtMeta
+ friend class ::SwXMeta; // GetTxtNode, GetTxtAttr
+
+ SwFmtMeta * m_pFmt;
+
+ SwTxtMeta * GetTxtAttr() const;
+ SwTxtNode * GetTxtNode() const; // returns 0 if not in document (undo)
+
+ SwFmtMeta * GetFmtMeta() const { return m_pFmt; }
+ void SetFmtMeta( SwFmtMeta * const i_pFmt ) { m_pFmt = i_pFmt; };
+
+public:
+ explicit Meta(SwFmtMeta * const i_pFmt = 0);
+ virtual ~Meta();
+
+ // SwClient
+ virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew );
+
+ // sfx2::Metadatable
+ virtual ::sfx2::IXmlIdRegistry& GetRegistry();
+ virtual bool IsInClipboard() const;
+ virtual bool IsInUndo() const;
+ virtual bool IsInContent() const;
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
+};
+
+class MetaField
+ : public Meta
+{
+private:
+ friend class ::SwFmtMeta;
+ friend class ::SwXMetaField;
+ friend class ::sw::MetaFieldManager;
+
+ sal_uInt32 m_nNumberFormat;
+ bool m_bIsFixedLanguage;
+
+ sal_uInt32 GetNumberFormat(::rtl::OUString const & rContent) const;
+ void SetNumberFormat(sal_uInt32 nNumberFormat);
+ bool IsFixedLanguage() const { return m_bIsFixedLanguage; }
+ void SetIsFixedLanguage(bool b) { m_bIsFixedLanguage = b; }
+
+ explicit MetaField(SwFmtMeta * const i_pFmt = 0,
+ const sal_uInt32 nNumberFormat = SAL_MAX_UINT32,
+ const bool bIsFixedLanguage = false );
+
+public:
+ /// get prefix/suffix from the RDF repository. @throws RuntimeException
+ void GetPrefixAndSuffix(
+ ::rtl::OUString *const o_pPrefix, ::rtl::OUString *const o_pSuffix);
+};
+
+/** knows all meta-fields in the document. */
+class MetaFieldManager
+ : private ::boost::noncopyable
+{
+private:
+ typedef ::std::vector< ::boost::weak_ptr<MetaField> > MetaFieldList_t;
+ MetaFieldList_t m_MetaFields;
+
+public:
+ MetaFieldManager();
+ ::boost::shared_ptr<MetaField> makeMetaField(
+ SwFmtMeta * const i_pFmt = 0,
+ const sal_uInt32 nNumberFormat = SAL_MAX_UINT32,
+ const bool bIsFixedLanguage = false );
+ /// get all meta fields
+ ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextField> > getMetaFields();
+};
+
+} // namespace sw
+
+#endif // SW_FMTMETA_HXX
+
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 325638b5df00..1dc28e197107 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -112,23 +112,33 @@ enum RES_TXTATR
{
RES_TXTATR_BEGIN = RES_CHRATR_END,
-// alle TextAttribute mit einem Ende
-// JP 12.07.96: die Ids RES_TXTATR_NOLINEBREAK und RES_TXTATR_NOHYPHEN
-// wanderten in den Bereich der CharAttr. Die Ids selbst muessen
-// aber als Dummies noch erhalten bleiben. Der SwG-/Sw3 Reader
-// merkt sich die Ids immer als Offset zum Start der Gruppe!!!
-// Aus dem RES_TXTATR_NOLINEBREAK ist jetzt RES_TXTATR_INETFMT geworden.
+/** text attributes with start and end.
+ #i105453#:
+ Hints (SwTxtAttr) with the same start and end position are sorted by
+ WhichId, i.e., the TXTATR constants defined here.
+ The text formatting (SwAttrIter) poses some requirements on TXTATR order:
+ - AUTOFMT must precede CHARFMT, so that auto style can overwrite char style.
+ - INETFMT must precede CHARFMT, so that link style can overwrite char style.
+ (this is actually surprising: CHARFMT hints are not split at INETFMT
+ hints on insertion, but on exporting to ODF. if CHARFMT would precede
+ INETFMT, then exporting and importing will effectively change precedence)
+
+ Nesting hints (SwTxtAttrNesting) also have requirements on TXTATR order,
+ to ensure proper nesting (because CJK_RUBY and INETFMT have no CH_TXTATR):
+ - INETFMT should precede CJK_RUBY (for UNO API it does not matter...)
+ - META and METAFIELD must precede CJK_RUBY and INETFMT
+ */
RES_TXTATR_WITHEND_BEGIN = RES_TXTATR_BEGIN ,
- RES_TXTATR_AUTOFMT = RES_TXTATR_WITHEND_BEGIN, // 41
- RES_TXTATR_INETFMT, // 42
- RES_TXTATR_REFMARK, // 43
- RES_TXTATR_TOXMARK, // 44
- RES_TXTATR_CHARFMT, // 45
- RES_TXTATR_DUMMY5, // 46
- RES_TXTATR_CJK_RUBY, // 47
- RES_TXTATR_UNKNOWN_CONTAINER, // 48
- RES_TXTATR_DUMMY6, // 49
- RES_TXTATR_DUMMY7, // 50
+ RES_TXTATR_REFMARK = RES_TXTATR_WITHEND_BEGIN, // 41
+ RES_TXTATR_TOXMARK, // 42
+ RES_TXTATR_META, // 43
+ RES_TXTATR_METAFIELD, // 44
+ RES_TXTATR_AUTOFMT, // 45
+ RES_TXTATR_INETFMT, // 46
+ RES_TXTATR_CHARFMT, // 47
+ RES_TXTATR_CJK_RUBY, // 48
+ RES_TXTATR_UNKNOWN_CONTAINER, // 49
+ RES_TXTATR_DUMMY5, // 50
RES_TXTATR_WITHEND_END,
// alle TextAttribute ohne ein Ende
@@ -136,8 +146,8 @@ RES_TXTATR_NOEND_BEGIN = RES_TXTATR_WITHEND_END,
RES_TXTATR_FIELD = RES_TXTATR_NOEND_BEGIN, // 51
RES_TXTATR_FLYCNT, // 52
RES_TXTATR_FTN, // 53
- RES_TXTATR_SOFTHYPH, // 54
- RES_TXTATR_HARDBLANK, // 55
+ RES_TXTATR_DUMMY4, // 54
+ RES_TXTATR_DUMMY3, // 55
RES_TXTATR_DUMMY1, // 56
RES_TXTATR_DUMMY2, // 57
RES_TXTATR_NOEND_END,
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index 5a57724f2540..9837a4e664bc 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -132,8 +132,8 @@ class SwIndexReg
static SwIndexReg* pEmptyIndexArray;
protected:
- virtual void Update( const SwIndex & aPos, xub_StrLen nLen,
- BOOL bNegativ = FALSE, BOOL bDelete = FALSE );
+ virtual void Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
+ const bool bNegative = false, const bool bDelete = false );
void ChkArr();
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index fe58df27613b..6bbd72778498 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -180,7 +180,7 @@ public:
BOOL _MoveNodes( const SwNodeRange&, SwNodes& rNodes, const SwNodeIndex&,
BOOL bNewFrms = TRUE );
- void Move( SwPaM&, SwPosition&, SwNodes& rNodes, BOOL bSplitNd=TRUE );
+ void MoveRange( SwPaM&, SwPosition&, SwNodes& rNodes );
void _Copy( const SwNodeRange& rRg, const SwNodeIndex& rInsPos,
BOOL bNewFrms = TRUE ) const
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx
index 04bf3a7914b3..e5a3ee794e0b 100644
--- a/sw/inc/ndhints.hxx
+++ b/sw/inc/ndhints.hxx
@@ -34,11 +34,30 @@
#include <svtools/svarray.hxx>
#include <tools/mempool.hxx>
+#include "swtypes.hxx"
+
//#include "numrule.hxx"
class SwTxtNode;
class SwRegHistory; // steht im RolBck.hxx
class SwTxtAttr;
+class SwTxtAttrNesting;
+
+class SfxPoolItem;
+class SfxItemSet;
+class SwDoc;
+
+SW_DLLPRIVATE SwTxtAttr *
+MakeTxtAttr( SwDoc & rDoc, SfxPoolItem & rNew,
+ xub_StrLen nStt, xub_StrLen nEnd );
+SW_DLLPRIVATE SwTxtAttr *
+MakeTxtAttr( SwDoc & rDoc, const SfxItemSet & rSet,
+ xub_StrLen nStt, xub_StrLen nEnd );
+
+// create redline dummy text hint that must not be inserted into hints array
+SW_DLLPRIVATE SwTxtAttr*
+MakeRedlineTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr );
+
/*
* Ableitung der Klasse SwpHints ueber den Umweg ueber SwpHts, da
@@ -148,7 +167,10 @@ private:
return m_bHasHiddenParaField;
}
- void BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMode );
+ void InsertNesting(SwTxtAttrNesting & rNewHint);
+ bool TryInsertNesting(SwTxtNode & rNode, SwTxtAttrNesting & rNewHint);
+ void BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint,
+ const SetAttrMode nMode );
bool MergePortions( SwTxtNode& rNode );
public:
@@ -162,7 +184,10 @@ public:
void DeRegister() { Register(0); }
SwRegHistory* GetHistory() const { return m_pHistory; }
- void Insert( SwTxtAttr* pHt, SwTxtNode &rNode, USHORT nMode = 0 );
+ /// try to insert the hint
+ /// @return true iff hint successfully inserted
+ bool TryInsertHint( SwTxtAttr * const pHint, SwTxtNode & rNode,
+ const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
inline bool HasFtn() const { return m_bFootnote; }
inline bool IsInSplitNode() const { return m_bInSplitNode; }
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index dffa47f898f3..d4d59afa3d9c 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -38,6 +38,7 @@
#include <errhdl.hxx>
#include <modeltoviewhelper.hxx>
#include <SwNumberTreeTypes.hxx>
+#include <IDocumentContentOperations.hxx>
#include <sfx2/Metadatable.hxx>
@@ -75,11 +76,6 @@ class SwScriptInfo;
struct SwDocStat;
struct SwParaIdleData_Impl;
-// Konstanten fuer das Text-Insert:
-#define INS_DEFAULT 0x0000 // keine Extras
-#define INS_EMPTYEXPAND 0x0001 // leere Hints beim Einfuegen aufspannen
-#define INS_NOHINTEXPAND 0x0002 // Hints an der InsPos nicht aufspannen
-
namespace com { namespace sun { namespace star { namespace uno {
template < class > class Sequence;
}}}}
@@ -97,8 +93,6 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
friend class SwNodes;
friend class SwTxtFrm;
friend class SwScriptInfo;
- friend void SwpHints::Insert( SwTxtAttr*, SwTxtNode&, USHORT );
- friend void SwpHints::BuildPortions( SwTxtNode&, SwTxtAttr&, USHORT );
//Kann 0 sein, nur dann nicht 0 wenn harte Attribute drin stehen.
//Also niemals direkt zugreifen!
@@ -148,11 +142,10 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
SW_DLLPRIVATE SwTxtNode* _MakeNewTxtNode( const SwNodeIndex&, BOOL bNext = TRUE,
BOOL bChgFollow = TRUE );
- SW_DLLPRIVATE void _Cut( SwTxtNode *pDest, const SwIndex &rDestStart,
- const SwIndex &rStart, xub_StrLen nLen, BOOL bUpdate = TRUE );
-
- SW_DLLPRIVATE SwTxtAttr* MakeTxtAttr( const SfxPoolItem& rNew, xub_StrLen nStt, xub_StrLen nEnd, bool bRedlineAttr = false );
- SW_DLLPRIVATE SwTxtAttr* MakeTxtAttr( const SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd );
+ SW_DLLPRIVATE void CutImpl(
+ SwTxtNode * const pDest, const SwIndex & rDestStart,
+ const SwIndex & rStart, /*const*/ xub_StrLen nLen,
+ const bool bUpdate = true );
// Verlagere alles umfassende harte Attribute in den AttrSet des Absatzes
SW_DLLPRIVATE void MoveTxtAttr_To_AttrSet(); // wird von SplitNode gerufen.
@@ -258,21 +251,30 @@ public:
virtual USHORT ResetAllAttr();
// <--
- /*
- * Einfuegen anderer Datentypen durch Erzeugen eines
- * temporaeren Strings.
- */
- SwTxtNode& Insert( xub_Unicode c, const SwIndex &rIdx );
- SwTxtNode& Insert( const XubString &rStr, const SwIndex &rIdx,
- const USHORT nMode = INS_DEFAULT );
+ /// insert text content
+ void InsertText( const XubString & rStr, const SwIndex & rIdx,
+ const enum IDocumentContentOperations::InsertFlags nMode
+ = IDocumentContentOperations::INS_DEFAULT );
- SwTxtNode& Erase( const SwIndex &rIdx, xub_StrLen nCount = STRING_LEN,
- const USHORT nMode = INS_DEFAULT );
-
- // Aktionen auf Attributen
- // loesche alle TextAttribute die als Attribut im Set vorhanden sind
- // (Set-Pointer != 0 ) oder alle deren Which-Wert mit nWhich mappen
- // oder wenn Which = 0, alle.
+ /** delete text content
+ ATTENTION: must not be called with a range that overlaps the start of
+ an attribute with both extent and dummy char
+ */
+ void EraseText ( const SwIndex &rIdx, const xub_StrLen nCount = STRING_LEN,
+ const enum IDocumentContentOperations::InsertFlags nMode
+ = IDocumentContentOperations::INS_DEFAULT );
+
+ /** delete all attributes.
+ If neither pSet nor nWhich is given, delete all attributes (except
+ refmarks, toxmarks, meta) in range.
+ @param rIdx start position
+ @param nLen range in which attributes will be deleted
+ @param pSet if not 0, delete only attributes contained in pSet
+ @param nWhich if not 0, delete only attributes with matching which
+ @param bInclRefToxMark
+ refmarks, toxmarks, and metas will be ignored unless this is true
+ ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
+ */
void RstAttr( const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich = 0,
const SfxItemSet* pSet = 0, BOOL bInclRefToxMark = FALSE );
void GCAttr();
@@ -283,17 +285,20 @@ public:
// loesche alle Attribute aus dem SwpHintsArray.
void ClearSwpHintsArr( bool bDelFields );
- // Insert pAttr into hints array.
- BOOL Insert( SwTxtAttr *pAttr, USHORT nMode = 0 );
- // lege ein neues TextAttribut an und fuege es ins SwpHints-Array ein
- // returne den neuen Pointer (oder 0 bei Fehlern)!
- SwTxtAttr* InsertItem( const SfxPoolItem& rAttr,
- xub_StrLen nStt, xub_StrLen nEnd, USHORT nMode = 0 );
+ /// Insert pAttr into hints array. @return true iff inserted successfully
+ bool InsertHint( SwTxtAttr * const pAttr,
+ const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+ /// create new text attribute from rAttr and insert it
+ /// @return inserted hint; 0 if not sure the hint is inserted
+ SwTxtAttr* InsertItem( SfxPoolItem& rAttr,
+ const xub_StrLen nStart, const xub_StrLen nEnd,
+ const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
// setze diese Attribute am TextNode. Wird der gesamte Bereich umspannt,
// dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr)
BOOL SetAttr( const SfxItemSet& rSet,
- xub_StrLen nStt, xub_StrLen nEnd, USHORT nMode = 0 );
+ xub_StrLen nStt, xub_StrLen nEnd,
+ const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
// erfrage die Attribute vom TextNode ueber den Bereich
// --> OD 2008-01-16 #newlistlevelattrs#
// Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
@@ -311,32 +316,34 @@ public:
// uebertrage Attribute eines AttrSets ( AutoFmt ) in das SwpHintsArray
void FmtToTxtAttr( SwTxtNode* pNd );
- // loeschen eines einzelnen Attributes (fuer SwUndoAttr)
- // ( nur das Attribut loeschen, dass mit Which,Start und End oder
- // mit pTxtHint identisch ist (es gibt nur ein gueltiges))
- // AUSNAHME: ToxMarks !!!
- void Delete( USHORT nTxtWhich, xub_StrLen nStart, xub_StrLen nEnd = 0 );
- void Delete( SwTxtAttr * pTxtAttr, BOOL bThisOnly = FALSE );
+ /// delete all attributes of type nWhich at nStart (opt. end nEnd)
+ void DeleteAttributes( const USHORT nWhich,
+ const xub_StrLen nStart, const xub_StrLen nEnd = 0 );
+ /// delete the attribute pTxtAttr
+ void DeleteAttribute ( SwTxtAttr * const pTxtAttr );
// Aktionen auf Text und Attributen
// --> OD 2008-11-18 #i96213#
// introduce optional parameter to control, if all attributes have to be copied.
- void Copy( SwTxtNode *pDest,
+ void CopyText( SwTxtNode * const pDest,
const SwIndex &rStart,
- USHORT nLen,
+ const xub_StrLen nLen,
const bool bForceCopyOfAllAttrs = false );
- void Copy( SwTxtNode *pDest,
+ void CopyText( SwTxtNode * const pDest,
const SwIndex &rDestStart,
const SwIndex &rStart,
xub_StrLen nLen,
const bool bForceCopyOfAllAttrs = false );
// <--
- void Cut(SwTxtNode *pDest, const SwIndex &rStart, xub_StrLen nLen);
- inline void Cut(SwTxtNode *pDest, const SwIndex &rDestStart,
- const SwIndex &rStart, xub_StrLen nLen);
- // ersetze im String an Position nIdx das Zeichen
- void Replace( const SwIndex& rStart, xub_Unicode cCh );
- void Replace( const SwIndex& rStart, xub_StrLen nLen, const XubString& rText );
+
+ void CutText(SwTxtNode * const pDest,
+ const SwIndex & rStart, const xub_StrLen nLen);
+ inline void CutText(SwTxtNode * const pDest, const SwIndex &rDestStart,
+ const SwIndex & rStart, const xub_StrLen nLen);
+
+ /// replace nDelLen characters at rStart with rText
+ void ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen,
+ const XubString& rText );
void ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, const XubString& rText,
const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets );
@@ -355,18 +362,21 @@ public:
// gebe das vorgegebene Attribut, welches an der TextPosition (rIdx)
// gesetzt ist zurueck. Gibt es keines, returne 0-Pointer
// gesetzt heisst: Start <= rIdx < End
+ // FIXME: this function does not seem to be well-defined for those
+ // hints of which several may cover a single position, like TOXMark,
+ // or CharFmt
SwTxtAttr *GetTxtAttr( const SwIndex& rIdx, USHORT nWhichHt,
BOOL bExpand = FALSE ) const;
- // 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.
- SwTxtAttr *GetTxtAttr( const xub_StrLen nIdx,
- const USHORT nWhichHt = RES_TXTATR_END ) const;
-
- SwTxtFld *GetTxtFld( const SwIndex& rIdx )
- { return (SwTxtFld *)GetTxtAttr( rIdx, RES_TXTATR_FIELD ); }
+ /** get the text attribute at position nIndex which owns
+ the dummy character CH_TXTATR_* at that position, if one exists.
+ @param nIndex the position in the text
+ @param nWhich if different from RES_TXTATR_END, return only
+ attribute with given which id
+ @return the text attribute at nIndex of type nWhich, if it exists
+ */
+ SwTxtAttr *GetTxtAttrForCharAt( const xub_StrLen nIndex,
+ const RES_TXTATR nWhich = RES_TXTATR_END ) const;
// Aktuelles Wort zurueckliefern
XubString GetCurWord(xub_StrLen) const;
@@ -754,17 +764,14 @@ public:
bool IsHidden() const;
// <--
- inline SwTxtAttr* MakeRedlineTxtAttr( const SfxPoolItem& rNew )
- { return MakeTxtAttr( rNew, 0, 0, true ); }
-
TYPEINFO(); // fuer rtti
// fuers Umhaengen der TxtFmtCollections (Outline-Nummerierung!!)
virtual void Modify( SfxPoolItem*, SfxPoolItem* );
- // aus SwIndexReg
- virtual void Update( const SwIndex & aPos, USHORT xub_StrLen,
- BOOL bNegativ = FALSE, BOOL bDelete = FALSE );
+ // override SwIndexReg
+ virtual void Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
+ const bool bNegative = false, const bool bDelete = false );
// change text to Upper/Lower/Hiragana/Katagana/...
void TransliterateText( utl::TransliterationWrapper& rTrans,
@@ -865,11 +872,11 @@ inline const SwTxtNode *SwNode::GetTxtNode() const
}
#endif
-inline void SwTxtNode::Cut(SwTxtNode *pDest, const SwIndex &rDestStart,
- const SwIndex &rStart, xub_StrLen nLen)
+inline void
+SwTxtNode::CutText(SwTxtNode * const pDest, const SwIndex & rDestStart,
+ const SwIndex & rStart, const xub_StrLen nLen)
{
- _Cut( pDest, rDestStart, rStart, nLen, TRUE );
+ CutImpl( pDest, rDestStart, rStart, nLen, true );
}
-
#endif
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index fc62291e85c7..0a43d2c73d96 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -626,7 +626,6 @@
#include "svtools/ctloptions.hxx"
#include "svtools/ctrlbox.hxx"
#include "svtools/ctrltool.hxx"
-#include "svtools/docpasswdrequest.hxx"
#include "svtools/editbrowsebox.hxx"
#include "svtools/ehdl.hxx"
#include "svtools/eitem.hxx"
diff --git a/sw/inc/postit.hxx b/sw/inc/postit.hxx
index 4930ac67c9bf..5ddf9c1458fb 100644
--- a/sw/inc/postit.hxx
+++ b/sw/inc/postit.hxx
@@ -181,8 +181,6 @@ class PostItTxt : public Window
virtual void DataChanged( const DataChangedEvent& aData);
virtual void LoseFocus();
virtual void RequestHelp(const HelpEvent &rEvt);
-
- // reconversion /*i94374*/
virtual XubString GetSurroundingText() const;
virtual Selection GetSurroundingTextSelection() const;
@@ -229,6 +227,7 @@ class SwMarginWin : public Window
long mPageBorder;
SwPostItBits nFlags;
bool mbMouseOverButton;
+
protected:
bool mbReadonly;
PopupMenu* mpButtonPopup;
@@ -241,7 +240,8 @@ class SwMarginWin : public Window
virtual void Paint( const Rectangle& rRect);
virtual void GetFocus();
- void SetSizePixel( const Size& rNewSize );
+ void SetSizePixel( const Size& rNewSize );
+ SfxItemSet DefaultItem();
DECL_LINK(ModifyHdl, void*);
DECL_LINK(ScrollHdl, ScrollBar*);
@@ -289,8 +289,8 @@ class SwMarginWin : public Window
void ExecuteCommand(USHORT nSlot);
void InitControls();
- void HidePostIt();
- void DoResize();
+ void HidePostIt();
+ void DoResize();
void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
void SetScrollbar();
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index 1a6547ab540e..03a79281932c 100644
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -133,6 +133,7 @@ struct SwPrintData
void SetPrintEmptyPages(sal_Bool b ) { doSetModified(); bPrintEmptyPages = b;}
void SetPrintPostIts ( sal_Int16 n){ doSetModified(); nPrintPostIts = n; }
void SetPrintProspect ( sal_Bool b ) { doSetModified(); bPrintProspect = b; }
+ void SetPrintProspect_RTL ( sal_Bool b ) { doSetModified(); bPrintProspect_RTL = b; }
void SetPrintPageBackground(sal_Bool b){ doSetModified(); bPrintPageBackground = b;}
void SetPrintBlackFont(sal_Bool b){ doSetModified(); bPrintBlackFont = b;}
void SetPrintSingleJobs(sal_Bool b){ doSetModified(); bPrintSingleJobs = b;}
@@ -143,4 +144,3 @@ struct SwPrintData
};
#endif //_SW_PRINTDATA_HXX
-
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 871c9f477f9a..ebf6e8cd9325 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -42,6 +42,7 @@
#include <svtools/smplhint.hxx>
class SfxItemSet;
+class SwView;
class SwRedlineExtraData
{
@@ -297,16 +298,19 @@ class SW_DLLPUBLIC SwRedlineHint : public SfxHint
const SwRedline* pRedline;
sal_Int16 nWhich;
+ const SwView* pView;
public:
- SwRedlineHint( const SwRedline* p, sal_Int16 n )
+ SwRedlineHint( const SwRedline* p, sal_Int16 n, const SwView* pV = 0)
: pRedline(p)
, nWhich(n)
- {}
+ , pView(pV)
+ {}
TYPEINFO();
const SwRedline* GetRedline() const { return pRedline; }
sal_Int16 Which() const { return nWhich; }
+ const SwView* GetView() const { return pView; }
};
diff --git a/sw/inc/rolbck.hxx b/sw/inc/rolbck.hxx
index bd97b81f1b6b..f910a44ca859 100644
--- a/sw/inc/rolbck.hxx
+++ b/sw/inc/rolbck.hxx
@@ -40,6 +40,10 @@
//Nur die History anziehen, um das docnew.cxx gegen die CLOOK's zu behaupten.
+namespace sfx2 {
+ class MetadatableUndo;
+}
+
class SwDoc;
class SwFmt;
class SwFmtColl;
@@ -295,6 +299,7 @@ class SwHistoryBookmark : public SwHistoryHint
const bool m_bSaveOtherPos;
const bool m_bHadOtherPos;
const IDocumentMarkAccess::MarkType m_eBkmkType;
+ ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo;
};
class SwHistorySetAttrSet : public SwHistoryHint
@@ -446,13 +451,16 @@ public:
// --> OD 2008-02-27 #refactorlists# - removed <rDoc>
SwRegHistory( SwHistory* pHst );
// <--
- SwRegHistory( SwTxtNode* pTxtNode, const SfxItemSet& rSet,
- xub_StrLen nStart, xub_StrLen nEnd, USHORT nFlags,
- SwHistory* pHst );
SwRegHistory( const SwNode& rNd, SwHistory* pHst );
SwRegHistory( SwModify* pRegIn, const SwNode& rNd, SwHistory* pHst );
virtual void Modify( SfxPoolItem* pOld, SfxPoolItem* pNew );
+
+ /// @return true iff at least 1 item was inserted
+ bool InsertItems( const SfxItemSet& rSet,
+ xub_StrLen const nStart, xub_StrLen const nEnd,
+ SetAttrMode const nFlags );
+
void AddHint( SwTxtAttr* pHt, const bool bNew = false );
void RegisterInModify( SwModify* pRegIn, const SwNode& rNd );
diff --git a/sw/inc/swcalwrp.hxx b/sw/inc/swcalwrp.hxx
index 8f7a4e484397..b136752d4825 100644
--- a/sw/inc/swcalwrp.hxx
+++ b/sw/inc/swcalwrp.hxx
@@ -34,6 +34,7 @@
#include <i18npool/lang.h>
#include <tools/string.hxx>
#include <unotools/calendarwrapper.hxx>
+#include <salhelper/singletonref.hxx>
class SwCalendarWrapper : public CalendarWrapper
{
@@ -42,7 +43,7 @@ class SwCalendarWrapper : public CalendarWrapper
public:
SwCalendarWrapper( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory > & xMSF )
+ ::com::sun::star::lang::XMultiServiceFactory > & xMSF = ::comphelper::getProcessServiceFactory() )
: CalendarWrapper( xMSF ), nLang( LANGUAGE_SYSTEM )
{}
@@ -50,7 +51,7 @@ public:
};
-extern SwCalendarWrapper* pCalendarWrapper;
+salhelper::SingletonRef<SwCalendarWrapper>* s_getCalendarWrapper();
#endif
diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx
index 66a9dadb09eb..7d57e6e2dc52 100644
--- a/sw/inc/swevent.hxx
+++ b/sw/inc/swevent.hxx
@@ -50,6 +50,20 @@
#define SW_EVENT_FIELD_MERGE_FINISHED ( EVENT_APP_START + 11 )
#define SW_EVENT_LAYOUT_FINISHED ( EVENT_APP_START + 12 )
+#define STR_SW_EVENT_PAGE_COUNT 0
+#define STR_SW_EVENT_MAIL_MERGE 1
+#define STR_SW_EVENT_MAIL_MERGE_END 2
+#define STR_SW_EVENT_FIELD_MERGE 3
+#define STR_SW_EVENT_FIELD_MERGE_FINISHED 4
+#define STR_SW_EVENT_LAYOUT_FINISHED 5
+#define STR_SW_EVENT_OBJECT_SELECT 6
+#define STR_SW_EVENT_START_INS_GLOSSARY 7
+#define STR_SW_EVENT_END_INS_GLOSSARY 8
+#define STR_SW_EVENT_FRM_KEYINPUT_ALPHA 9
+#define STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10
+#define STR_SW_EVENT_FRM_RESIZE 11
+#define STR_SW_EVENT_FRM_MOVE 12
+
class SwFrmFmt;
class SwFmtINetFmt;
class IMapObject;
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 209db3974697..64cd8231f0ef 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -229,6 +229,8 @@ namespace nsSetAttrMode
const SetAttrMode SETATTR_DONTCHGNUMRULE = 0x0020; // nicht die NumRule veraendern
const SetAttrMode SETATTR_APICALL = 0x0040; // called from API (all UI related
// functionality will be disabled)
+ /// force hint expand (only matters for hints with CH_TXTATR)
+ const SetAttrMode SETATTR_FORCEHINTEXPAND= 0x0080;
}
//Umrechnung Twip<-> 1/100 mm fuer UNO
@@ -259,7 +261,6 @@ namespace nsSetAttrMode
// returns the APP - CharClass instance - used for all ToUpper/ToLower/...
SW_DLLPUBLIC CharClass& GetAppCharClass();
-SW_DLLPUBLIC LocaleDataWrapper& GetAppLocaleData();
SW_DLLPUBLIC LanguageType GetAppLanguage();
diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index 90602a7b941c..2a49460a05ca 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -39,76 +39,51 @@
class SfxItemPool;
-class SvxBrushItem;
-class SvxFontItem;
-class SvxPostureItem;
-class SvxWeightItem;
-class SvxUnderlineItem;
-class SvxOverlineItem;
-class SvxFontHeightItem;
-class SvxPropSizeItem;
-class SvxShadowedItem;
-class SvxAutoKernItem;
-class SvxWordLineModeItem;
-class SvxContourItem;
-class SvxCrossedOutItem;
-class SvxColorItem;
-class SvxCharSetColorItem;
class SvXMLAttrContainerItem;
class SwFmtRuby;
-class SvxTwoLinesItem;
-class SvxEmphasisMarkItem;
-class SvxCharScaleWidthItem;
-class SvxCharRotateItem;
-class SvxCharReliefItem;
-class SvxCharHiddenItem;
-
class SwFmtCharFmt;
class SwFmtAutoFmt;
class SwFmtINetFmt;
-class SvxKerningItem;
-class SvxCaseMapItem;
-class SvxLanguageItem;
-class SvxEscapementItem;
-class SvxBlinkItem;
-class SvxNoHyphenItem;
-class SwFmtSoftHyph;
-class SwFmtHardBlank;
class SwFmtFld;
class SwFmtFtn;
class SwFmtFlyCnt;
class SwTOXMark;
class SwFmtRefMark;
+class SwFmtMeta;
+
class SwTxtAttr : private boost::noncopyable
{
- const SfxPoolItem* m_pAttr;
+private:
+ SfxPoolItem * const m_pAttr;
xub_StrLen m_nStart;
bool m_bDontExpand : 1;
bool m_bLockExpandFlag : 1;
- bool m_bDontMergeAttr : 1; // refmarks, toxmarks, ruby
bool m_bDontMoveAttr : 1; // refmarks, toxmarks
bool m_bCharFmtAttr : 1; // charfmt, inet
bool m_bOverlapAllowedAttr : 1; // refmarks, toxmarks
bool m_bPriorityAttr : 1; // attribute has priority (redlining)
bool m_bDontExpandStart : 1; // don't expand start at paragraph start (ruby)
+ bool m_bNesting : 1; // SwTxtAttrNesting
+ bool m_bHasDummyChar : 1; // without end + meta
protected:
- SwTxtAttr( const SfxPoolItem& rAttr, xub_StrLen nStart );
+ SwTxtAttr( SfxPoolItem& rAttr, xub_StrLen nStart );
+ virtual ~SwTxtAttr();
void SetLockExpandFlag( bool bFlag ) { m_bLockExpandFlag = bFlag; }
- void SetDontMergeAttr( bool bFlag ) { m_bDontMergeAttr = bFlag; }
void SetDontMoveAttr( bool bFlag ) { m_bDontMoveAttr = bFlag; }
void SetCharFmtAttr( bool bFlag ) { m_bCharFmtAttr = bFlag; }
void SetOverlapAllowedAttr( bool bFlag ){ m_bOverlapAllowedAttr = bFlag; }
void SetDontExpandStartAttr(bool bFlag) { m_bDontExpandStart = bFlag; }
+ void SetNesting(const bool bFlag) { m_bNesting = bFlag; }
+ void SetHasDummyChar(const bool bFlag) { m_bHasDummyChar = bFlag; }
public:
- virtual ~SwTxtAttr();
- // RemoveFromPool muss immer vorm DTOR Aufruf erfolgen!!
- void RemoveFromPool( SfxItemPool& rPool );
+ /// destroy instance
+ static void Destroy( SwTxtAttr * pToDestroy, SfxItemPool& rPool );
/// start position
xub_StrLen* GetStart() { return & m_nStart; }
@@ -123,44 +98,23 @@ public:
inline void SetDontExpand( bool bDontExpand );
bool DontExpand() const { return m_bDontExpand; }
bool IsLockExpandFlag() const { return m_bLockExpandFlag; }
- bool IsDontMergeAttr() const { return m_bDontMergeAttr; }
bool IsDontMoveAttr() const { return m_bDontMoveAttr; }
bool IsCharFmtAttr() const { return m_bCharFmtAttr; }
bool IsOverlapAllowedAttr() const { return m_bOverlapAllowedAttr; }
bool IsPriorityAttr() const { return m_bPriorityAttr; }
void SetPriorityAttr( bool bFlag ) { m_bPriorityAttr = bFlag; }
bool IsDontExpandStartAttr() const { return m_bDontExpandStart; }
+ bool IsNesting() const { return m_bNesting; }
+ bool HasDummyChar() const { return m_bHasDummyChar; }
inline const SfxPoolItem& GetAttr() const;
+ inline SfxPoolItem& GetAttr();
inline USHORT Which() const { return GetAttr().Which(); }
virtual int operator==( const SwTxtAttr& ) const;
- inline const SvxFontItem &GetFont() const;
- inline const SvxPostureItem &GetPosture() const;
- inline const SvxWeightItem &GetWeight() const;
- inline const SvxUnderlineItem &GetUnderline() const;
- inline const SvxOverlineItem &GetOverline() const;
- inline const SvxFontHeightItem &GetFontSize() const;
- inline const SvxPropSizeItem &GetPropSize() const;
- inline const SvxShadowedItem &GetShadowed() const;
- inline const SvxAutoKernItem &GetAutoKern() const;
- inline const SvxWordLineModeItem &GetWordLineMode() const;
- inline const SvxContourItem &GetContour() const;
- inline const SvxCrossedOutItem &GetCrossedOut() const;
- inline const SvxColorItem &GetColor() const;
- inline const SvxCharSetColorItem &GetCharSetColor() const;
inline const SwFmtCharFmt &GetCharFmt() const;
inline const SwFmtAutoFmt &GetAutoFmt() const;
- inline const SvxKerningItem &GetKerning() const;
- inline const SvxCaseMapItem &GetCaseMap() const;
- inline const SvxLanguageItem &GetLanguage() const;
- inline const SvxEscapementItem &GetEscapement() const;
- inline const SvxBlinkItem &GetBlink() const;
- inline const SvxBrushItem &GetChrBackground() const;
- inline const SvxNoHyphenItem &GetNoHyphenHere() const;
- inline const SwFmtSoftHyph &GetSoftHyph() const;
- inline const SwFmtHardBlank &GetHardBlank() const;
inline const SwFmtFld &GetFld() const;
inline const SwFmtFtn &GetFtn() const;
inline const SwFmtFlyCnt &GetFlyCnt() const;
@@ -169,25 +123,19 @@ public:
inline const SwFmtINetFmt &GetINetFmt() const;
inline const SvXMLAttrContainerItem &GetXMLAttrContainer() const;
inline const SwFmtRuby &GetRuby() const;
- inline const SvxTwoLinesItem &Get2Lines() const;
- inline const SvxEmphasisMarkItem &GetEmphasisMark() const;
- inline const SvxCharScaleWidthItem &GetCharScaleW() const;
- inline const SvxCharRotateItem &GetCharRotate() const;
- inline const SvxCharReliefItem &GetCharRelief() const;
- inline const SvxCharHiddenItem &GetCharHidden() const;
+ inline const SwFmtMeta &GetMeta() const;
};
class SwTxtAttrEnd : public SwTxtAttr
{
- using SwTxtAttr::GetEnd;
-
protected:
xub_StrLen m_nEnd;
public:
- SwTxtAttrEnd( const SfxPoolItem& rAttr, USHORT nStart, USHORT nEnd );
+ SwTxtAttrEnd( SfxPoolItem& rAttr, USHORT nStart, USHORT nEnd );
+ using SwTxtAttr::GetEnd;
virtual xub_StrLen* GetEnd();
};
@@ -211,6 +159,12 @@ inline const SfxPoolItem& SwTxtAttr::GetAttr() const
return *m_pAttr;
}
+inline SfxPoolItem& SwTxtAttr::GetAttr()
+{
+ return const_cast<SfxPoolItem&>(
+ const_cast<const SwTxtAttr*>(this)->GetAttr());
+}
+
inline void SwTxtAttr::SetDontExpand( bool bDontExpand )
{
if ( !m_bLockExpandFlag )
@@ -219,102 +173,7 @@ inline void SwTxtAttr::SetDontExpand( bool bDontExpand )
}
}
-inline const SvxFontItem& SwTxtAttr::GetFont() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_FONT, "Wrong attribute" );
- return (const SvxFontItem&)(*m_pAttr);
-}
-
-inline const SvxPostureItem& SwTxtAttr::GetPosture() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_POSTURE,
- "Wrong attribute" );
- return (const SvxPostureItem&)(*m_pAttr);
-}
-
-inline const SvxWeightItem& SwTxtAttr::GetWeight() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_WEIGHT,
- "Wrong attribute" );
- return (const SvxWeightItem&)(*m_pAttr);
-}
-
-inline const SvxUnderlineItem& SwTxtAttr::GetUnderline() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_UNDERLINE,
- "Wrong attribute" );
- return (const SvxUnderlineItem&)(*m_pAttr);
-}
-
-inline const SvxOverlineItem& SwTxtAttr::GetOverline() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_OVERLINE,
- "Wrong attribute" );
- return (const SvxOverlineItem&)(*m_pAttr);
-}
-
-inline const SvxFontHeightItem& SwTxtAttr::GetFontSize() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_FONTSIZE,
- "Wrong attribute" );
- return (const SvxFontHeightItem&)(*m_pAttr);
-}
-
-inline const SvxPropSizeItem& SwTxtAttr::GetPropSize() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_PROPORTIONALFONTSIZE,
- "Wrong attribute" );
- return (const SvxPropSizeItem&)(*m_pAttr);
-}
-
-inline const SvxShadowedItem& SwTxtAttr::GetShadowed() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_SHADOWED,
- "Wrong attribute" );
- return (const SvxShadowedItem&)(*m_pAttr);
-}
-
-inline const SvxAutoKernItem& SwTxtAttr::GetAutoKern() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_AUTOKERN,
- "Wrong attribute" );
- return (const SvxAutoKernItem&)(*m_pAttr);
-}
-
-inline const SvxWordLineModeItem& SwTxtAttr::GetWordLineMode() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_WORDLINEMODE,
- "Wrong attribute" );
- return (const SvxWordLineModeItem&)(*m_pAttr);
-}
-
-inline const SvxContourItem& SwTxtAttr::GetContour() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_CONTOUR,
- "Wrong attribute" );
- return (const SvxContourItem&)(*m_pAttr);
-}
-
-inline const SvxCrossedOutItem& SwTxtAttr::GetCrossedOut() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_CROSSEDOUT,
- "Wrong attribute" );
- return (const SvxCrossedOutItem&)(*m_pAttr);
-}
-
-inline const SvxColorItem& SwTxtAttr::GetColor() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_COLOR,
- "Wrong attribute" );
- return (const SvxColorItem&)(*m_pAttr);
-}
-
-inline const SvxCharSetColorItem& SwTxtAttr::GetCharSetColor() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_CHARSETCOLOR,
- "Wrong attribute" );
- return (const SvxCharSetColorItem&)(*m_pAttr);
-}
+//------------------------------------------------------------------------
inline const SwFmtCharFmt& SwTxtAttr::GetCharFmt() const
{
@@ -330,69 +189,6 @@ inline const SwFmtAutoFmt& SwTxtAttr::GetAutoFmt() const
return (const SwFmtAutoFmt&)(*m_pAttr);
}
-inline const SvxKerningItem& SwTxtAttr::GetKerning() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_KERNING,
- "Wrong attribute" );
- return (const SvxKerningItem&)(*m_pAttr);
-}
-
-inline const SvxCaseMapItem& SwTxtAttr::GetCaseMap() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_CASEMAP,
- "Wrong attribute" );
- return (const SvxCaseMapItem&)(*m_pAttr);
-}
-
-inline const SvxLanguageItem& SwTxtAttr::GetLanguage() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_LANGUAGE,
- "Wrong attribute" );
- return (const SvxLanguageItem&)(*m_pAttr);
-}
-
-inline const SvxEscapementItem& SwTxtAttr::GetEscapement() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_ESCAPEMENT,
- "Wrong attribute" );
- return (const SvxEscapementItem&)(*m_pAttr);
-}
-
-inline const SvxBlinkItem& SwTxtAttr::GetBlink() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_BLINK,
- "Wrong attribute" );
- return (const SvxBlinkItem&)(*m_pAttr);
-}
-
-inline const SvxBrushItem& SwTxtAttr::GetChrBackground() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_BACKGROUND,
- "Wrong attribute" );
- return (const SvxBrushItem&)(*m_pAttr);
-}
-
-inline const SvxNoHyphenItem& SwTxtAttr::GetNoHyphenHere() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_NOHYPHEN,
- "Wrong attribute" );
- return (const SvxNoHyphenItem&)(*m_pAttr);
-}
-
-inline const SwFmtSoftHyph& SwTxtAttr::GetSoftHyph() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_SOFTHYPH,
- "Wrong attribute" );
- return (const SwFmtSoftHyph&)(*m_pAttr);
-}
-
-inline const SwFmtHardBlank& SwTxtAttr::GetHardBlank() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_HARDBLANK,
- "Wrong attribute" );
- return (const SwFmtHardBlank&)(*m_pAttr);
-}
-
inline const SwFmtFld& SwTxtAttr::GetFld() const
{
ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_FIELD,
@@ -447,46 +243,13 @@ inline const SwFmtRuby& SwTxtAttr::GetRuby() const
"Wrong attribute" );
return (const SwFmtRuby&)(*m_pAttr);
}
-inline const SvxTwoLinesItem& SwTxtAttr::Get2Lines() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_TWO_LINES,
- "Wrong attribute" );
- return (const SvxTwoLinesItem&)(*m_pAttr);
-}
-
-inline const SvxEmphasisMarkItem& SwTxtAttr::GetEmphasisMark() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_EMPHASIS_MARK,
- "Wrong attribute" );
- return (const SvxEmphasisMarkItem&)(*m_pAttr);
-}
-
-inline const SvxCharScaleWidthItem& SwTxtAttr::GetCharScaleW() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_SCALEW,
- "Wrong attribute" );
- return (const SvxCharScaleWidthItem&)(*m_pAttr);
-}
-
-inline const SvxCharRotateItem& SwTxtAttr::GetCharRotate() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_ROTATE,
- "Wrong attribute" );
- return (const SvxCharRotateItem&)(*m_pAttr);
-}
-
-inline const SvxCharReliefItem& SwTxtAttr::GetCharRelief() const
-{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_RELIEF,
- "Wrong attribute" );
- return (const SvxCharReliefItem&)(*m_pAttr);
-}
-inline const SvxCharHiddenItem& SwTxtAttr::GetCharHidden() const
+inline const SwFmtMeta& SwTxtAttr::GetMeta() const
{
- ASSERT( m_pAttr && m_pAttr->Which() == RES_CHRATR_HIDDEN,
+ ASSERT( m_pAttr && (m_pAttr->Which() == RES_TXTATR_META ||
+ m_pAttr->Which() == RES_TXTATR_METAFIELD),
"Wrong attribute" );
- return (const SvxCharHiddenItem&)(*m_pAttr);
+ return (const SwFmtMeta&)(*m_pAttr);
}
#endif
diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx
index 3b03173e17ed..92b51fede495 100644
--- a/sw/inc/txtatr.hxx
+++ b/sw/inc/txtatr.hxx
@@ -29,14 +29,13 @@
************************************************************************/
#ifndef _TXTATR_HXX
#define _TXTATR_HXX
-#include <tools/gen.hxx>
-#include <tools/color.hxx>
+
#include <txatbase.hxx> // SwTxtAttr/SwTxtAttrEnd
#include <calbck.hxx>
+
class SwTxtNode; // fuer SwTxtFld
class SwCharFmt;
-class SvxTwoLinesItem;
// ATT_CHARFMT *********************************************
@@ -60,29 +59,45 @@ public:
USHORT GetSortNumber() const { return m_nSortNumber; }
};
-// ATT_HARDBLANK ******************************
-class SwTxtHardBlank : public SwTxtAttr
-{
- sal_Unicode m_Char;
+// ATT_XMLCONTAINERITEM ******************************
+class SwTxtXMLAttrContainer : public SwTxtAttrEnd
+{
public:
- SwTxtHardBlank( const SwFmtHardBlank& rAttr, xub_StrLen nStart );
- inline sal_Unicode GetChar() const { return m_Char; }
+ SwTxtXMLAttrContainer( SvXMLAttrContainerItem& rAttr,
+ xub_StrLen nStart, xub_StrLen nEnd );
};
-// ATT_XNLCONTAINERITEM ******************************
+// ******************************
-class SwTxtXMLAttrContainer : public SwTxtAttrEnd
+class SwTxtAttrNesting : public SwTxtAttrEnd
{
public:
- SwTxtXMLAttrContainer( const SvXMLAttrContainerItem& rAttr,
- xub_StrLen nStart, xub_StrLen nEnd );
+ SwTxtAttrNesting( SfxPoolItem & i_rAttr,
+ const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
+ virtual ~SwTxtAttrNesting();
+};
+
+class SwTxtMeta : public SwTxtAttrNesting
+{
+private:
+ SwTxtNode * m_pTxtNode;
+
+public:
+ SwTxtMeta( SwFmtMeta & i_rAttr,
+ const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
+ virtual ~SwTxtMeta();
+
+ void ChgTxtNode( SwTxtNode * const pNode ) { m_pTxtNode = pNode; }
+ SwTxtNode * GetTxtNode() const { return m_pTxtNode; }
+
};
+
// ******************************
-class SW_DLLPUBLIC SwTxtRuby : public SwTxtAttrEnd, public SwClient
+class SW_DLLPUBLIC SwTxtRuby : public SwTxtAttrNesting, public SwClient
{
SwTxtNode* m_pTxtNode;
@@ -101,16 +116,7 @@ public:
SwCharFmt* GetCharFmt();
const SwCharFmt* GetCharFmt() const
- { return ((SwTxtRuby*)this)->GetCharFmt(); }
-};
-
-// ******************************
-
-class SwTxt2Lines : public SwTxtAttrEnd
-{
-public:
- SwTxt2Lines( const SvxTwoLinesItem& rAttr,
- xub_StrLen nStart, xub_StrLen nEnd );
+ { return (const_cast<SwTxtRuby*>(this))->GetCharFmt(); }
};
// --------------- Inline Implementierungen ------------------------
diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx
index 6ed95e05ba06..9eaa1926238e 100644
--- a/sw/inc/txtftn.hxx
+++ b/sw/inc/txtftn.hxx
@@ -52,7 +52,7 @@ public:
inline SwNodeIndex *GetStartNode() const { return m_pStartNode; }
void SetStartNode( const SwNodeIndex *pNode, BOOL bDelNodes = TRUE );
void SetNumber( const USHORT nNumber, const String* = 0 );
- void CopyFtn( SwTxtFtn *pDest );
+ void CopyFtn( SwTxtFtn *pDest ) const;
// get and set TxtNode pointer
inline const SwTxtNode& GetTxtNode() const;
diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx
index e37a18a3f823..5aa683277e14 100644
--- a/sw/inc/txtinet.hxx
+++ b/sw/inc/txtinet.hxx
@@ -31,6 +31,7 @@
#define _TXTINET_HXX
#include <txatbase.hxx>
+#include <txtatr.hxx>
#include <calbck.hxx>
class SwTxtNode;
@@ -38,7 +39,7 @@ class SwCharFmt;
// ATT_INETFMT *********************************************
-class SW_DLLPUBLIC SwTxtINetFmt : public SwTxtAttrEnd, public SwClient
+class SW_DLLPUBLIC SwTxtINetFmt : public SwTxtAttrNesting, public SwClient
{
SwTxtNode * m_pTxtNode;
bool m_bVisited : 1; // visited link?
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 2c7282778053..aaafa3fca76a 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -49,6 +49,7 @@
#include <swundo.hxx>
#include <IMark.hxx>
+#include <IDocumentContentOperations.hxx>
// --> OD 2006-11-01 #130889#
#include <vector>
// <--
@@ -362,6 +363,8 @@ class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt
BOOL bIsWordDelim : 1;
BOOL bIsAppend : 1;
+ const IDocumentContentOperations::InsertFlags m_nInsertFlags;
+
friend class SwDoc; // eigentlich nur SwDoc::Insert( String )
BOOL CanGrouping( sal_Unicode cIns );
BOOL CanGrouping( const SwPosition& rPos );
@@ -373,6 +376,7 @@ class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt
public:
SwUndoInsert( const SwNodeIndex& rNode, xub_StrLen nCntnt, xub_StrLen nLen,
+ const IDocumentContentOperations::InsertFlags nInsertFlags,
BOOL bWDelim = TRUE );
SwUndoInsert( const SwNodeIndex& rNode );
virtual ~SwUndoInsert();
@@ -572,13 +576,13 @@ class SwUndoAttr : public SwUndo, private SwUndRng
::std::auto_ptr<SwRedlineData> m_pRedlineData; // Redlining
::std::auto_ptr<SwRedlineSaveDatas> m_pRedlineSaveData;
ULONG m_nNodeIndex; // Offset: for Redlining
- const USHORT m_nInsertFlags; // insert flags
+ const SetAttrMode m_nInsertFlags; // insert flags
void RemoveIdx( SwDoc& rDoc );
public:
- SwUndoAttr( const SwPaM&, const SfxItemSet&, USHORT nFlags = 0 );
- SwUndoAttr( const SwPaM&, const SfxPoolItem&, USHORT nFlags = 0 );
+ SwUndoAttr( const SwPaM&, const SfxItemSet &, const SetAttrMode nFlags );
+ SwUndoAttr( const SwPaM&, const SfxPoolItem&, const SetAttrMode nFlags );
virtual ~SwUndoAttr();
virtual void Undo( SwUndoIter& );
virtual void Redo( SwUndoIter& );
diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx
index f728c51293e9..1a7401fd4a33 100644
--- a/sw/inc/unocoll.hxx
+++ b/sw/inc/unocoll.hxx
@@ -163,11 +163,11 @@ class SwUnoCollection
#define SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY 73
#define SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS 74
#define SW_SERVICE_FIELDTYPE_DROPDOWN 75
-#define SW_SERVICE_FIELDTYPE_DUMMY_4 76
-#define SW_SERVICE_FIELDTYPE_DUMMY_5 77
-#define SW_SERVICE_FIELDTYPE_DUMMY_6 78
-#define SW_SERVICE_FIELDTYPE_DUMMY_7 79
-#define SW_SERVICE_FIELDTYPE_DUMMY_8 80
+#define SW_SERVICE_FIELDTYPE_METAFIELD 76
+#define SW_SERVICE_FIELDTYPE_DUMMY_4 77
+#define SW_SERVICE_FIELDTYPE_DUMMY_5 78
+#define SW_SERVICE_FIELDTYPE_DUMMY_6 79
+#define SW_SERVICE_FIELDTYPE_DUMMY_7 80
#define SW_SERVICE_FIELDMASTER_USER 81
#define SW_SERVICE_FIELDMASTER_DDE 82
#define SW_SERVICE_FIELDMASTER_SET_EXP 83
@@ -196,8 +196,9 @@ class SwUnoCollection
#define SW_SERVICE_CHART2_DATA_PROVIDER 106
#define SW_SERVICE_TYPE_FIELDMARK 107
#define SW_SERVICE_TYPE_FORMFIELDMARK 108
+#define SW_SERVICE_TYPE_META 109
-#define SW_SERVICE_LAST SW_SERVICE_TYPE_FORMFIELDMARK
+#define SW_SERVICE_LAST SW_SERVICE_TYPE_META
#define SW_SERVICE_INVALID USHRT_MAX
diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx
index 7133f6edba46..613a5e51eb89 100644
--- a/sw/inc/unocrsrhelper.hxx
+++ b/sw/inc/unocrsrhelper.hxx
@@ -96,7 +96,8 @@ namespace SwUnoCursorHelper
com::sun::star::beans::PropertyState& eState);
sal_Bool DocInsertStringSplitCR( SwDoc &rDoc,
- const SwPaM &rNewCursor, const String &rText );
+ const SwPaM &rNewCursor, const String &rText,
+ const bool bForceExpandHints );
void makeRedline( SwPaM& rPaM, const ::rtl::OUString& RedlineType,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& RedlineProperties )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
diff --git a/sw/inc/unofield.hxx b/sw/inc/unofield.hxx
index 92e8f469d62d..bef657b5b797 100644
--- a/sw/inc/unofield.hxx
+++ b/sw/inc/unofield.hxx
@@ -43,7 +43,6 @@ class SwDoc;
class SwFmtFld;
class SwField;
class SwSetExpField;
-class String;
class SwTextAPIObject;
/* -----------------04.12.98 12:49-------------------
@@ -208,6 +207,11 @@ public:
void Invalidate();
};
+
+/// @return a SwXTextField, either an already existing one or a new one
+SwXTextField * CreateSwXTextField(SwDoc & rDoc, SwFmtFld const& rFmt);
+
+
/* -----------------21.12.98 10:26-------------------
*
* --------------------------------------------------*/
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 9de2db4f493c..e569383a335e 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -131,8 +131,9 @@
#define PROPERTY_MAP_RUBY_AUTO_STYLE 95
#define PROPERTY_MAP_PARA_AUTO_STYLE 96
#define PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM 97
+#define PROPERTY_MAP_METAFIELD 98
-#define PROPERTY_MAP_END 98
+#define PROPERTY_MAP_END 99
//S&E
#define WID_WORDS 0
diff --git a/sw/inc/unoobj.hxx b/sw/inc/unoobj.hxx
index dc0bd7dfafc3..b7a6c54d2bd2 100644
--- a/sw/inc/unoobj.hxx
+++ b/sw/inc/unoobj.hxx
@@ -30,8 +30,10 @@
************************************************************************/
#ifndef _UNOOBJ_HXX
#define _UNOOBJ_HXX
+
#include <unoevtlstnr.hxx>
#include <unobaseclass.hxx>
+#include <unocrsr.hxx>
#include <svtools/itemprop.hxx>
#include <svtools/svarray.hxx>
#include <frmfmt.hxx>
@@ -92,13 +94,29 @@
#include <IDocumentMarkAccess.hxx>
#include <sfx2/Metadatable.hxx>
+#include <deque>
+#include <boost/shared_ptr.hpp>
+
-class SwUnoCrsr;
-class SwCursor;
class SwFmtFtn;
class SwFmtRefMark;
class GetCurTxtFmtColl;
+
+struct FrameDependSortListEntry {
+ xub_StrLen nIndex;
+ sal_uInt32 nOrder;
+ ::boost::shared_ptr<SwDepend> pFrameDepend;
+ FrameDependSortListEntry (xub_StrLen const i_nIndex,
+ sal_uInt32 const i_nOrder, SwDepend * const i_pDepend)
+ : nIndex(i_nIndex), nOrder(i_nOrder), pFrameDepend(i_pDepend) { }
+};
+typedef ::std::deque< FrameDependSortListEntry >
+ FrameDependSortList_t;
+
+typedef ::std::deque< ::boost::shared_ptr<SwDepend> >
+ FrameDependList_t;
+
/* -----------------29.04.98 07:35-------------------
*
* --------------------------------------------------*/
@@ -114,36 +132,21 @@ enum CursorType
CURSOR_REDLINE,
CURSOR_ALL, // fuer Search&Replace
CURSOR_SELECTION, // create a paragraph enumeration from a text range or cursor
- CURSOR_SELECTION_IN_TABLE
+ CURSOR_SELECTION_IN_TABLE,
+ CURSOR_META, // meta/meta-field
};
-/* -----------------29.04.98 07:35-------------------
- *
- * --------------------------------------------------*/
-#define PUNOPAM (_pStartCrsr)
-
-#define FOREACHUNOPAM_START(pCrsr) \
- {\
- SwPaM *_pStartCrsr = pCrsr, *__pStartCrsr = _pStartCrsr; \
- do {
-
-#define FOREACHUNOPAM_END() \
- } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); \
- }
-
/* -----------------26.06.98 16:18-------------------
*
* --------------------------------------------------*/
-SV_DECL_PTRARR(SwDependArr, SwDepend*, 2, 2)
-
SwPageDesc* GetPageDescByName_Impl(SwDoc& rDoc, const String& rName);
::com::sun::star::uno::Sequence< sal_Int8 > CreateUnoTunnelId();
// OD 2004-05-07 #i28701# - adjust 4th parameter
void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
- SwDependArr& rFrameArr,
+ FrameDependSortList_t & rFrames,
const bool _bAtCharAnchoredObjs );
/* -----------------29.04.98 07:35-------------------
@@ -212,8 +215,13 @@ class SwXText : public ::com::sun::star::lang::XTypeProvider,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > & CharacterAndParagraphProperties )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-protected:
+ virtual void PrepareForAttach( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xRange,
+ const SwXTextRange* const pRange, const SwPaM * const pPam);
+
+public: /*not protected because C++ is retarded*/
virtual const SwStartNode *GetStartNode() const;
+
public:
SwXText(SwDoc* pDc, CursorType eType);
virtual ~SwXText();
@@ -293,6 +301,10 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createCursor()throw(::com::sun::star::uno::RuntimeException);
INT16 ComparePositions(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange>& xPos1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange>& xPos2) throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
BOOL CheckForOwnMember(const SwXTextRange* pRange1, const OTextCursorHelper* pCursor1)throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual bool CheckForOwnMemberMeta(const SwXTextRange* const pRange,
+ const SwPaM* const pPam, bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
//
void Invalidate() {bObjectValid = sal_False;}
BOOL IsValid()const {return bObjectValid;}
@@ -345,8 +357,6 @@ class SwXTextCursor : public SwXTextCursor_Base,
bool mbRemoveUserEvent;
// <--
- void DeleteAndInsert(const String& rText);
-
DECL_STATIC_LINK( SwXTextCursor, RemoveCursor_Impl,
::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface>* );
@@ -354,6 +364,7 @@ class SwXTextCursor : public SwXTextCursor_Base,
protected:
virtual ~SwXTextCursor();
public:
+ void DeleteAndInsert(const String& rText, const bool bForceExpandHints);
SwXTextCursor(::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent, const SwPosition& rPos,
CursorType eSet, SwDoc* pDoc, const SwPosition* pMark = 0);
SwXTextCursor(::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent, SwUnoCrsr* pSourceCrsr, CursorType eSet = CURSOR_ALL);
@@ -506,6 +517,8 @@ public:
// --> FME 2006-03-07 #126177#
void DoNotRemoveUserEvent() { mbRemoveUserEvent = false; }
// <--
+
+ bool IsAtEndOfMeta() const;
};
/*-----------------20.03.98 07:47-------------------
@@ -557,18 +570,19 @@ public:
};
*/
-typedef cppu::WeakImplHelper5
+typedef ::cppu::ImplInheritanceHelper5
<
+ ::sfx2::MetadatableMixin,
::com::sun::star::text::XTextContent,
::com::sun::star::beans::XPropertySet,
::com::sun::star::lang::XServiceInfo,
::com::sun::star::container::XNamed,
::com::sun::star::lang::XUnoTunnel
>
-SwRefMarkBaseClass;
+SwBookmarkBaseClass;
class SwXBookmark
- : public SwRefMarkBaseClass
+ : public SwBookmarkBaseClass
, private SwClient
{
private:
@@ -634,8 +648,15 @@ class SwXBookmark
//SwClient
virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew );
+ // MetadatableMixin
+ virtual ::sfx2::Metadatable* GetCoreObject();
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > GetModel();
+
const ::sw::mark::IMark* GetBookmark() const
{ return m_pRegisteredBookmark; }
+ ::sw::mark::IMark* GetBookmark()
+ { return m_pRegisteredBookmark; }
SwDoc* GetDoc()
{ return m_pDoc; }
};
@@ -740,7 +761,8 @@ class SW_DLLPUBLIC SwXTextRange : public cppu::WeakImplHelper8
void _CreateNewBookmark(SwPaM& rPam);
//TODO: new exception type for protected content
- void DeleteAndInsert(const String& rText) throw( ::com::sun::star::uno::RuntimeException );
+ void DeleteAndInsert(const String& rText, const bool bForceExpandHints)
+ throw( ::com::sun::star::uno::RuntimeException );
protected:
virtual ~SwXTextRange();
@@ -1277,79 +1299,39 @@ class SwXParaFrameEnumeration : public cppu::WeakImplHelper2
>,
public SwClient
{
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xNextObject; //hasMoreElements legt das Objekt schon an
- SwDependArr aFrameArr; //wird im Ctor gefuellt
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xNextObject; // created by hasMoreElements
+ FrameDependList_t m_Frames;
- SwUnoCrsr* GetCrsr(){return (SwUnoCrsr*)GetRegisteredIn();}
- BOOL CreateNextObject();
- void FillFrame(SwUnoCrsr& rUnoCrsr);
+ SwUnoCrsr* GetCursor() const
+ {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
public:
SwXParaFrameEnumeration(const SwPaM& rPaM,
sal_uInt8 nParaFrameMode, SwFrmFmt* pFmt = 0);
~SwXParaFrameEnumeration();
- //XEnumeration
- virtual BOOL SAL_CALL hasMoreElements(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Any SAL_CALL nextElement(void) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
-
- //XServiceInfo
- virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual 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(void) throw( ::com::sun::star::uno::RuntimeException );
+ // XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
+ throw( ::com::sun::star::container::NoSuchElementException,
+ ::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 );
//SwClient
virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
};
-/* -----------------29.05.98 14:42-------------------
- *
- * --------------------------------------------------*/
-
-class SwXTextPortionEnumeration : public cppu::WeakImplHelper3
-<
- ::com::sun::star::container::XEnumeration,
- ::com::sun::star::lang::XServiceInfo,
- ::com::sun::star::lang::XUnoTunnel
->,
- public SwClient
-{
- XTextRangeArr aPortionArr; //all portions are created in the ctor
- SwDependArr aFrameArr; //wird im Ctor gefuellt - mit am Zeichen gebundenen Rahmen
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent;
- BOOL bAtEnd;
- BOOL bFirstPortion;
-
- const sal_Int32 nStartPos;
- const sal_Int32 nEndPos;
-
- SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)GetRegisteredIn(); }
- SwXTextPortionEnumeration();
- void CreatePortions();
-protected:
- virtual ~SwXTextPortionEnumeration();
-public:
- SwXTextPortionEnumeration(SwPaM& rParaCrsr,
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent,
- sal_Int32 nStart, sal_Int32 nEnd );
-
-
- static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
- //XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
-
- //XEnumeration
- virtual BOOL SAL_CALL hasMoreElements(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Any SAL_CALL nextElement(void) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
- //XServiceInfo
- virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual 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(void) throw( ::com::sun::star::uno::RuntimeException );
-
- //SwClient
- virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
-};
/* -----------------29.09.98 09:01-------------------
*
@@ -1437,6 +1419,16 @@ public:
/* -----------------27.08.98 15:11-------------------
*
* --------------------------------------------------*/
+typedef ::cppu::WeakImplHelper5
+<
+ ::com::sun::star::text::XTextContent,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XUnoTunnel
+>
+SwRefMarkBaseClass;
+
class SwXReferenceMark : public SwRefMarkBaseClass,
public SwClient
{
@@ -1447,7 +1439,7 @@ class SwXReferenceMark : public SwRefMarkBaseClass,
BOOL m_bIsDescriptor;
BOOL IsValid() const {return 0 != GetRegisteredIn();}
- void InsertRefMark( SwPaM& rPam );
+ void InsertRefMark( SwPaM& rPam, SwXTextCursor * pCursor );
public:
SwXReferenceMark(SwDoc* pDoc, const SwFmtRefMark* pMark);
~SwXReferenceMark();
diff --git a/sw/inc/unoport.hxx b/sw/inc/unoport.hxx
index 889442d47a21..ef20027994cf 100644
--- a/sw/inc/unoport.hxx
+++ b/sw/inc/unoport.hxx
@@ -29,27 +29,41 @@
************************************************************************/
#ifndef _UNOPORT_HXX
#define _UNOPORT_HXX
+
+#include <unocrsr.hxx>
#include <unoevtlstnr.hxx>
#include <calbck.hxx>
-#include <cppuhelper/implbase6.hxx>
+
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <cppuhelper/implbase8.hxx>
-#include <cppuhelper/implbase9.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <svtools/itemprop.hxx>
+#include <memory>
+#include <deque>
+
+
class SwFmtFld;
class SwFrmFmt;
-class SwUnoCrsr;
class SwTxtRuby;
+
+
+typedef ::std::deque<
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > >
+ TextRangeList_t;
+
+
/* -----------------29.05.98 14:42-------------------
*
* --------------------------------------------------*/
@@ -59,7 +73,7 @@ enum SwTextPortionType
PORTION_FIELD,
PORTION_FRAME,
PORTION_FOOTNOTE,
- PORTION_CONTROL_CHAR,
+// obsolete! PORTION_CONTROL_CHAR,
PORTION_REFMARK_START,
PORTION_REFMARK_END,
PORTION_TOXMARK_START,
@@ -71,20 +85,19 @@ enum SwTextPortionType
PORTION_RUBY_START,
PORTION_RUBY_END,
PORTION_SOFT_PAGEBREAK,
+ PORTION_META,
PORTION_FIELD_START,
PORTION_FIELD_END,
PORTION_FIELD_START_END
};
-class SwXRubyPortion;
-class SwXTextPortion : public cppu::WeakImplHelper9
+class SwXTextPortion : public cppu::WeakImplHelper8
<
::com::sun::star::beans::XTolerantMultiPropertySet,
::com::sun::star::beans::XMultiPropertySet,
::com::sun::star::beans::XPropertySet,
::com::sun::star::text::XTextRange,
- ::com::sun::star::text::XTextField,
::com::sun::star::beans::XPropertyState,
::com::sun::star::container::XContentEnumerationAccess,
::com::sun::star::lang::XUnoTunnel,
@@ -92,29 +105,39 @@ class SwXTextPortion : public cppu::WeakImplHelper9
>,
public SwClient
{
- friend class SwXRubyPortion;
- SwEventListenerContainer aLstnrCntnr;
- const SfxItemPropertySet* m_pPropSet;
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xRefMark;
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xTOXMark;
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xBookmark;
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xFootnote;
- ::com::sun::star::uno::Any* pRubyText;
- ::com::sun::star::uno::Any* pRubyStyle;
- ::com::sun::star::uno::Any* pRubyAdjust;
- ::com::sun::star::uno::Any* pRubyIsAbove;
-
- const SwFmtFld* pFmtFld;
- SwDepend aFrameDepend;
- SwFrmFmt* pFrameFmt;
- SwTextPortionType ePortionType;
- sal_Int16 nControlChar;
-
- BOOL bIsCollapsed;
-
- SwFmtFld* GetFldFmt(BOOL bInit = sal_False);
+private:
+
+ SwEventListenerContainer m_ListenerContainer;
+ const SfxItemPropertySet * m_pPropSet;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ m_xParentText;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xRefMark;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xTOXMark;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xBookmark;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote >
+ m_xFootnote;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField >
+ m_xTextField;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xMeta;
+ ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyText;
+ ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyStyle;
+ ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyAdjust;
+ ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyIsAbove;
+
+ const SwDepend m_FrameDepend;
+ SwFrmFmt * m_pFrameFmt;
+ const SwTextPortionType m_ePortionType;
+
+ bool m_bIsCollapsed;
+
+ SwFmtFld * GetFldFmt(bool bInit = false);
+
protected:
+
//SfxItemPropertySet& GetPropSet() { return aPropSet; }
void SAL_CALL SetPropertyValues_Impl(
@@ -140,16 +163,23 @@ protected:
sal_Bool bDirectValuesOnly ) throw (::com::sun::star::uno::RuntimeException);
virtual ~SwXTextPortion();
+
public:
SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent, SwTextPortionType eType );
SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent, SwFrmFmt& rFmt );
+ // for Ruby
+ SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
+ SwTxtRuby const& rAttr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ const& xParent,
+ sal_Bool bIsEnd );
//XTextRange
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual rtl::OUString SAL_CALL getString(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL getString() throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
//XTolerantMultiPropertySet
@@ -180,15 +210,12 @@ public:
virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- //XTextField
- virtual rtl::OUString SAL_CALL getPresentation(BOOL bShowCommand) throw( ::com::sun::star::uno::RuntimeException );
-
//XTextContent
virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
//XComponent
- virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
@@ -197,48 +224,105 @@ public:
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
//XServiceInfo
- virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual 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(void) throw( ::com::sun::star::uno::RuntimeException );
+ 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 );
//XContentEnumerationAccess
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createContentEnumeration(const rtl::OUString& aServiceName) throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getAvailableServiceNames() throw( ::com::sun::star::uno::RuntimeException );
//SwClient
virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
- void SetRefMark( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xMark)
- {xRefMark = xMark;}
+ void SetRefMark( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > xMark)
+ { m_xRefMark = xMark; }
- void SetTOXMark( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xMark)
- {xTOXMark = xMark;}
+ void SetTOXMark( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > xMark)
+ { m_xTOXMark = xMark; }
- void SetBookmark( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xMark)
- {xBookmark = xMark;}
+ void SetBookmark( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > xMark)
+ { m_xBookmark = xMark; }
- void SetFootnote( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xMark)
- {xFootnote = xMark;}
+ void SetFootnote( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XFootnote > xNote)
+ { m_xFootnote = xNote; }
- void SetControlChar(sal_Int16 nSet) {nControlChar = nSet;}
+ void SetTextField( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextField> xField)
+ { m_xTextField = xField; }
- BOOL IsCollapsed() const { return bIsCollapsed;}
- void SetCollapsed(BOOL bSet) { bIsCollapsed = bSet;}
+ void SetMeta( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > xMeta)
+ { m_xMeta = xMeta; }
- SwTextPortionType GetTextPortionType() const {return ePortionType;}
+ bool IsCollapsed() const { return m_bIsCollapsed; }
+ void SetCollapsed(bool bSet) { m_bIsCollapsed = bSet;}
- SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)GetRegisteredIn(); }
+ SwTextPortionType GetTextPortionType() const { return m_ePortionType; }
+
+ SwUnoCrsr* GetCursor() const
+ {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
};
-/* -----------------------------19.02.01 10:46--------------------------------
- ---------------------------------------------------------------------------*/
-class SwXRubyPortion : public SwXTextPortion
+/* -----------------29.05.98 14:42-------------------
+ *
+ * --------------------------------------------------*/
+class SwXTextPortionEnumeration
+ : public ::cppu::WeakImplHelper3
+ < ::com::sun::star::container::XEnumeration
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XUnoTunnel
+ >
+ , public SwClient
{
+ TextRangeList_t m_Portions; // contains all portions, filled by ctor
+
+ SwUnoCrsr* GetCursor() const
+ {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
+
+protected:
+ virtual ~SwXTextPortionEnumeration();
+
public:
- SwXRubyPortion(const SwUnoCrsr* pPortionCrsr,
- SwTxtRuby& rAttr,
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent,
- sal_Bool bEnd );
- ~SwXRubyPortion();
+ SwXTextPortionEnumeration(SwPaM& rParaCrsr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ const & xParent,
+ const sal_Int32 nStart, const sal_Int32 nEnd );
+
+ SwXTextPortionEnumeration(SwPaM& rParaCrsr,
+ TextRangeList_t const & rPortions );
+
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ //XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
+ throw( ::com::sun::star::container::NoSuchElementException,
+ ::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 );
+
+ //SwClient
+ virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
};
+
#endif
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index c9f4d1d01265..56360281915d 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -807,7 +807,8 @@ enum SwPropNameIds
// --> OD 2009-07-13 #i73249#
/* 0737 */ UNO_NAME_DESCRIPTION,
// <--
-/* 0738 */ SW_PROPNAME_END
+/* 0738 */ UNO_NAME_META, // #i91565#
+/* 0739 */ SW_PROPNAME_END
};
diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java
new file mode 100755
index 000000000000..aec77b891a0b
--- /dev/null
+++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java
@@ -0,0 +1,3858 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import complexlib.ComplexTestCase;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.Pair;
+import com.sun.star.beans.StringPair;
+import com.sun.star.container.XNamed;
+import com.sun.star.container.XContentEnumerationAccess;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.frame.XStorable;
+import com.sun.star.util.XCloseable;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XWordCursor;
+import com.sun.star.text.XSentenceCursor;
+import com.sun.star.text.XParagraphCursor;
+import com.sun.star.text.XFootnote;
+import com.sun.star.text.XTextField;
+import com.sun.star.text.TextContentAnchorType;
+import static com.sun.star.text.TextContentAnchorType.*;
+import static com.sun.star.text.ControlCharacter.*;
+import com.sun.star.rdf.XMetadatable;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Stack;
+
+
+class TreeNodeEnum
+{
+ private Object[] m_Elements;
+ private int m_Pos;
+ TreeNodeEnum(Object[] Elements) { m_Elements = Elements; m_Pos = 0; }
+ boolean hasNext() { return m_Pos < m_Elements.length; }
+ TreeNode next() { return (TreeNode) m_Elements[m_Pos++]; }
+}
+
+/** base class for tree nodes. only instance: root of tree. */
+class TreeNode
+{
+ private List<TreeNode> m_Children;
+ String getType() { return "__ROOT__"; }
+ boolean hasContent() { return false; }
+ boolean isNesting() { return false; }
+ TreeNode dup() { throw new RuntimeException("TreeNode.dup"); }
+ TreeNodeEnum createEnumeration() {
+ return new TreeNodeEnum(m_Children.toArray());
+ }
+ TreeNode() { m_Children = new ArrayList<TreeNode>(); }
+ TreeNode appendChild(TreeNode child)
+ { m_Children.add(child); return this; }
+ public String toString() {
+ return "<" + getType() + ">";
+ }
+}
+
+abstract class MarkNode extends TreeNode
+{
+ boolean m_isPoint;
+ boolean m_isStart = false;
+ String m_Name;
+ boolean isPoint() { return m_isPoint; }
+ boolean isStart() { return m_isStart; }
+ String getName() { return m_Name; }
+ MarkNode(String name) { m_Name = name; m_isPoint = true; }
+ boolean equals(MarkNode other) {
+ return (other.m_Name.equals(m_Name)) && (other.m_isPoint == m_isPoint)
+ && (other.m_isStart == m_isStart);
+ }
+ public String toString() {
+ return super.toString() + "\tname: " + m_Name +
+ "\tisPoint: " + m_isPoint + "\tisStart: " + m_isStart;
+ }
+}
+
+class BookmarkNode extends MarkNode
+{
+ private StringPair m_XmlId;
+ StringPair getXmlId() { return m_XmlId; }
+ BookmarkNode dup() { return new BookmarkNode(getName(), getXmlId()); }
+ BookmarkNode(String name) { this(name, new StringPair()); }
+ BookmarkNode(String name, StringPair xmlid) {
+ super(name); m_XmlId = xmlid;
+ }
+ String getType() { return "Bookmark"; }
+ public boolean equals(Object other) {
+ return (other instanceof BookmarkNode)
+ && super.equals((MarkNode) other)
+ && MetaNode.eq(((BookmarkNode) other).m_XmlId, m_XmlId);
+ }
+ public String toString() {
+ return super.toString()
+ + "\txmlid: " + m_XmlId.First + "#" + m_XmlId.Second;
+ }
+}
+
+class BookmarkStartNode extends BookmarkNode
+{
+ BookmarkStartNode dup() { return new BookmarkStartNode(getName()); }
+ BookmarkStartNode(String name) { this(name, new StringPair()); }
+ BookmarkStartNode(String name, StringPair xmlid) {
+ super(name, xmlid); m_isPoint = false; m_isStart = true;
+ }
+}
+
+class BookmarkEndNode extends BookmarkNode
+{
+ BookmarkEndNode dup() { return new BookmarkEndNode(getName()); }
+ BookmarkEndNode(String name) { this(name, new StringPair()); }
+ BookmarkEndNode(String name, StringPair xmlid) {
+ super(name, xmlid); m_isPoint = false; m_isStart = false;
+ }
+}
+
+class ReferenceMarkNode extends MarkNode
+{
+ ReferenceMarkNode dup() { return new ReferenceMarkNode(getName()); }
+ ReferenceMarkNode(String name) { super(name); }
+ String getType() { return "ReferenceMark"; }
+ public boolean equals(Object other) {
+ return (other instanceof ReferenceMarkNode)
+ && super.equals((MarkNode) other);
+ }
+}
+
+class ReferenceMarkStartNode extends ReferenceMarkNode
+{
+ ReferenceMarkStartNode dup()
+ { return new ReferenceMarkStartNode(getName()); }
+ ReferenceMarkStartNode(String name) {
+ super(name); m_isPoint = false; m_isStart = true;
+ }
+}
+
+class ReferenceMarkEndNode extends ReferenceMarkNode
+{
+ ReferenceMarkEndNode dup()
+ { return new ReferenceMarkEndNode(getName()); }
+ ReferenceMarkEndNode(String name) {
+ super(name); m_isPoint = false; m_isStart = false;
+ }
+}
+
+class DocumentIndexMarkNode extends MarkNode
+{
+ DocumentIndexMarkNode dup()
+ { return new DocumentIndexMarkNode(getName()); }
+ DocumentIndexMarkNode(String name) { super(name); }
+ String getType() { return "DocumentIndexMark"; }
+ public boolean equals(Object other) {
+ return (other instanceof DocumentIndexMarkNode)
+ && super.equals((MarkNode) other);
+ }
+}
+
+class DocumentIndexMarkStartNode extends DocumentIndexMarkNode
+{
+ DocumentIndexMarkStartNode dup()
+ { return new DocumentIndexMarkStartNode(getName()); }
+ DocumentIndexMarkStartNode(String name) {
+ super(name); m_isPoint = false; m_isStart = true;
+ }
+}
+
+class DocumentIndexMarkEndNode extends DocumentIndexMarkNode
+{
+ DocumentIndexMarkEndNode dup()
+ { return new DocumentIndexMarkEndNode(getName()); }
+ DocumentIndexMarkEndNode(String name) {
+ super(name); m_isPoint = false; m_isStart = false;
+ }
+}
+
+abstract class ContentNode extends TreeNode
+{
+ private String m_Content;
+ String getContent() { return m_Content; }
+ boolean hasContent() { return true; }
+ ContentNode(String content) {
+ m_Content = content;
+ }
+ TreeNode appendChild(TreeNode t) {
+ throw new RuntimeException("ContentNode.appendChild");
+ }
+ public String toString() {
+ return super.toString() + "\tcontent: " + m_Content;
+ }
+ boolean equals(ContentNode other) {
+ return (other.m_Content.equals(m_Content));
+ }
+}
+
+class TextNode extends ContentNode
+{
+ TextNode dup() { return new TextNode(getContent()); }
+ TextNode(String content) { super(content); }
+ String getType() { return "Text"; }
+ public boolean equals(Object other) {
+ return (other instanceof TextNode) && super.equals((ContentNode) other);
+ }
+}
+
+class TextFieldNode extends ContentNode
+{
+ TextFieldNode dup() { return new TextFieldNode(getContent()); }
+ TextFieldNode(String content) { super(content); }
+ String getType() { return "TextField"; }
+ public boolean equals(Object other) {
+ return (other instanceof TextFieldNode)
+ && super.equals((ContentNode) other);
+ }
+}
+
+class FrameNode extends TreeNode
+{
+ private String m_Name;
+ private TextContentAnchorType m_Anchor;
+ String getName() { return m_Name; }
+ TextContentAnchorType getAnchor() { return m_Anchor; }
+ FrameNode dup() { return new FrameNode(getName(), getAnchor()); }
+ FrameNode(String name, TextContentAnchorType anchor) {
+ m_Name = name; m_Anchor = anchor;
+ }
+ String getType() { return "Frame"; }
+ public boolean equals(Object other) {
+ return (other instanceof FrameNode)
+ && (((FrameNode) other).m_Name.equals(m_Name))
+ && (((FrameNode) other).m_Anchor == m_Anchor);
+ }
+ public String toString() {
+ return super.toString()
+ + "\tname: " + m_Name + "\tanchor: " + toString(m_Anchor);
+ }
+ static String toString(TextContentAnchorType anchor) {
+ switch (anchor.getValue()) {
+ case AS_CHARACTER_value: return "AS_CHARACTER";
+ case AT_CHARACTER_value: return "AT_CHARACTER";
+ case AT_PARAGRAPH_value: return "AT_PARAGRAPH";
+ case AT_PAGE_value: return "AT_PAGE";
+ case AT_FRAME_value: return "AT_FRAME";
+ default: throw new RuntimeException("unknown anchor");
+ }
+ }
+}
+
+class FootnoteNode extends TreeNode
+{
+ private String m_Label;
+ String getLabel() { return m_Label; }
+ FootnoteNode dup() { return new FootnoteNode(getLabel()); }
+ FootnoteNode(String label) { m_Label = label; }
+ String getType() { return "Footnote"; }
+ public boolean equals(Object other) {
+ return (other instanceof FootnoteNode)
+ && (((FootnoteNode) other).m_Label.equals(m_Label));
+ }
+ public String toString() {
+ return super.toString() + "\tlabel: " + m_Label;
+ }
+}
+
+class ControlCharacterNode extends TreeNode
+{
+ private short m_Char;
+ short getChar() { return m_Char; }
+ ControlCharacterNode dup() { return new ControlCharacterNode(getChar()); }
+ ControlCharacterNode(short c) { m_Char = c; }
+ String getType() { return "ControlCharacter"; }
+ public boolean equals(Object other) {
+ return (other instanceof ControlCharacterNode)
+ && (((ControlCharacterNode) other).m_Char == m_Char);
+ }
+ public String toString() {
+ return super.toString() + "\tchar: " + m_Char;
+ }
+}
+
+class SoftPageBreakNode extends TreeNode
+{
+ String getType() { return "SoftPageBreak"; }
+ public boolean equals(Object other) {
+ return (other instanceof SoftPageBreakNode);
+ }
+}
+
+class HyperlinkNode extends TreeNode
+{
+ private String m_URL;
+ String getURL() { return m_URL; }
+ HyperlinkNode dup() { return new HyperlinkNode(getURL()); }
+ HyperlinkNode(String url) {
+ if (url.length() == 0) throw new RuntimeException("HyperlinkNode");
+ m_URL = url;
+ }
+ String getType() { return "Hyperlink"; }
+ boolean isNesting() { return true; }
+ public boolean equals(Object other) {
+ return (other instanceof HyperlinkNode)
+ && (((HyperlinkNode) other).m_URL.equals(m_URL));
+ }
+ public String toString() {
+ return super.toString() + "\turl: " + m_URL;
+ }
+}
+
+class RubyNode extends TreeNode
+{
+ private String m_Ruby;
+ String getRubyText() { return m_Ruby; }
+ RubyNode dup() { return new RubyNode(getRubyText()); }
+ RubyNode(String ruby) {
+ if (ruby.length() == 0) throw new RuntimeException("RubyNode");
+ m_Ruby = ruby;
+ }
+ String getType() { return "Ruby"; }
+ boolean isNesting() { return true; }
+ public boolean equals(Object other) {
+ return (other instanceof RubyNode)
+ && (((RubyNode) other).m_Ruby.equals(m_Ruby));
+ }
+ public String toString() {
+ return super.toString() + "\trubytext: " + m_Ruby;
+ }
+}
+
+class MetaNode extends TreeNode
+{
+ private StringPair m_XmlId;
+ StringPair getXmlId() { return m_XmlId; }
+ MetaNode dup() { return new MetaNode(getXmlId()); }
+ MetaNode (StringPair xmlid) { m_XmlId = xmlid; }
+ String getType() { return "InContentMetadata"; }
+ boolean isNesting() { return true; }
+ public boolean equals(Object other) {
+ return (other instanceof MetaNode)
+ && eq(((MetaNode) other).m_XmlId, m_XmlId);
+ }
+ static boolean eq(StringPair left, StringPair right)
+ {
+ return left.First.equals(right.First)
+ && left.Second.equals(right.Second);
+ }
+ public String toString() {
+ return super.toString()
+ + "\txmlid: " + m_XmlId.First + "#" + m_XmlId.Second;
+ }
+}
+
+class MetaFieldNode extends MetaNode
+{
+ MetaFieldNode dup() { return new MetaFieldNode(getXmlId()); }
+ MetaFieldNode (StringPair xmlid) { super(xmlid); }
+ String getType() { return "MetadataField"; }
+}
+
+class Range
+{
+ private short m_Start;
+ private short m_End;
+ private TreeNode m_Node;
+ short getStart() { return m_Start; }
+ short getEnd() { return m_End ; }
+ short getExtent() { return (short) (m_End - m_Start); }
+ TreeNode getNode() { return m_Node; }
+ Range(int start, int end, TreeNode node)
+ { m_Start = (short) start; m_End = (short) end; m_Node = node; }
+}
+
+//----------------------------------------------------------------------
+
+/* this is where we nail the pudding to the wall */
+class FuzzyTester
+{
+ private long m_DiffContent = 0;
+ private long m_DiffMissing = 0;
+ private long m_DiffNesting = 0;
+ private long m_DiffSpuriousEmptyText = 0;
+ private long m_DiffSequence = 0; // ignored?
+ private Stack<Pair<TreeNode, TreeNodeEnum>> m_StackExpected;
+ private Stack<Pair<TreeNode, TreeNodeEnum>> m_StackActual;
+ private List<TreeNode> m_BufferExpected;
+ private List<TreeNode> m_BufferActual;
+ private share.LogWriter m_Log;
+
+ FuzzyTester(share.LogWriter log) {
+ m_Log = log;
+ m_BufferExpected = new ArrayList<TreeNode>();
+ m_BufferActual = new ArrayList<TreeNode>();
+ m_StackExpected = new Stack<Pair<TreeNode, TreeNodeEnum>>();
+ m_StackActual = new Stack<Pair<TreeNode, TreeNodeEnum>>();
+ }
+
+ /** idea: traverse both trees, enumerate nodes, stopping at content nodes.
+ then compare buffers. */
+ boolean doTest(TreeNode expected, TreeNode actual)
+ {
+ if (!expected.getType().equals("__ROOT__"))
+ throw new RuntimeException("doTest: expected: root");
+ if (!actual.getType().equals("__ROOT__"))
+ throw new RuntimeException("doTest: actual: root");
+ m_StackExpected.push(new Pair(expected, expected.createEnumeration()));
+ m_StackActual.push(new Pair(actual, actual.createEnumeration()));
+ do {
+ traverse(m_StackExpected, m_BufferExpected);
+ traverse(m_StackActual, m_BufferActual);
+ //??? root?
+ testBuffer();
+ } while (!m_StackExpected.empty() || !m_StackActual.empty());
+ if (m_DiffSequence != 0) {
+ m_Log.println("warning: " + m_DiffSequence
+ + " differences in sequence");
+ }
+ if (m_DiffSpuriousEmptyText != 0) {
+ m_Log.println("warning: " + m_DiffSpuriousEmptyText
+ + " spurious empty text nodes");
+ }
+ if (m_DiffNesting != 0) {
+ m_Log.println("WARNING: " + m_DiffNesting
+ + " differences in nesting");
+ }
+ return (m_DiffContent == 0) && (m_DiffMissing == 0);
+ }
+
+ private void traverse(Stack<Pair<TreeNode, TreeNodeEnum>> stack,
+ List<TreeNode> buffer)
+ {
+ while (!stack.empty()) {
+ TreeNodeEnum topEnum = stack.peek().Second;
+ if (topEnum.hasNext()) {
+ TreeNode node = topEnum.next();
+ buffer.add(node);
+ TreeNodeEnum nodeEnum = node.createEnumeration();
+ if (nodeEnum.hasNext()) {
+ stack.push(new Pair(node, nodeEnum));
+ }
+ if (node.hasContent()) {
+ if (!((node instanceof TextNode) // spurious empty text?
+ && ((TextNode) node).getContent().length() == 0)) {
+ return; // break here
+ }
+ }
+ } else {
+ buffer.add(stack.peek().First);
+ stack.pop();
+ }
+ }
+ }
+
+ private void testTerminatingNode()
+ {
+ int lenExpected = m_BufferExpected.size();
+ int lenActual = m_BufferActual.size();
+ if (lenExpected == 0 || lenActual == 0)
+ return;
+ TreeNode expected = m_BufferExpected.get(lenExpected - 1);
+ TreeNode actual = m_BufferActual.get(lenActual - 1);
+
+ boolean eRoot = expected.getType().equals("__ROOT__");
+ boolean aRoot = actual.getType().equals("__ROOT__");
+ if (eRoot || aRoot) {
+ if (!(eRoot && aRoot)) {
+ if (aRoot) printMissing(expected);
+ else printUnexpected(actual);
+ m_DiffMissing++;
+ }
+ return;
+ }
+
+ testContentNode((ContentNode) expected, (ContentNode) actual);
+
+ m_BufferExpected.set(lenExpected - 1, null);
+ m_BufferActual.set(lenActual - 1, null);
+ }
+
+ private void testContentNode(ContentNode expected, ContentNode actual)
+ {
+ String contentExpected = expected.getContent();
+ String contentActual = actual.getContent();
+ if (!expected.equals(actual)) {
+ printDiff("text content differs", contentExpected, contentActual);
+ m_DiffContent++;
+ }
+ }
+
+ private void testBuffer()
+ {
+ int lenExpected = m_BufferExpected.size();
+ int lenActual = m_BufferActual.size();
+ for (int i = 0; i < lenExpected - 1; i++ )
+ {
+ TreeNode node = m_BufferExpected.get(i);
+ int j = m_BufferActual.indexOf(node);
+ if (j >= 0) {
+ TreeNode other = m_BufferActual.get(j);
+ if (j != i)
+ {
+ //FIXME how bad is this?
+ printDiff("position differs",
+ String.valueOf(i), String.valueOf(j));
+ // a hacky hack
+ int min = Math.min(i,j);
+ int max = Math.max(Math.min(lenActual - 1, i),j);
+ for (int k = min; k != max; k ++) {
+ TreeNode tmp = m_BufferActual.get(k);
+ if (tmp != null && tmp.isNesting()) {
+ printNesting(node, tmp);
+ m_DiffNesting++;
+ }
+ }
+ m_DiffSequence++;
+ }
+ m_BufferActual.set(j, null);
+ } else {
+//m_Log.println("testBuffer:");
+ printMissing(node);
+ m_DiffMissing++;
+ }
+ }
+ for (int j = 0; j < lenActual - 1; j++)
+ {
+ TreeNode node = m_BufferActual.get(j);
+ if (node != null)
+ {
+//m_Log.println("testBuffer:");
+ printUnexpected(node);
+ if ((node instanceof TextNode) &&
+ ((TextNode) node).getContent().length() == 0) {
+ m_DiffSpuriousEmptyText++;
+ } else {
+ m_DiffMissing++;
+ }
+ }
+ }
+ testTerminatingNode();
+ m_BufferExpected.clear();
+ m_BufferActual.clear();
+ }
+
+ void printDiff(String prefix, String expected, String actual)
+ {
+ m_Log.println(prefix +
+ ":\texpected: " + expected + "\tactual: " + actual);
+ }
+
+ void printNesting(TreeNode node, TreeNode nesting)
+ {
+ m_Log.println("node: " + node.toString()
+ + " possibly moved across nesting " + nesting.toString());
+ }
+
+ void printMissing(TreeNode node)
+ {
+ m_Log.println(" missing node: " + node.toString());
+
+ }
+
+ void printUnexpected(TreeNode node)
+ {
+ m_Log.println("unexpected node: " + node.toString());
+
+ }
+}
+
+
+//----------------------------------------------------------------------
+
+class EnumConverter
+{
+ private Stack<TreeNode> m_Stack;
+ TextPortionEnumerationTest m_T;
+
+ EnumConverter(TextPortionEnumerationTest err) {
+ m_Stack = new Stack<TreeNode>(); m_T = err;
+ }
+
+ TreeNode convert(XEnumeration xEnum) throws Exception
+ {
+ TreeNode root = new TreeNode();
+ m_Stack.push(root);
+ TreeNode ret = convertChildren(xEnum);
+ m_T.assure("EnumConverter.convert: stack", m_Stack.empty());
+ return ret;
+ }
+
+ TreeNode convertChildren(XEnumeration xEnum) throws Exception
+ {
+ while (xEnum.hasMoreElements()) {
+ TreeNode node;
+ Object xElement = xEnum.nextElement();
+ XTextRange xPortion = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, xElement);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xPortion);
+ String type = (String) xPropSet.getPropertyValue("TextPortionType");
+ if (type.equals("Text")) {
+ String text = xPortion.getString();
+ node = new TextNode(text);
+ String url = (String) xPropSet.getPropertyValue("HyperLinkURL");
+ if (url.length() > 0) {
+ TreeNode temp = node;
+ node = new HyperlinkNode(url);
+ node.appendChild(temp);
+ }
+ } else if (type.equals("TextField")) {
+ Object xField = xPropSet.getPropertyValue("TextField");
+ XServiceInfo xService = (XServiceInfo)
+ UnoRuntime.queryInterface(XServiceInfo.class, xField);
+ if (xService.supportsService(
+ "com.sun.star.text.textfield.MetadataField"))
+ {
+ XMetadatable xMeta = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xField);
+ StringPair xmlid = xMeta.getMetadataReference();
+ node = new MetaFieldNode(xmlid);
+ m_Stack.push(node);
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,
+ xMeta);
+ XEnumeration xEnumChildren = xEA.createEnumeration();
+ TreeNode node2 = convertChildren(xEnumChildren);
+ m_T.assure("stack error: meta-field", node == node2);
+ } else {
+ XPropertySet xFieldPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xField);
+ String content = (String)
+ xFieldPropSet.getPropertyValue("Content");
+ boolean isFixed = (Boolean)
+ xFieldPropSet.getPropertyValue("IsFixed");
+ m_T.assure("field not fixed?", isFixed);
+ node = new TextFieldNode(content);
+ }
+ } else if (type.equals("Footnote")) {
+ Object xNote = xPropSet.getPropertyValue("Footnote");
+ XFootnote xFootnote = (XFootnote)
+ UnoRuntime.queryInterface(XFootnote.class, xNote);
+ String label = xFootnote.getLabel();
+ node = new FootnoteNode(label);
+ } else if (type.equals("Frame")) {
+ XContentEnumerationAccess xCEA = (XContentEnumerationAccess)
+ UnoRuntime.queryInterface(XContentEnumerationAccess.class,
+ xPortion);
+ XEnumeration xContentEnum = xCEA.createContentEnumeration("");
+ while (xContentEnum.hasMoreElements()) {
+ Object xFrame = xContentEnum.nextElement();
+ XPropertySet xFramePropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xFrame);
+ TextContentAnchorType anchor = (TextContentAnchorType)
+ xFramePropSet.getPropertyValue("AnchorType");
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xFrame);
+ String name = xNamed.getName();
+ node = new FrameNode(name, anchor);
+ m_Stack.peek().appendChild(node);
+ }
+ continue;
+ } else if (type.equals("ControlCharacter")) {
+ short c = (Short)
+ xPropSet.getPropertyValue("ControlCharacter");
+ node = new ControlCharacterNode(c);
+ } else if (type.equals("Bookmark")) {
+ Object xMark = xPropSet.getPropertyValue("Bookmark");
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xMark);
+ String name = xNamed.getName();
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMark);
+ StringPair xmlid = xMetadatable.getMetadataReference();
+ boolean isCollapsed = (Boolean)
+ xPropSet.getPropertyValue("IsCollapsed");
+ if (isCollapsed) {
+ node = new BookmarkNode(name, xmlid);
+ } else {
+ boolean isStart = (Boolean)
+ xPropSet.getPropertyValue("IsStart");
+ if (isStart) {
+ node = new BookmarkStartNode(name, xmlid);
+ } else {
+ node = new BookmarkEndNode(name, xmlid);
+ }
+ }
+ } else if (type.equals("ReferenceMark")) {
+ Object xMark = xPropSet.getPropertyValue("ReferenceMark");
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xMark);
+ String name = xNamed.getName();
+ boolean isCollapsed = (Boolean)
+ xPropSet.getPropertyValue("IsCollapsed");
+ if (isCollapsed) {
+ node = new ReferenceMarkNode(name);
+ } else {
+ boolean isStart = (Boolean)
+ xPropSet.getPropertyValue("IsStart");
+ if (isStart) {
+ node = new ReferenceMarkStartNode(name);
+ } else {
+ node = new ReferenceMarkEndNode(name);
+ }
+ }
+ } else if (type.equals("DocumentIndexMark")) {
+ Object xMark = xPropSet.getPropertyValue("DocumentIndexMark");
+ XPropertySet xMarkSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xMark);
+ String name = (String) xMarkSet.getPropertyValue("PrimaryKey");
+ boolean isCollapsed = (Boolean)
+ xPropSet.getPropertyValue("IsCollapsed");
+ if (isCollapsed) {
+ node = new DocumentIndexMarkNode(name);
+ } else {
+ boolean isStart = (Boolean)
+ xPropSet.getPropertyValue("IsStart");
+ if (isStart) {
+ node = new DocumentIndexMarkStartNode(name);
+ } else {
+ node = new DocumentIndexMarkEndNode(name);
+ }
+ }
+ } else if (type.equals("SoftPageBreak")) {
+ node = new SoftPageBreakNode();
+ } else if (type.equals("Ruby")) {
+ boolean isStart = (Boolean)
+ xPropSet.getPropertyValue("IsStart");
+ if (isStart) {
+ // ARRGH!!! stupid api...
+ // the text is ONLY at the start!
+ String ruby = (String)
+ xPropSet.getPropertyValue("RubyText");
+ node = new RubyNode(ruby);
+ m_Stack.push(node);
+ continue;
+ } else {
+ node = m_Stack.pop();
+ m_T.assure("stack error: Ruby expected; is: " +
+ node.toString(), node instanceof RubyNode);
+// m_T.assure("stack error: ruby",
+// ruby.equals(((RubyNode)node).getRubyText()));
+ }
+ } else if (type.equals("InContentMetadata")) {
+ Object xMeta = xPropSet.getPropertyValue("InContentMetadata");
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMeta);
+ StringPair xmlid = xMetadatable.getMetadataReference();
+ node = new MetaNode(xmlid);
+ m_Stack.push(node);
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
+ XEnumeration xEnumChildren = xEA.createEnumeration();
+ TreeNode node2 = convertChildren(xEnumChildren);
+ m_T.assure("stack error: meta", node == node2);
+// } else if (type.equals("MetadataField")) {
+// Object xMeta = xPropSet.getPropertyValue("MetadataField");
+ } else {
+ throw new RuntimeException("unexpected type: " + type);
+ }
+ m_Stack.peek().appendChild(node);
+ }
+ TreeNode ret = m_Stack.pop();
+ return ret;
+ }
+}
+
+
+//----------------------------------------------------------------------
+
+abstract class Inserter
+{
+ private XMultiServiceFactory m_xDocFactory;
+ XText m_xText;
+ XParagraphCursor m_xCursor;
+
+ Inserter(XTextDocument xDoc)
+ {
+ m_xDocFactory = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(XMultiServiceFactory.class, xDoc);
+ m_xText = xDoc.getText();
+ XTextCursor xCursor = m_xText.createTextCursor();
+ m_xCursor = (XParagraphCursor)
+ UnoRuntime.queryInterface(XParagraphCursor.class, xCursor);
+ }
+
+ void initParagraph() throws Exception
+ {
+ m_xCursor.gotoStartOfParagraph(false);
+ m_xText.insertControlCharacter(m_xCursor, PARAGRAPH_BREAK, false);
+ // we split the first (empty) paragraph, and then insert into the
+ // second (empty) paragraph; this ensures first is always empty!
+ }
+
+ void insertControlCharacter(XTextCursor xCursor, short cchar)
+ throws Exception
+ {
+ m_xText.insertControlCharacter(xCursor, cchar, false);
+ }
+
+ void insertText(XTextCursor xCursor, String text)
+ {
+ xCursor.setString(text);
+ }
+
+ void insertTextField(XTextCursor xCursor, String content) throws Exception
+ {
+ XTextContent xContent = makeTextField(content);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeTextField(String content)
+ throws Exception
+ {
+ Object xField =
+ m_xDocFactory.createInstance("com.sun.star.text.textfield.Author");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xField);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xField);
+ xPropSet.setPropertyValue("IsFixed", true);
+ xPropSet.setPropertyValue("FullName", false);
+ xPropSet.setPropertyValue("Content", content);
+ return xContent;
+ }
+
+ void insertFrame(XTextRange xCursor, String name,
+ TextContentAnchorType anchor) throws Exception
+ {
+ XTextContent xContent = makeFrame(name, anchor);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeFrame(String name, TextContentAnchorType anchor)
+ throws Exception
+ {
+ Object xFrame =
+ m_xDocFactory.createInstance("com.sun.star.text.TextFrame");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xFrame);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xFrame);
+ xPropSet.setPropertyValue("AnchorType", anchor);
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xContent);
+ xNamed.setName(name);
+ return xContent;
+ }
+
+ void insertFootnote(XTextCursor xCursor, String label) throws Exception
+ {
+ XTextContent xContent = makeFootnote(label);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeFootnote(String label) throws Exception
+ {
+ Object xNote =
+ m_xDocFactory.createInstance("com.sun.star.text.Footnote");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xNote);
+ XFootnote xFootnote = (XFootnote)
+ UnoRuntime.queryInterface(XFootnote.class, xNote);
+ xFootnote.setLabel(label);
+ return xContent;
+ }
+
+ void insertBookmark(XTextCursor xCursor, String name, StringPair xmlid)
+ throws Exception
+ {
+ XTextContent xContent = makeBookmark(name);
+ xContent.attach(xCursor);
+ if (!xmlid.First.equals(""))
+ {
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xContent);
+ xMetadatable.setMetadataReference(xmlid);
+ }
+ }
+
+ XTextContent makeBookmark(String name) throws Exception
+ {
+ Object xBookmark =
+ m_xDocFactory.createInstance("com.sun.star.text.Bookmark");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xBookmark);
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xContent);
+ xNamed.setName(name);
+ return xContent;
+ }
+
+ void insertReferenceMark(XTextCursor xCursor, String name) throws Exception
+ {
+ XTextContent xContent = makeReferenceMark(name);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeReferenceMark(String name) throws Exception
+ {
+ Object xMark =
+ m_xDocFactory.createInstance("com.sun.star.text.ReferenceMark");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xMark);
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xContent);
+ xNamed.setName(name);
+ return xContent;
+ }
+
+ void insertDocumentIndexMark(XTextCursor xCursor, String key)
+ throws Exception
+ {
+ XTextContent xContent = makeDocumentIndexMark(key);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeDocumentIndexMark(String key) throws Exception
+ {
+ Object xMark =
+ m_xDocFactory.createInstance("com.sun.star.text.DocumentIndexMark");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xMark);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xMark);
+ xPropSet.setPropertyValue("PrimaryKey", key);
+ return xContent;
+ }
+
+ void insertHyperlink(XTextCursor xCursor, String url) throws Exception
+ {
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xCursor);
+ xPropSet.setPropertyValue("HyperLinkURL", url);
+ }
+
+ void insertRuby(XTextCursor xCursor, String rubytext) throws Exception
+ {
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xCursor);
+ xPropSet.setPropertyValue("RubyText", rubytext);
+ }
+
+ void insertMeta(XTextCursor xCursor, StringPair xmlid)
+ throws Exception
+ {
+ XTextContent xContent = makeMeta();
+ xContent.attach(xCursor);
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xContent);
+ xMetadatable.setMetadataReference(xmlid);
+ }
+
+ XTextContent makeMeta() throws Exception
+ {
+ Object xMeta = m_xDocFactory.createInstance(
+ "com.sun.star.text.InContentMetadata");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xMeta);
+ return xContent;
+ }
+
+ void insertMetaField(XTextCursor xCursor, StringPair xmlid)
+ throws Exception
+ {
+ XTextContent xContent = makeMetaField();
+ xContent.attach(xCursor);
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xContent);
+ xMetadatable.setMetadataReference(xmlid);
+ }
+
+ XTextField makeMetaField() throws Exception
+ {
+ Object xMeta = m_xDocFactory.createInstance(
+ "com.sun.star.text.textfield.MetadataField");
+ XTextField xContent = (XTextField)
+ UnoRuntime.queryInterface(XTextField.class, xMeta);
+ return xContent;
+ }
+
+}
+
+class TreeInserter extends Inserter
+{
+ private Map<String, XTextRange> m_BookmarkStarts;
+ private Map<String, XTextRange> m_ReferenceMarkStarts;
+ private Map<String, XTextRange> m_DocumentIndexMarkStarts;
+ private List<Pair<XTextRange, FrameNode>> m_FrameHints;
+
+ TreeInserter(XTextDocument xDoc)
+ {
+ super(xDoc);
+ m_BookmarkStarts = new HashMap<String, XTextRange>();
+ m_ReferenceMarkStarts = new HashMap<String, XTextRange>();
+ m_DocumentIndexMarkStarts = new HashMap<String, XTextRange>();
+ m_FrameHints = new ArrayList<Pair<XTextRange, FrameNode>>();
+ }
+
+ void insertTree(TreeNode tree) throws Exception
+ {
+ if (!tree.getType().equals("__ROOT__"))
+ throw new RuntimeException("insertTree: test error: no root");
+ initParagraph();
+ insertChildren(tree.createEnumeration());
+ for (int i = 0; i < m_FrameHints.size(); ++i) {
+ Pair<XTextRange, FrameNode> p = m_FrameHints.get(i);
+ insertFrame(p.First, p.Second.getName(), p.Second.getAnchor());
+ }
+ }
+
+ void insertChildren(TreeNodeEnum children) throws Exception
+ {
+ while (children.hasNext()) {
+ m_xCursor.gotoEndOfParagraph(false);
+ TreeNode node = children.next();
+ String type = node.getType();
+ if (type.equals("Bookmark")) {
+ BookmarkNode bkmk = (BookmarkNode) node;
+ String name = bkmk.getName();
+ StringPair id = bkmk.getXmlId();
+ if (bkmk.isPoint()) {
+ insertBookmark(m_xCursor, name, id);
+ } else if (bkmk.isStart()) {
+ m_BookmarkStarts.put(name, m_xCursor.getStart());
+ } else {
+ XTextRange xRange = m_BookmarkStarts.get(name);
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertBookmark(xCursor, name, id);
+ }
+ } else if (type.equals("ReferenceMark")) {
+ ReferenceMarkNode mark = (ReferenceMarkNode) node;
+ String name = mark.getName();
+ if (mark.isPoint()) {
+ insertReferenceMark(m_xCursor, name);
+ } else if (mark.isStart()) {
+ m_ReferenceMarkStarts.put(name, m_xCursor.getStart());
+ } else {
+ XTextRange xRange = m_ReferenceMarkStarts.get(name);
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertReferenceMark(xCursor, name);
+ }
+ } else if (type.equals("DocumentIndexMark")) {
+ DocumentIndexMarkNode mark = (DocumentIndexMarkNode) node;
+ String name = mark.getName();
+ if (mark.isPoint()) {
+ insertDocumentIndexMark(m_xCursor, name);
+ } else if (mark.isStart()) {
+ m_DocumentIndexMarkStarts.put(name, m_xCursor.getStart());
+ } else {
+ XTextRange xRange = m_DocumentIndexMarkStarts.get(name);
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertDocumentIndexMark(xCursor, name);
+ }
+ } else if (type.equals("Hyperlink")) {
+ HyperlinkNode href = (HyperlinkNode) node;
+ XTextRange xRange = m_xCursor.getStart();
+ insertChildren(href.createEnumeration());
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertHyperlink(xCursor, href.getURL());
+ } else if (type.equals("Ruby")) {
+ RubyNode ruby = (RubyNode) node;
+ XTextRange xRange = m_xCursor.getStart();
+ insertChildren(ruby.createEnumeration());
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertRuby(xCursor, ruby.getRubyText());
+ } else if (type.equals("InContentMetadata")) {
+ MetaNode meta = (MetaNode) node;
+ XTextRange xRange = m_xCursor.getStart();
+ insertChildren(meta.createEnumeration());
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertMeta(xCursor, meta.getXmlId());
+ } else if (type.equals("MetadataField")) {
+ MetaFieldNode meta = (MetaFieldNode) node;
+ XTextRange xRange = m_xCursor.getStart();
+ insertChildren(meta.createEnumeration());
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertMetaField(xCursor, meta.getXmlId());
+ } else if (type.equals("Text")) {
+ TextNode text = (TextNode) node;
+ insertText(m_xCursor, text.getContent());
+ } else if (type.equals("TextField")) {
+ TextFieldNode field = (TextFieldNode) node;
+ insertTextField(m_xCursor, field.getContent());
+ } else if (type.equals("Footnote")) {
+ FootnoteNode note = (FootnoteNode) node;
+ insertFootnote(m_xCursor, note.getLabel());
+ } else if (type.equals("Frame")) {
+ FrameNode frame = (FrameNode) node;
+ if (frame.getAnchor() == AT_CHARACTER) {
+ m_FrameHints.add( new Pair(m_xCursor.getStart(), frame) );
+ } else {
+ insertFrame(m_xCursor, frame.getName(), frame.getAnchor());
+ }
+ } else if (type.equals("ControlCharacter")) {
+ ControlCharacterNode cchar = (ControlCharacterNode) node;
+ insertControlCharacter(m_xCursor, cchar.getChar());
+ } else if (type.equals("SoftPageBreak")) {
+ SoftPageBreakNode spbk = (SoftPageBreakNode) node;
+ throw new RuntimeException("sorry, cannot test SoftPageBreak");
+ } else {
+ throw new RuntimeException("unexpected type: " + type);
+ }
+ }
+ }
+
+ XParagraphCursor mkCursor(XTextRange xRange)
+ {
+ XTextCursor xCursor = m_xText.createTextCursorByRange(xRange);
+ XParagraphCursor xParaCursor = (XParagraphCursor)
+ UnoRuntime.queryInterface(XParagraphCursor.class, xCursor);
+ xParaCursor.gotoEndOfParagraph(true);
+ return xParaCursor;
+ }
+}
+
+
+// FIXME: this does not account for inserted dummy characters!
+class RangeInserter extends Inserter
+{
+ RangeInserter(XTextDocument xDoc) throws Exception
+ { super(xDoc); initParagraph(); }
+
+ /*
+ void insertText(int pos, String text)
+ {
+ m_xCursor.gotoStartOfParagraph(false);
+ m_xCursor.goRight((short) pos, false);
+ insertText(m_xCursor, text);
+ }
+ */
+
+ void insertRange(Range range) throws Exception
+ {
+ m_xCursor.gotoStartOfParagraph(false);
+ m_xCursor.goRight(range.getStart(), false);
+ m_xCursor.goRight(range.getExtent(), true);
+ insertNode(m_xCursor, range.getNode());
+ }
+
+ void insertNode(XParagraphCursor xCursor, TreeNode node) throws Exception
+ {
+ String type = node.getType();
+ if (type.equals("Bookmark")) {
+ BookmarkNode bkmk = (BookmarkNode) node;
+ if (bkmk.isPoint()) throw new RuntimeException("range only");
+ insertBookmark(xCursor, bkmk.getName(), bkmk.getXmlId());
+ } else if (type.equals("ReferenceMark")) {
+ ReferenceMarkNode mark = (ReferenceMarkNode) node;
+ if (mark.isPoint()) throw new RuntimeException("range only");
+ insertReferenceMark(xCursor, mark.getName());
+ } else if (type.equals("DocumentIndexMark")) {
+ DocumentIndexMarkNode mark = (DocumentIndexMarkNode) node;
+ if (mark.isPoint()) throw new RuntimeException("range only");
+ insertDocumentIndexMark(xCursor, mark.getName());
+ } else if (type.equals("Hyperlink")) {
+ HyperlinkNode href = (HyperlinkNode) node;
+ insertHyperlink(xCursor, href.getURL());
+ } else if (type.equals("Ruby")) {
+ RubyNode ruby = (RubyNode) node;
+ insertRuby(xCursor, ruby.getRubyText());
+ } else if (type.equals("InContentMetadata")) {
+ MetaNode meta = (MetaNode) node;
+ insertMeta(xCursor, meta.getXmlId());
+ } else if (type.equals("MetadataField")) {
+ MetaFieldNode meta = (MetaFieldNode) node;
+ insertMetaField(xCursor, meta.getXmlId());
+ } else if (type.equals("Text")) {
+ TextNode text = (TextNode) node;
+ insertText(xCursor, text.getContent());
+ } else if (type.equals("TextField")) {
+ TextFieldNode field = (TextFieldNode) node;
+ insertTextField(m_xCursor, field.getContent());
+ } else if (type.equals("Footnote")) {
+ FootnoteNode note = (FootnoteNode) node;
+ insertFootnote(m_xCursor, note.getLabel());
+ } else if (type.equals("Frame")) {
+ FrameNode frame = (FrameNode) node;
+ insertFrame(xCursor, frame.getName(), frame.getAnchor());
+ } else if (type.equals("ControlCharacter")) {
+ ControlCharacterNode cchar = (ControlCharacterNode) node;
+ insertControlCharacter(m_xCursor, cchar.getChar());
+ } else if (type.equals("SoftPageBreak")) {
+ throw new RuntimeException("sorry, cannot test SoftPageBreak");
+ } else {
+ throw new RuntimeException("unexpected type: " + type);
+ }
+ }
+}
+
+
+//----------------------------------------------------------------------
+
+public class TextPortionEnumerationTest extends ComplexTestCase
+{
+ private XMultiServiceFactory m_xMSF = null;
+ private XComponentContext m_xContext = null;
+ private XTextDocument m_xDoc = null;
+ private String m_TmpDir = null;
+
+ private int m_Count = 1;
+
+// public String[] getTestMethodNames() { return new String[] { "testLoadStore" }; }
+ public String[] getTestMethodNames() {
+ return new String[] {
+ "testText",
+ "testTextField",
+// "testControlChar",
+// "testSoftPageBreak",
+ "testFootnote",
+ "testFrameAs",
+ "testFrameAt",
+ "testBookmarkPoint",
+ "testBookmark",
+ "testBookmarkPointXmlId",
+ "testBookmarkXmlId",
+ "testRefmarkPoint",
+ "testRefmark",
+ "testToxmarkPoint",
+ "testToxmark",
+ "testHyperlink",
+ "testHyperlinkEmpty",
+ "testRuby",
+ "testRubyEmpty",
+ "testMeta",
+ "testMetaEmpty",
+ "testMetaField",
+ "testMetaFieldEmpty",
+ "testBookmark1",
+ "testBookmark2",
+ "testRefMark2",
+ "testRefMark3",
+ "testToxMark2",
+ "testToxMark3",
+ "testMarks1",
+ "testMarks2",
+ "testMarks3",
+ "testFrameMark1",
+ "testFrameMark2",
+ "testFrameMark3",
+ "testFrameMark4",
+ "testFrames1",
+ "testFrames2",
+ "testFrames3",
+ "testFrames4",
+ "testFrames5",
+ "testRubyHyperlink1",
+ "testRubyHyperlink2",
+ "testEnd1",
+ "testEnd2",
+ "testEnd3",
+ "testEnd4",
+ "testEnd5",
+ "testEmpty1",
+ "testEmpty2",
+ "testEmpty3",
+ "test1",
+ "testRange1",
+ "testRangeHyperlinkHyperlink",
+ "testRangeHyperlinkRuby",
+ "testRangeRubyHyperlink",
+ "testRangeRubyRuby",
+ "testRangeHyperlinkMeta",
+ "testRangeRubyMeta",
+ "testRangeMetaHyperlink",
+ "testRangeMetaRuby",
+ "testRangeMetaMeta",
+ "testRange2",
+ "testRange3",
+ "testRange4",
+ "testRange5",
+ "testRange6",
+ "testRange7",
+ "testMetaXText",
+ "testMetaXTextCursor",
+ "testMetaXTextAttachToxMark",
+ "testMetaXTextAttachRefMark",
+ "testMetaXTextAttachTextField",
+ "testMetaXTextAttachFootnote",
+ "testMetaXTextAttachMeta",
+ "testMetaFieldXTextField",
+ "testMetaFieldXPropertySet",
+ "testLoadStore",
+ };
+ }
+
+ public void before() throws Exception
+ {
+ m_xMSF = (XMultiServiceFactory) param.getMSF();
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, m_xMSF);
+ Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext");
+ m_xContext = (XComponentContext)
+ UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
+ assure("could not get component context.", m_xContext != null);
+ m_xDoc = util.WriterTools.createTextDoc(m_xMSF);
+ m_TmpDir = util.utils.getOfficeTemp/*Dir*/(m_xMSF);
+ log.println("tempdir: " + m_TmpDir);
+ }
+
+ public void after()
+ {
+ if (m_xDoc != null) {
+ util.DesktopTools.closeDoc(m_xDoc);
+ m_xDoc = null;
+ }
+ }
+
+ public void testText() throws Exception
+ {
+ TreeNode root = new TreeNode();
+ TreeNode text = new TextNode("abc");
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ public void testTextField() throws Exception
+ {
+ String name = mkName("ruby");
+ TreeNode root = new TreeNode();
+ TreeNode txtf = new TextFieldNode("abc");
+ root.appendChild(txtf);
+ doTest(root);
+ }
+
+ public void testControlChar() throws Exception
+ {
+//FIXME this is converted to a text portion: ControlCharacter is obsolete
+ TreeNode root = new TreeNode();
+ TreeNode cchr = new ControlCharacterNode(HARD_HYPHEN);
+ root.appendChild(cchr);
+ doTest(root);
+ }
+
+ public void testSoftPageBreak() throws Exception
+ {
+//FIXME: insert a soft page break: not done
+ TreeNode root = new TreeNode();
+ TreeNode spbk = new SoftPageBreakNode();
+ TreeNode text = new TextNode("abc");
+ root.appendChild(spbk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ public void testFootnote() throws Exception
+ {
+ String name = mkName("ftn");
+ TreeNode root = new TreeNode();
+ TreeNode ftnd = new FootnoteNode(name);
+ root.appendChild(ftnd);
+ doTest(root);
+ }
+
+ public void testFrameAs() throws Exception
+ {
+ String name = mkName("frame");
+ TreeNode root = new TreeNode();
+ TreeNode fram = new FrameNode(name, AS_CHARACTER);
+ root.appendChild(fram);
+ doTest(root);
+ }
+
+ public void testFrameAt() throws Exception
+ {
+ String name = mkName("frame");
+ TreeNode root = new TreeNode();
+// TreeNode text = new TextNode(""); // necessary?
+ TreeNode fram = new FrameNode(name, AT_CHARACTER);
+// root.appendChild(text);
+ root.appendChild(fram);
+ doTest(root);
+ }
+
+ public void testBookmarkPoint() throws Exception
+ {
+ String name = mkName("mark");
+ TreeNode root = new TreeNode();
+ TreeNode bkmk = new BookmarkNode(name);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(bkmk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ public void testBookmark() throws Exception
+ {
+ String name = mkName("mark");
+ TreeNode root = new TreeNode();
+ TreeNode bkm1 = new BookmarkStartNode(name);
+ TreeNode text = new TextNode("abc");
+ TreeNode bkm2 = new BookmarkEndNode(name);
+ root.appendChild(bkm1);
+ root.appendChild(text);
+ root.appendChild(bkm2);
+ doTest(root);
+ }
+
+ public void testBookmarkPointXmlId() throws Exception
+ {
+ String name = mkName("mark");
+ StringPair id = mkId("id");
+ TreeNode root = new TreeNode();
+ TreeNode bkmk = new BookmarkNode(name, id);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(bkmk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ public void testBookmarkXmlId() throws Exception
+ {
+ String name = mkName("mark");
+ StringPair id = mkId("id");
+ TreeNode root = new TreeNode();
+ TreeNode bkm1 = new BookmarkStartNode(name, id);
+ TreeNode text = new TextNode("abc");
+ TreeNode bkm2 = new BookmarkEndNode(name, id);
+ root.appendChild(bkm1);
+ root.appendChild(text);
+ root.appendChild(bkm2);
+ doTest(root);
+ }
+
+ public void testRefmarkPoint() throws Exception
+ {
+ String name = mkName("refmark");
+ TreeNode root = new TreeNode();
+ TreeNode rfmk = new ReferenceMarkNode(name);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(rfmk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ public void testRefmark() throws Exception
+ {
+ String name = mkName("refmark");
+ TreeNode root = new TreeNode();
+ TreeNode rfm1 = new ReferenceMarkStartNode(name);
+ TreeNode text = new TextNode("abc");
+ TreeNode rfm2 = new ReferenceMarkEndNode(name);
+ root.appendChild(rfm1);
+ root.appendChild(text);
+ root.appendChild(rfm2);
+ doTest(root);
+ }
+
+ public void testToxmarkPoint() throws Exception
+ {
+ String name = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ TreeNode txmk = new DocumentIndexMarkNode(name);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(txmk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ public void testToxmark() throws Exception
+ {
+ String name = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ TreeNode txm1 = new DocumentIndexMarkStartNode(name);
+ TreeNode text = new TextNode("abc");
+ TreeNode txm2 = new DocumentIndexMarkEndNode(name);
+ root.appendChild(txm1);
+ root.appendChild(text);
+ root.appendChild(txm2);
+ doTest(root);
+ }
+
+ public void testHyperlink() throws Exception
+ {
+ String name = mkName("url");
+ TreeNode root = new TreeNode();
+ TreeNode href = new HyperlinkNode(name);
+ TreeNode text = new TextNode("abc");
+ href.appendChild(text);
+ root.appendChild(href);
+ doTest(root);
+ }
+
+ public void testHyperlinkEmpty() throws Exception
+ {
+ String name = mkName("url");
+ TreeNode root = new TreeNode();
+ TreeNode href = new HyperlinkNode(name);
+ TreeNode text = new TextNode("");
+ href.appendChild(text);
+ root.appendChild(href);
+ doTest(root);
+ }
+
+ public void testRuby() throws Exception
+ {
+ String name = mkName("ruby");
+ TreeNode root = new TreeNode();
+ TreeNode ruby = new RubyNode(name);
+ TreeNode text = new TextNode("abc");
+ ruby.appendChild(text);
+ root.appendChild(ruby);
+ doTest(root);
+ }
+
+ public void testRubyEmpty() throws Exception
+ {
+ // BUG: #i91534#
+ String name = mkName("ruby");
+ TreeNode root = new TreeNode();
+ TreeNode ruby = new RubyNode(name);
+ root.appendChild(ruby);
+ doTest(root);
+ }
+
+ public void testMeta() throws Exception
+ {
+ StringPair id = new StringPair("content.xml", mkName("id"));
+ TreeNode root = new TreeNode();
+ TreeNode meta = new MetaNode(id);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(new TextNode("123"));
+ meta.appendChild(text);
+ root.appendChild(meta);
+ doTest(root);
+ }
+
+ public void testMetaEmpty() throws Exception
+ {
+ StringPair id = new StringPair("content.xml", mkName("id"));
+ TreeNode root = new TreeNode();
+ TreeNode meta = new MetaNode(id);
+// TreeNode text = new TextNode("");
+// meta.appendChild(text);
+ root.appendChild(meta);
+ doTest(root);
+ }
+
+ public void testMetaField() throws Exception
+ {
+ StringPair id = new StringPair("content.xml", mkName("id"));
+ TreeNode root = new TreeNode();
+ TreeNode meta = new MetaFieldNode(id);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(new TextNode("123"));
+ meta.appendChild(text);
+ root.appendChild(meta);
+ doTest(root);
+ }
+
+ public void testMetaFieldEmpty() throws Exception
+ {
+ StringPair id = new StringPair("content.xml", mkName("id"));
+ TreeNode root = new TreeNode();
+ TreeNode meta = new MetaFieldNode(id);
+// TreeNode text = new TextNode("");
+// meta.appendChild(text);
+ root.appendChild(meta);
+ doTest(root);
+ }
+
+ public void testBookmark1() throws Exception
+ {
+ String name1 = mkName("mark");
+ String name2 = mkName("mark");
+ String name3 = mkName("mark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new BookmarkNode(name2) );
+ root.appendChild( new BookmarkStartNode(name3) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new BookmarkEndNode(name3) );
+ doTest(root);
+ }
+
+ public void testBookmark2() throws Exception
+ {
+ String name1 = mkName("mark");
+ String name2 = mkName("mark");
+ String name3 = mkName("mark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name2) );
+ root.appendChild( new BookmarkStartNode(name3) );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new BookmarkEndNode(name3) );
+ doTest(root);
+ }
+
+ public void testRefMark2() throws Exception
+ {
+ String name1 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ // BUG: #i102541# (this is actually not unoportenum's fault)
+ root.appendChild( new ReferenceMarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ doTest(root);
+ }
+
+ public void testRefMark3() throws Exception
+ {
+ String name1 = mkName("refmark");
+ String name2 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkStartNode(name1) );
+ root.appendChild( new ReferenceMarkStartNode(name2) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new ReferenceMarkEndNode(name2) );
+ root.appendChild( new ReferenceMarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ doTest(root);
+ }
+
+ public void testToxMark2() throws Exception
+ {
+ String name1 = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new DocumentIndexMarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new DocumentIndexMarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ doTest(root);
+ }
+
+ public void testToxMark3() throws Exception
+ {
+ String name1 = mkName("toxmark");
+ String name2 = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new DocumentIndexMarkStartNode(name1) );
+ root.appendChild( new DocumentIndexMarkStartNode(name2) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new DocumentIndexMarkEndNode(name2) );
+ root.appendChild( new DocumentIndexMarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ doTest(root);
+ }
+
+ public void testMarks1() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("refmark");
+ String name4 = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new ReferenceMarkStartNode(name3) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new DocumentIndexMarkStartNode(name4) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new DocumentIndexMarkEndNode(name4) );
+ root.appendChild( new ReferenceMarkEndNode(name3) );
+ doTest(root);
+ }
+
+ public void testMarks2() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("refmark");
+ String name3 = mkName("refmark");
+ String name4 = mkName("toxmark");
+ String name5 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new ReferenceMarkNode(name2) );
+ root.appendChild( new ReferenceMarkStartNode(name3) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new DocumentIndexMarkStartNode(name4) );
+ root.appendChild( new ReferenceMarkStartNode(name5) );
+ // BUG: #i102541# (this is actually not unoportenum's fault)
+ root.appendChild( new ReferenceMarkEndNode(name3) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new DocumentIndexMarkEndNode(name4) );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new ReferenceMarkEndNode(name5) );
+ doTest(root);
+ }
+
+ public void testMarks3() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("refmark");
+ String name3 = mkName("refmark");
+ String name4 = mkName("toxmark");
+ String name5 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new DocumentIndexMarkStartNode(name3) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new ReferenceMarkStartNode(name4) );
+ root.appendChild( new DocumentIndexMarkStartNode(name5) );
+ root.appendChild( new DocumentIndexMarkEndNode(name3) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new ReferenceMarkEndNode(name4) );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new DocumentIndexMarkEndNode(name5) );
+ doTest(root);
+ }
+
+ public void testFrameMark1() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name1) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new FrameNode(name2, AS_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testFrameMark2() throws Exception
+ {
+ // BUG: #i98530#
+ String name1 = mkName("bookmark");
+ String name2 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name1) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testFrameMark3() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("bookmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new FrameNode(name1, AS_CHARACTER) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new BookmarkNode(name2) );
+ doTest(root);
+ }
+
+ public void testFrameMark4() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("bookmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new BookmarkNode(name2) );
+ doTest(root);
+ }
+
+ public void testFrames1() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testFrames2() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AS_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AS_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AS_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testFrames3() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AS_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testFrames4() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AS_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testFrames5() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AS_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testRubyHyperlink1() throws Exception
+ {
+ String name1 = mkName("ruby");
+ String name2 = mkName("url");
+ TreeNode root = new TreeNode();
+ TreeNode ruby = new RubyNode(name1);
+ TreeNode href = new HyperlinkNode(name2);
+ href.appendChild( new TextNode("abc") );
+ ruby.appendChild(href);
+ root.appendChild(ruby);
+ doTest(root);
+ }
+
+ public void testRubyHyperlink2() throws Exception
+ {
+ String name1 = mkName("url");
+ String name2 = mkName("ruby");
+ TreeNode root = new TreeNode();
+ TreeNode href = new HyperlinkNode(name1);
+ TreeNode ruby = new RubyNode(name2);
+ ruby.appendChild( new TextNode("abc") );
+ href.appendChild(ruby);
+ root.appendChild(href);
+ doTest(root);
+ }
+
+ public void testEnd1() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new ReferenceMarkNode(name3) );
+ doTest(root);
+ }
+
+ public void testEnd2() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("frame");
+ String name3 = mkName("refmark");
+ String name4 = mkName("frame");
+ String name5 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name1) );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ root.appendChild( new ReferenceMarkNode(name3) );
+ root.appendChild( new FrameNode(name4, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name5, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testEnd3() throws Exception
+ {
+ String name1 = mkName("ftn");
+ String name2 = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new FootnoteNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ doTest(root);
+ }
+
+ public void testEnd4() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new FrameNode(name2, AS_CHARACTER) );
+ root.appendChild( new BookmarkEndNode(name1) );
+ doTest(root);
+ }
+
+ public void testEnd5() throws Exception
+ {
+ String name1 = mkName("refmark");
+ String name2 = mkName("ruby");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ TreeNode ruby = new RubyNode(name2);
+ ruby.appendChild( new TextFieldNode("de") );
+ root.appendChild(ruby);
+ root.appendChild( new ReferenceMarkEndNode(name1) );
+ doTest(root);
+ }
+
+ public void testEmpty1() throws Exception
+ {
+ String name1 = mkName("refmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("bookmark");
+ String name4 = mkName("frame");
+ String name7 = mkName("refmark");
+ String name8 = mkName("toxmark");
+ String name9 = mkName("bookmark");
+ String nameA = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new BookmarkNode(name3) );
+ root.appendChild( new FrameNode(name4, AT_CHARACTER) );
+ root.appendChild( new ReferenceMarkNode(name7) );
+ root.appendChild( new DocumentIndexMarkNode(name8) );
+ root.appendChild( new BookmarkNode(name9) );
+ root.appendChild( new FrameNode(nameA, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testEmpty2() throws Exception
+ {
+ String name3 = mkName("bookmark");
+ String name4 = mkName("frame");
+ String name9 = mkName("bookmark");
+ String nameA = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkNode(name3) );
+ root.appendChild( new FrameNode(name4, AT_CHARACTER) );
+ root.appendChild( new BookmarkNode(name9) );
+ root.appendChild( new FrameNode(nameA, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ public void testEmpty3() throws Exception
+ {
+ String name1 = mkName("refmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("bookmark");
+ String name4 = mkName("frame");
+ String name5 = mkName("url");
+ String name6 = mkName("ruby");
+ String name7 = mkName("refmark");
+ String name8 = mkName("toxmark");
+ String name9 = mkName("bookmark");
+ String nameA = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new BookmarkNode(name3) );
+ root.appendChild( new FrameNode(name4, AT_CHARACTER) );
+ /* currently empty hyperlinks may get eaten...
+ TreeNode href = new HyperlinkNode(name5);
+ href.appendChild( new TextNode("") );
+ root.appendChild(href);
+ */
+ TreeNode ruby = new RubyNode(name6);
+ root.appendChild(ruby);
+ root.appendChild( new ReferenceMarkNode(name7) );
+ root.appendChild( new DocumentIndexMarkNode(name8) );
+ root.appendChild( new BookmarkNode(name9) );
+ root.appendChild( new FrameNode(nameA, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ public void test1() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("bookmark");
+ String name3 = mkName("ruby");
+ String name4 = mkName("ftn");
+ String name5 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new BookmarkStartNode(name2) );
+ root.appendChild( new TextNode("abc") );
+ TreeNode ruby = new RubyNode(name3);
+ ruby.appendChild( new TextNode("de") );
+ ruby.appendChild( new FootnoteNode(name4) );
+ ruby.appendChild( new BookmarkEndNode(name2) );
+ root.appendChild(ruby);
+ root.appendChild( new TextNode("fg") );
+ root.appendChild( new FrameNode(name5, AT_CHARACTER) );
+ root.appendChild( new TextFieldNode("h") );
+ doTest(root);
+ }
+
+ /* some range tests for the insertion: these are for the current
+ API which treats hyperlinks and rubys not as entities, but as formatting
+ attributes; if these ever become entities, they should not be split!
+ */
+
+ public void testRange1() throws Exception
+ {
+ String name1 = mkName("url");
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("12345");
+ inserter.insertRange(new Range(0, 0, text));
+ TreeNode url1 = new HyperlinkNode(name1);
+ Range range1 = new Range(0, 5, url1);
+ inserter.insertRange(range1);
+ TreeNode root = new TreeNode();
+ root.appendChild( url1 );
+ url1.appendChild( text );
+ doTest(root, false);
+ }
+
+ public void testRangeHyperlinkHyperlink() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode url1 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 4, url1) );
+ // overlap left
+ TreeNode url2 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(0, 2, url2) );
+ TreeNode root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode url3 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(3, 7, url3) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( url3.dup().appendChild( new TextNode("4567") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // around
+ TreeNode url4 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(3, 7, url4) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( url4.dup().appendChild( new TextNode("4567") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(4, 6, url5) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( url4.dup().appendChild( new TextNode("4") ) )
+ .appendChild( url5.dup().appendChild( new TextNode("56") ) )
+ .appendChild( url4.dup().appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ }
+
+ public void testRangeHyperlinkRuby() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode url1 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 4, url1) );
+ // overlap left
+ TreeNode rby2 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 2, rby2) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( url1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(3, 5, rby3) );
+ root = new TreeNode()
+ .appendChild( rby2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( rby3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // around
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(2, 3, rby4) );
+ root = new TreeNode()
+ .appendChild( rby2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( rby4.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( rby3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(6, 9, url5) );
+ TreeNode rby6 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7, 8, rby6) );
+ root = new TreeNode()
+ .appendChild( rby2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( rby4.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( rby3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") )
+ .appendChild( url5.dup().appendChild( new TextNode("7") ) )
+ .appendChild( rby6.dup()
+ .appendChild( url5.dup().appendChild( new TextNode("8") ) ) )
+ .appendChild( url5.dup().appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ public void testRangeRubyHyperlink() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(1, 6, rby1) );
+ // overlap left
+ TreeNode url2 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(0, 3, url2) );
+ TreeNode root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby1.dup()
+ .appendChild( url2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode url3 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(5, 7, url3) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby1.dup()
+ .appendChild( url2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("45") )
+ .appendChild( url3.dup().appendChild( new TextNode("6") ) ) )
+ .appendChild( url3.dup().appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // around (not quite, due to API)
+ TreeNode url4 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 8, url4) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby1.dup()
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("23456") ) ) )
+ .appendChild( url4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(3, 5, url5) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby1.dup()
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("23") ) )
+ .appendChild( url5.dup()
+ .appendChild( new TextNode("45") ) )
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( url4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ }
+
+ public void testRangeRubyRuby() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(1, 4, rby1) );
+ // overlap left
+ TreeNode rby2 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 2, rby2) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(3, 7, rby3) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( rby3.dup().appendChild( new TextNode("4567") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // around
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(3, 7, rby4) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( rby4.dup().appendChild( new TextNode("4567") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // inside
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(4, 6, rby5) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( rby4.dup().appendChild( new TextNode("4") ) )
+ .appendChild( rby5.dup().appendChild( new TextNode("56") ) )
+ .appendChild( rby4.dup().appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ }
+
+ public void testRangeHyperlinkMeta() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode url1 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 4, url1) );
+ // overlap left
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(0, 2, met2) );
+ TreeNode root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( url1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, met3) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( met3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // around
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 4/*-1*/, met4) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( met4.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( met3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(9/*-3*/, 12/*-3*/, url5) );
+ TreeNode met6 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(10/*-3*/, 11/*-3*/, met6) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( met4.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( met3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") )
+ .appendChild( url5.dup().appendChild( new TextNode("7") ) )
+ .appendChild( met6.dup()
+ .appendChild( url5.dup().appendChild( new TextNode("8") ) ) )
+ .appendChild( url5.dup().appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ public void testRangeRubyMeta() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(1, 4, rby1) );
+ // overlap left
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(0, 2, met2) );
+ TreeNode root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, met3) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( met3.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // around
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 4/*-1*/, met4) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( met4.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( met3.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // inside
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(9/*-3*/, 12/*-3*/, rby5) );
+ TreeNode met6 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(10/*-3*/, 11/*-3*/, met6) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( met4.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( met3.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("7") )
+ .appendChild( met6.dup()
+ .appendChild( new TextNode("8") ) )
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ public void testRangeMetaHyperlink() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 6, met1) );
+ // overlap left
+ TreeNode url2 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(0, 4/*-1*/, url2) );
+ TreeNode root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( url2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode url3 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(6/*-1*/, 8/*-1*/, url3) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( url2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("45") )
+ .appendChild( url3.dup().appendChild( new TextNode("6") ) ) )
+ .appendChild( url3.dup().appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // around (not quite, due to API)
+ TreeNode url4 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 9/*-1*/, url4) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("23456") ) ) )
+ .appendChild( url4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, url5) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("23") ) )
+ .appendChild( url5.dup()
+ .appendChild( new TextNode("45") ) )
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( url4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ }
+
+ public void testRangeMetaRuby() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 5, met1) );
+ // overlap left
+ TreeNode rby2 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 3/*-1*/, rby2) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( rby2.dup().appendChild( new TextNode("2") ) )
+ .appendChild( new TextNode("345") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(5/*-1*/, 7/*-1*/, rby3) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( rby2.dup().appendChild( new TextNode("2") ) )
+ .appendChild( new TextNode("34") )
+ .appendChild( rby3.dup().appendChild( new TextNode("5") ) ) )
+ .appendChild( rby3.dup().appendChild( new TextNode("6") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // around
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(1, 7/*-1*/, rby4) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2345") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // inside
+ TreeNode met5 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(7/*-1*/, 9/*-1*/, met5) );
+ TreeNode rby6 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(9/*-2*/, 10/*-2*/, rby6) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2345") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( met5.dup()
+ .appendChild( new TextNode("7") )
+ .appendChild( rby6.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // inside, with invalid range that includes the dummy char
+ TreeNode rby7 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7/*-1*/, 9/*-2*/, rby7) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2345") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( met5.dup()
+ .appendChild( rby7.dup()
+ .appendChild( new TextNode("7") ) )
+ .appendChild( rby6.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // around, at same position as meta
+ TreeNode rby8 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7/*-1*/, 10/*-2*/, rby8) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2345") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( rby8.dup()
+ .appendChild( met5.dup()
+ .appendChild( new TextNode("78") ) ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ }
+
+ public void testRangeMetaMeta() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3, 6, met1) );
+ // overlap left
+ TreeNode met2 = new MetaNode( mkId("id") );
+ try {
+ inserter.insertRange( new Range(0, 4, met2) );
+ assure("testRangeMetaMeta: overlap left allowed", false);
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("123") )
+ .appendChild( met1.dup().appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode met3 = new MetaNode( mkId("id") );
+ try {
+ inserter.insertRange( new Range(5/*-1*/, 8/*-1*/, met3) );
+ assure("testRangeMetaMeta: overlap right allowed", false);
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+ root = new TreeNode()
+ .appendChild( new TextNode("123") )
+ .appendChild( met1.dup().appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // around
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3, 7/*-1*/, met4) );
+ root = new TreeNode()
+ .appendChild( new TextNode("123") )
+ .appendChild( met4.dup()
+ .appendChild( met1.dup().appendChild( new TextNode("456") ) ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // inside
+ TreeNode met5 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(6/*-2*/, 8/*-2*/, met5) );
+ root = new TreeNode()
+ .appendChild( new TextNode("123") )
+ .appendChild( met4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("4") )
+ .appendChild( met5.dup()
+ .appendChild( new TextNode("56") ) ) ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ }
+
+ public void testRange2() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 8, met1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 8/*-1*/, met2) );
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(5/*-2*/, 8/*-2*/, met3) );
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("3") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("8") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // split ruby at every meta start!
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 7/*-3*/, rby4) );
+ root = new TreeNode()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("2") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("3") ) )
+ .appendChild( met3.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("56") ) )
+ .appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("8") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // split ruby at every meta end!
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(8/*-3*/, 12/*-3*/, rby5) );
+ root = new TreeNode()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("2") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("3") ) )
+ .appendChild( met3.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("7") ) ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ public void testRange3() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 9, rby1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(2, 7, met2) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("12") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("34567") ) )
+ .appendChild( new TextNode("89") ) );
+ doTest(root, false);
+ // overwrite outer ruby, split remains at inner meta!
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(5/*-1*/, 6/*-1*/, rby3) );
+ root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("12") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("34") ) )
+ .appendChild( rby3.dup()
+ .appendChild( new TextNode("5") ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("67") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("89") ) );
+ doTest(root, false);
+ }
+
+ public void testRange4() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 9, rby1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 8, met2) );
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 8/*-1*/, met3) );
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(5/*-2*/, 8/*-2*/, met4) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("2") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("3") )
+ .appendChild( met4.dup()
+ .appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("8") ) )
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ // overwrite outer ruby, split remains at every inner meta!
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7/*-3*/, 8/*-3*/, rby5) );
+ root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("2") ) )
+ .appendChild( met3.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("3") ) )
+ .appendChild( met4.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("4") ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("5") ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("7") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ public void testRange5() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 9, rby1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 3, met2) );
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(5/*-1*/, 6/*-1*/, met3) );
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(8/*-2*/, 10/*-2*/, met4) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( met2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("4") )
+ .appendChild( met3.dup().appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") )
+ .appendChild( met4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ // overwrite outer ruby, but split at inner metas!
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(3/*-1*/, 10/*-3*/, rby5) );
+ root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("2") ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("3") ) ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("4") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( met4.dup()
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("7") ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ public void testRange6() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 5, met1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 6/*-1*/, met2) );
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(5/*-2*/, 7/*-2*/, met3) );
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("3") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("45") ) ) ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // split at 3 metas, all at same position
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7/*-3*/, 10/*-3*/, rby4) );
+ root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("3") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("4") )
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("5") ) ) ) ) )
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("67") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ }
+
+ public void testRange7() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode url1 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 5, url1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3, 5, met2) );
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("23") ) )
+ .appendChild( met2.dup()
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("45") ) ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // this should result in not splitting the hyperlink, but due to API
+ // we can't tell :(
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(5/*-1*/, 8/*-1*/, rby3) );
+ root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("23") ) )
+ .appendChild( met2.dup()
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("4") ) )
+ .appendChild( rby3.dup()
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("5") ) ) ) )
+ .appendChild( rby3.dup()
+ .appendChild( new TextNode("67") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ }
+
+ /* TODO: test partial selection, test UNDO/REDO */
+
+ /** test SwXMeta XText interface */
+ public void testMetaXText() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("12AB6789");
+ inserter.insertRange( new Range(0, 0, text) );
+ MetaNode meta = new MetaNode( mkId("id") );
+// inserter.insertRange( new Range(3, 5, met2) );
+ XTextContent xMeta = inserter.makeMeta();
+
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)3, false);
+ xDocTextCursor.goRight((short)2, true);
+ xDocText.insertTextContent(xDocTextCursor, xMeta, true);
+// xMeta.attach(xDocTextCursor);
+
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMeta);
+ xMetadatable.setMetadataReference(meta.getXmlId());
+ XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta);
+
+ XText xParentText = xText.getText();
+ assure("getText(): no parent", xParentText != null);
+
+ XTextRange xStart = xText.getStart();
+ assure("getStart(): no start", xStart != null);
+
+ XTextRange xEnd = xText.getEnd();
+ assure("getEnd(): no end", xEnd != null);
+
+ /*
+ String string = xText.getString();
+ assure("getString(): invalid string returned",
+ string != null && "AB".equals(string) );
+ */
+
+ xText.setString("45");
+
+ {
+ String string = xText.getString();
+ assure("getString(): invalid string returned: " + string,
+ string != null && "45".equals(string) );
+ }
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ assure("createTextCursor(): failed", xTextCursor != null);
+
+ try {
+ xText.createTextCursorByRange(null);
+ assure("createTextCursorByRange(): null allowed?", false);
+ } catch (RuntimeException e) { /* expected */ }
+
+ XTextCursor xTextCursorStart = xText.createTextCursorByRange(xStart);
+ assure("createTextCursorByRange(): failed for start",
+ xTextCursorStart != null);
+
+ XTextCursor xTextCursorEnd = xText.createTextCursorByRange(xEnd);
+ assure("createTextCursorByRange(): failed for end",
+ xTextCursorEnd != null);
+
+ // move outside meta
+ xDocTextCursor.gotoStart(false);
+
+ try {
+ xText.insertString(null, "foo", false);
+ assure("insertString(): null allowed?", false);
+ } catch (RuntimeException e) { /* expected */ }
+
+ try {
+ xText.insertString(xDocTextCursor, "foo", false);
+ assure("insertString(): cursor outside allowed?", false);
+ } catch (RuntimeException e) { /* expected */ }
+
+ xStart = xText.getStart();
+ xText.insertString(xStart, "A", false);
+ {
+ String string = xText.getString();
+ assure("getString(): invalid string returned: " + string,
+ string != null && "A45".equals(string) );
+ }
+
+ xText.insertString(xEnd, "B", false);
+ {
+ String string = xText.getString();
+ assure("getString(): invalid string returned: " + string,
+ string != null && "A45B".equals(string) );
+ }
+
+ try {
+ xText.insertControlCharacter(null, HARD_HYPHEN, false);
+ assure("insertControlCharacter(): null allowed?", false);
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ xStart = xText.getStart();
+ try {
+ xText.insertControlCharacter(xDocTextCursor, HARD_HYPHEN, false);
+ assure("insertControlCharacter(): cursor outside allowed?", false);
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ xText.insertControlCharacter(xStart, HARD_HYPHEN, false);
+ {
+ String string = xText.getString();
+ assure("getString(): invalid string returned: " + string,
+ string != null && ('\u2011' + "A45B").equals(string) );
+ }
+
+ xText.insertControlCharacter(xEnd, HARD_HYPHEN, false);
+ {
+ String string = xText.getString();
+ assure("getString(): invalid string returned: " + string,
+ string != null &&
+ ('\u2011' + "A45B" + '\u2011').equals(string) );
+ }
+
+ xText.setString("45");
+
+ try {
+ xText.insertTextContent(null, xMeta, false);
+ assure("insertTextContent(): null range allowed?", false);
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ try {
+ xText.insertTextContent(xStart, null, false);
+ assure("insertTextContent(): null content allowed?", false);
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ try {
+ xText.insertTextContent(xDocTextCursor, xMeta, false);
+ assure("insertTextContent(): cursor outside allowed?", false);
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ TextFieldNode field1 = new TextFieldNode( "f1" );
+ TextFieldNode field2 = new TextFieldNode( "f2" );
+ XTextContent xField1 = inserter.makeTextField(field1.getContent());
+ XTextContent xField2 = inserter.makeTextField(field2.getContent());
+
+ xStart = xText.getStart();
+ xText.insertTextContent(xStart, xField1, false);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( meta.dup()
+ .appendChild( field1.dup() )
+ .appendChild( new TextNode("45") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+
+ xText.insertTextContent(xEnd, xField2, false);
+
+ root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( meta.dup()
+ .appendChild( field1.dup() )
+ .appendChild( new TextNode("45") )
+ .appendChild( field2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+
+ try {
+ xText.removeTextContent(null);
+ assure("removeTextContent(): null content allowed?", false);
+ } catch (RuntimeException e) { /* expected */ }
+
+ xText.removeTextContent(xField1);
+
+ XTextRange xAnchor = xMeta.getAnchor();
+ assure("getAnchor(): null", xAnchor != null);
+
+ // evil test case: insert ruby around meta
+ RubyNode ruby = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(2, 6, ruby) );
+
+ /* prevent caching...
+ root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( ruby.dup()
+ .appendChild( meta.dup()
+ .appendChild( new TextNode("45") )
+ .appendChild( field2.dup() ) ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ */
+
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
+ XEnumeration xEnum = xEA.createEnumeration();
+ assure("createEnumeration(): returns null", xEnum != null);
+ {
+ assure("hasNext(): first missing", xEnum.hasMoreElements());
+ Object xElement = xEnum.nextElement();
+ XTextRange xPortion = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, xElement);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xPortion);
+ String type = (String) xPropSet.getPropertyValue("TextPortionType");
+ assure("first: not text", type.equals("Text"));
+ String txt = xPortion.getString();
+ assure("first: text differs: " + txt, "45".equals(txt));
+ }
+ {
+ assure("hasNext(): second missing", xEnum.hasMoreElements());
+ Object xElement = xEnum.nextElement();
+ XTextRange xPortion = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, xElement);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xPortion);
+ String type = (String) xPropSet.getPropertyValue("TextPortionType");
+ assure("second: not text", type.equals("TextField"));
+ }
+ // no ruby end here!!!
+ assure("hasNext(): more elements?", !xEnum.hasMoreElements());
+
+ XComponent xComponent = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xMeta);
+ xComponent.dispose();
+
+ try {
+ XTextCursor xCursor = xText.createTextCursor();
+ assure("createTextCursor(): succeeds on disposed object?",
+ xCursor == null);
+ } catch (RuntimeException e) { /* expected */ }
+ }
+
+ /** check that cursor move methods move to positions in the meta,
+ but do not move to positions outside the meta. */
+ public void testMetaXTextCursor() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("Text. 12 More text here.");
+ inserter.insertRange( new Range(0, 0, text) );
+ MetaNode met1 = new MetaNode( mkId("id") );
+ XTextContent xMeta = inserter.makeMeta();
+
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)7, false);
+ xDocTextCursor.goRight((short)2, true);
+ xDocText.insertTextContent(xDocTextCursor, xMeta, true);
+ xDocTextCursor.gotoStart(true);
+
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMeta);
+ xMetadatable.setMetadataReference(met1.getXmlId());
+ XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta);
+
+ XTextRange xStart = xText.getStart();
+ assure("getStart(): no start", xStart != null);
+ XTextRange xEnd = xText.getEnd();
+ assure("getEnd(): no end", xEnd != null);
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ assure("createTextCursor(): no cursor", xTextCursor != null);
+
+ // XTextCursor
+ boolean bSuccess = false;
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(false);
+ bSuccess = xTextCursor.goLeft((short)1, false);
+ assure("goLeft(): failed", bSuccess);
+ bSuccess = xTextCursor.goLeft((short)1000, false);
+ assure("goLeft(): succeeded", !bSuccess);
+ bSuccess = xTextCursor.goRight((short)1, false);
+ assure("goRight(): failed", bSuccess);
+ bSuccess = xTextCursor.goRight((short)1000, false);
+ assure("goRight(): succeeded", !bSuccess);
+ xTextCursor.gotoRange(xStart, false);
+ xTextCursor.gotoRange(xEnd, false);
+ try {
+ xTextCursor.gotoRange(xDocTextCursor, false);
+ assure("gotoRange(): succeeded", false);
+ } catch (RuntimeException e) { /* expected */ }
+
+ // XWordCursor
+ xText.setString("Two words");
+ xTextCursor.gotoStart(false);
+ XWordCursor xWordCursor = (XWordCursor)
+ UnoRuntime.queryInterface(XWordCursor.class, xTextCursor);
+
+ bSuccess = xWordCursor.gotoNextWord(true);
+ assure("gotoNextWord(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assure("gotoNextWord(): wrong string: " + string,
+ "Two ".equals(string));
+ }
+ bSuccess = xWordCursor.gotoNextWord(false);
+ assure("gotoNextWord(): succeeded", !bSuccess);
+ xTextCursor.collapseToEnd();
+ bSuccess = xWordCursor.gotoPreviousWord(true);
+ assure("gotoPreviousWord(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assure("gotoPreviousWord(): wrong string: " + string,
+ "words".equals(string));
+ }
+ bSuccess = xWordCursor.gotoPreviousWord(false);
+ assure("gotoPreviousWord(): succeeded", !bSuccess);
+ bSuccess = xWordCursor.gotoEndOfWord(true);
+ assure("gotoEndOfWord(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assure("gotoEndOfWord(): wrong string: " + string,
+ "Two".equals(string));
+ }
+ xTextCursor.gotoEnd(false);
+ bSuccess = xWordCursor.gotoStartOfWord(true);
+ assure("gotoStartOfWord(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assure("gotoStartOfWord(): wrong string: " + string,
+ "words".equals(string));
+ }
+ xText.setString("");
+ bSuccess = xWordCursor.gotoEndOfWord(false);
+ assure("gotoEndOfWord(): succeeded", !bSuccess);
+ bSuccess = xWordCursor.gotoStartOfWord(false);
+ assure("gotoStartOfWord(): succeeded", !bSuccess);
+
+ // XSentenceCursor
+ xText.setString("This is a sentence. Another sentence.");
+ xTextCursor.gotoStart(false);
+ XSentenceCursor xSentenceCursor = (XSentenceCursor)
+ UnoRuntime.queryInterface(XSentenceCursor.class, xTextCursor);
+
+ bSuccess = xSentenceCursor.gotoNextSentence(true);
+ assure("gotoNextSentence(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assure("gotoNextSentence(): wrong string: " + string,
+ "This is a sentence. ".equals(string));
+ }
+ bSuccess = xSentenceCursor.gotoNextSentence(false);
+ assure("gotoNextSentence(): succeeded", !bSuccess);
+ // FIXME:
+ // the sentence cursor seems to work differently than the word cursor
+ xText.setString("This is a sentence. Another sentence. Sentence 3.");
+ xTextCursor.gotoEnd(false);
+ bSuccess = xSentenceCursor.gotoPreviousSentence(true);
+ assure("gotoPreviousSentence(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assure("gotoPreviousSentence(): wrong string: " + string,
+ "Another sentence. Sentence 3.".equals(string));
+ }
+ bSuccess = xSentenceCursor.gotoPreviousSentence(false);
+ assure("gotoPreviousSentence(): succeeded", !bSuccess);
+ bSuccess = xSentenceCursor.gotoEndOfSentence(true);
+ assure("gotoEndOfSentence(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assure("gotoEndOfSentence(): wrong string: " + string,
+ "This is a sentence.".equals(string));
+ }
+ xTextCursor.gotoEnd(false);
+ bSuccess = xSentenceCursor.gotoStartOfSentence(true);
+ assure("gotoStartOfSentence(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assure("gotoStartOfSentence(): wrong string: " + string,
+ "Sentence 3.".equals(string));
+ }
+ xText.setString("");
+ bSuccess = xSentenceCursor.gotoEndOfSentence(false);
+ assure("gotoEndOfSentence(): succeeded", !bSuccess);
+ bSuccess = xSentenceCursor.gotoStartOfSentence(false);
+ assure("gotoStartOfSentence(): succeeded", !bSuccess);
+
+ XParagraphCursor xParagraphCursor = (XParagraphCursor)
+ UnoRuntime.queryInterface(XParagraphCursor.class, xTextCursor);
+
+ // XParagraphCursor (does not make sense)
+ bSuccess = xParagraphCursor.gotoNextParagraph(false);
+ assure("gotoNextParagraph(): succeeded", !bSuccess);
+ bSuccess = xParagraphCursor.gotoPreviousParagraph(false);
+ assure("gotoPreviousParagraph(): succeeded", !bSuccess);
+ bSuccess = xParagraphCursor.gotoStartOfParagraph(false);
+ assure("gotoStartOfParagraph(): succeeded", !bSuccess);
+ bSuccess = xParagraphCursor.gotoEndOfParagraph(false);
+ assure("gotoEndOfParagraph(): succeeded", !bSuccess);
+ }
+
+
+ abstract class AttachHelper
+ {
+ abstract boolean isAttribute();
+ abstract TreeNode mkTreeNode();
+ abstract XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception;
+ void postInserted(TreeNode node, XTextContent xContent)
+ throws Exception { }
+ }
+
+ public void testMetaXTextAttachToxMark() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return true; }
+ TreeNode mkTreeNode() {
+ return new DocumentIndexMarkNode( mkName("toxmark") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeDocumentIndexMark(
+ ((DocumentIndexMarkNode)node).getName());
+ }
+ });
+ }
+
+ public void testMetaXTextAttachRefMark() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return true; }
+ TreeNode mkTreeNode() {
+ return new ReferenceMarkNode( mkName("refmark") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeReferenceMark(
+ ((ReferenceMarkNode)node).getName());
+ }
+ });
+ }
+
+ public void testMetaXTextAttachTextField() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return false; }
+ TreeNode mkTreeNode() {
+ return new TextFieldNode( mkName("field") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeTextField(
+ ((TextFieldNode)node).getContent());
+ }
+ });
+ }
+
+ public void testMetaXTextAttachFootnote() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return false; }
+ TreeNode mkTreeNode() {
+ return new FootnoteNode( mkName("ftn") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeFootnote(
+ ((FootnoteNode)node).getLabel());
+ }
+ });
+ }
+
+ public void testMetaXTextAttachMeta() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return true; }
+ TreeNode mkTreeNode() {
+ return new MetaNode( mkId("id") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeMeta();
+ }
+ void postInserted(TreeNode node, XTextContent xContent)
+ throws Exception {
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xContent);
+ xMetadatable.setMetadataReference(
+ ((MetaNode)node).getXmlId());
+ }
+ });
+ }
+
+ void doMetaXTextAttach(AttachHelper helper) throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("12AB6789");
+ inserter.insertRange( new Range(0, 0, text) );
+ MetaNode met1 = new MetaNode( mkId("id") );
+ XTextContent xMeta = inserter.makeMeta();
+
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)3, false);
+ xDocTextCursor.goRight((short)2, true);
+ xDocText.insertTextContent(xDocTextCursor, xMeta, true);
+
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMeta);
+ xMetadatable.setMetadataReference(met1.getXmlId());
+ XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta);
+ XTextRange xStart = null;
+ XTextRange xEnd = null;
+
+ {
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ // insertTextContent with meta getStart()/getEnd()
+ xText.insertTextContent(xStart, xContent1, false);
+ xText.insertTextContent(xEnd , xContent2, false);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ {
+ xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xTextCursor.gotoStart(false);
+
+ // insertTextContent with meta cursor
+ xText.insertTextContent(xTextCursor, xContent1, false);
+ xTextCursor.gotoEnd(false);
+ xText.insertTextContent(xTextCursor, xContent2, false);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ if (!helper.isAttribute())
+ {
+// xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xTextCursor.gotoStart(false);
+ xTextCursor.goRight((short)1, true);
+
+ // insertTextContent with meta cursor and absorb
+ xText.insertTextContent(xTextCursor, xContent1, true);
+ xTextCursor.gotoEnd(false);
+ xTextCursor.goLeft((short)1, true);
+ xText.insertTextContent(xTextCursor, xContent2, true);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ {
+ xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ xDocTextCursor.gotoRange(xStart, false);
+
+ // insertTextContent with document cursor
+ xText.insertTextContent(xDocTextCursor, xContent1, false);
+ xDocTextCursor.gotoRange(xEnd, false);
+ xText.insertTextContent(xDocTextCursor, xContent2, false);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ if (!helper.isAttribute())
+ {
+// xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ xDocTextCursor.gotoRange(xStart, false);
+ xDocTextCursor.goRight((short)1, true);
+
+ // insertTextContent with document cursor and absorb
+ xText.insertTextContent(xDocTextCursor, xContent1, true);
+ xDocTextCursor.gotoRange(xEnd, false);
+ xDocTextCursor.goLeft((short)1, true);
+ xText.insertTextContent(xDocTextCursor, xContent2, true);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ {
+ xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ // attach to range from meta getStart()/getEnd()
+ xContent1.attach(xStart);
+ xContent2.attach(xEnd);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ {
+ xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xTextCursor.gotoStart(false);
+
+ // attach to cursor from meta XText
+ xContent1.attach(xTextCursor);
+ xTextCursor.gotoEnd(false);
+ xContent2.attach(xTextCursor);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ }
+
+ public void testMetaFieldXTextField() throws Exception
+ {
+ com.sun.star.rdf.XRepositorySupplier xModel =
+ (com.sun.star.rdf.XRepositorySupplier) UnoRuntime.queryInterface(
+ com.sun.star.rdf.XRepositorySupplier.class, m_xDoc);
+ com.sun.star.rdf.XRepository xRepo = xModel.getRDFRepository();
+ // for testing just add it to the first graph
+ com.sun.star.rdf.XURI[] Graphs = xRepo.getGraphNames();
+ com.sun.star.rdf.XNamedGraph xGraph = xRepo.getGraph(Graphs[0]);
+ com.sun.star.rdf.XURI xOdfPrefix =
+ com.sun.star.rdf.URI.createKnown(m_xContext,
+ com.sun.star.rdf.URIs.ODF_PREFIX);
+ com.sun.star.rdf.XURI xOdfSuffix =
+ com.sun.star.rdf.URI.createKnown(m_xContext,
+ com.sun.star.rdf.URIs.ODF_SUFFIX);
+ com.sun.star.rdf.XNode xPrefix =
+ com.sun.star.rdf.Literal.create(m_xContext, "foo");
+ com.sun.star.rdf.XNode xSuffix =
+ com.sun.star.rdf.Literal.create(m_xContext, "bar");
+
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("abc");
+ inserter.insertRange( new Range(0, 0, text) );
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)1, false);
+ xDocTextCursor.goRight((short)3, true);
+
+ XTextField xMetaField = inserter.makeMetaField();
+
+ xDocText.insertTextContent(xDocTextCursor, xMetaField, true);
+
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMetaField);
+ xMetadatable.ensureMetadataReference();
+
+ xGraph.addStatement(xMetadatable, xOdfPrefix, xPrefix);
+ xGraph.addStatement(xMetadatable, xOdfSuffix, xSuffix);
+ assure("getPresentation(): wrong",
+ "fooabcbar".equals(xMetaField.getPresentation(false)));
+ inserter.insertRange( new Range(0, 0, text) );
+ }
+
+ public void testMetaFieldXPropertySet() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123");
+ inserter.insertRange( new Range(0, 0, text) );
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)1, false);
+ xDocTextCursor.goRight((short)3, true);
+
+ XTextField xMetaField = inserter.makeMetaField();
+
+ xDocText.insertTextContent(xDocTextCursor, xMetaField, true);
+
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xMetaField);
+ assure("PropertySet: not supported?", xPropertySet != null);
+ XPropertySetInfo xPropertySetInfo = xPropertySet.getPropertySetInfo();
+ assure("hasPropertyByName(\"NumberFormat\"):",
+ xPropertySetInfo.hasPropertyByName("NumberFormat"));
+ assure("hasPropertyByName(\"IsFixedLanguage\"):",
+ xPropertySetInfo.hasPropertyByName("IsFixedLanguage"));
+
+ int def = (Integer) xPropertySet.getPropertyValue("NumberFormat");
+ log.println("NumberFormat: default is " + def);
+ short INT = com.sun.star.i18n.NumberFormatIndex.NUMBER_INT;
+ xPropertySet.setPropertyValue("NumberFormat", INT);
+ xPropertySet.setPropertyValue("IsFixedLanguage", true);
+ int format = (Integer) xPropertySet.getPropertyValue("NumberFormat");
+ assure("NumberFormat: failed", format == INT);
+ boolean isFixed = (Boolean)
+ xPropertySet.getPropertyValue("IsFixedLanguage");
+ assure("IsFixedLanguage: failed", isFixed);
+ }
+
+ public void testLoadStore() throws Exception
+ {
+ XComponent xComp = null;
+ String filename = "TESTMETA.odt";
+ String file;
+ try {
+ file = util.utils.getFullTestURL(filename);
+ xComp = doLoad(file);
+ if (xComp != null)
+ {
+ file = m_TmpDir + filename;
+ doStore(xComp, file);
+ close(xComp);
+ xComp = doLoad(file);
+ }
+ } finally {
+ close(xComp);
+ }
+ }
+
+ private void doStore(XComponent xComp, String file) throws Exception
+ {
+ log.println("Storing test document...");
+
+ XStorable xStor = (XStorable) UnoRuntime.queryInterface(
+ XStorable.class, xComp);
+
+ xStor.storeToURL(file, new PropertyValue[0]);
+
+ log.println("...done");
+ }
+
+ public XComponent doLoad(String file) throws Exception
+ {
+ XComponent xComp = null;
+
+ log.println("Loading test document...");
+
+ PropertyValue[] loadProps = new PropertyValue[1];
+ loadProps[0] = new PropertyValue();
+ loadProps[0].Name = "Hidden";
+ loadProps[0].Value = new Boolean(true);
+
+ xComp = util.DesktopTools.loadDoc(m_xMSF, file, loadProps);
+// xComp = util.DesktopTools.getCLoader(m_xMSF).loadComponentFromURL(file, "_blank", 0, loadProps);
+
+
+ XTextDocument xTextDoc = (XTextDocument)
+ UnoRuntime.queryInterface(XTextDocument.class, xComp);
+
+ XText xText = xTextDoc.getText();
+
+ log.println("...done");
+
+ log.println("Checking meta(-field)s in loaded test document...");
+
+ TreeNode root = new TreeNode()
+ .appendChild( new RubyNode("ruby1")
+ .appendChild( new TextNode("1") ) )
+ .appendChild( new MetaNode(mkId_("id1"))
+ .appendChild( new TextNode("2") ) )
+ .appendChild( new MetaFieldNode(mkId_("id2"))
+ .appendChild( new TextNode("3") ) )
+ .appendChild( new RubyNode("ruby2")
+ .appendChild( new MetaNode(mkId_("id3"))
+ .appendChild( new TextNode("4") ) ) )
+ .appendChild( new RubyNode("ruby3")
+ .appendChild( new MetaFieldNode(mkId_("id4"))
+ .appendChild( new TextNode("5") ) ) )
+ .appendChild( new MetaNode(mkId_("id5"))
+ .appendChild( new RubyNode("ruby4")
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( new MetaFieldNode(mkId_("id6"))
+ .appendChild( new RubyNode("ruby5")
+ .appendChild( new TextNode("7") ) ) )
+ .appendChild( new MetaNode(mkId_("id7"))
+ .appendChild( new MetaNode(mkId_("id8"))
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( new MetaNode(mkId_("id9"))
+ .appendChild( new MetaFieldNode(mkId_("id10"))
+ .appendChild( new TextNode("9") ) ) )
+ .appendChild( new MetaFieldNode(mkId_("id11"))
+ .appendChild( new MetaNode(mkId_("id12"))
+ .appendChild( new TextNode("10") ) ) )
+ .appendChild( new MetaFieldNode(mkId_("id13"))
+ .appendChild( new MetaFieldNode(mkId_("id14"))
+ .appendChild( new TextNode("11") ) ) )
+ .appendChild( new MetaNode(mkId_("id15"))
+ .appendChild( new RubyNode("ruby6")
+ .appendChild( new MetaFieldNode(mkId_("id16"))
+ .appendChild( new TextNode("12") ) ) ) )
+ .appendChild( new MetaNode(mkId_("")) {
+ public boolean equals(Object other) {
+ return (other instanceof MetaNode);
+ } }
+ .appendChild( new TextNode("13") ) )
+ .appendChild( new TextNode(" X X ") );
+ doTest(xTextDoc, root, false);
+
+ log.println("...done");
+
+ return xComp;
+ }
+
+ static void close(XComponent i_comp)
+ {
+ try {
+ XCloseable xClos = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, i_comp);
+ if (xClos != null) xClos.close(true);
+ } catch (Exception e) {
+ }
+ }
+
+ private void doTest(TreeNode intree) throws Exception
+ {
+ doTest(m_xDoc, intree, true);
+ }
+
+ private void doTest(TreeNode intree, boolean insert) throws Exception
+ {
+ doTest(m_xDoc, intree, insert);
+ }
+
+ private void doTest(XTextDocument xDoc, TreeNode intree,
+ boolean insert) throws Exception
+ {
+ dumpTree(intree, "I: ");
+
+ if (insert) {
+ new TreeInserter(xDoc).insertTree(intree);
+ }
+
+//Thread.sleep(10000);
+
+ XText xText = xDoc.getText();
+ XEnumerationAccess xTextEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xText);
+ XEnumeration xTextEnum = xTextEA.createEnumeration();
+ // skip to right paragraph
+ xTextEnum.nextElement(); // skip first -- always empty!
+ Object xElement = xTextEnum.nextElement(); // second contains test case
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xElement);
+ XEnumeration xEnum = xEA.createEnumeration();
+ TreeNode outtree = new EnumConverter(this).convert(xEnum);
+
+ dumpTree(outtree, "O: ");
+
+ boolean success = new FuzzyTester(log).doTest(intree, outtree);
+ assure("test failed", success);
+ }
+
+ private void dumpTree(TreeNode tree) { dumpTree(tree, "> "); }
+
+ private void dumpTree(TreeNode tree, String prefix)
+ {
+ log.println(prefix + tree.toString());
+ TreeNodeEnum children = tree.createEnumeration();
+ while (children.hasNext()) {
+ TreeNode node = children.next();
+ dumpTree(node, prefix + " ");
+ }
+ }
+
+ private String mkName(String prefix)
+ {
+ return prefix + String.valueOf(m_Count++);
+ }
+
+ private StringPair mkId(String prefix)
+ {
+ return new StringPair("content.xml", mkName(prefix));
+ }
+
+ private StringPair mkId_(String id)
+ {
+ return new StringPair("content.xml", id);
+ }
+
+ public void assure(String str, boolean cond) { super.assure(str, cond); }
+}
+
diff --git a/sw/qa/complex/writer/makefile.mk b/sw/qa/complex/writer/makefile.mk
index 7bcc7fe934c9..de5200d47142 100755
--- a/sw/qa/complex/writer/makefile.mk
+++ b/sw/qa/complex/writer/makefile.mk
@@ -41,7 +41,7 @@ PACKAGE = complex$/writer
#----- compile .java files -----------------------------------------
JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
-JAVAFILES = CheckIndexedPropertyValues.java CheckNamedPropertyValues.java CheckCrossReferences.java CheckBookmarks.java CheckFlies.java
+JAVAFILES = CheckIndexedPropertyValues.java CheckNamedPropertyValues.java CheckCrossReferences.java CheckBookmarks.java CheckFlies.java TextPortionEnumerationTest.java
JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
#----- make a jar from compiled files ------------------------------
@@ -85,7 +85,9 @@ run: \
CheckCrossReferences \
CheckIndexedPropertyValues \
CheckNamedPropertyValues \
- CheckFlies
+ CheckFlies \
+ TextPortionEnumerationTest \
+
RUN: run
@@ -105,3 +107,6 @@ CheckBookmarks:
CheckFlies:
+java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) -tdoc $(PWD)$/testdocuments $(CT_PACKAGE).CheckFlies
+TextPortionEnumerationTest:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) -tdoc $(PWD)$/testdocuments $(CT_PACKAGE).TextPortionEnumerationTest
+
diff --git a/sw/qa/complex/writer/testdocuments/TESTMETA.odt b/sw/qa/complex/writer/testdocuments/TESTMETA.odt
new file mode 100755
index 000000000000..004af82e5ddf
--- /dev/null
+++ b/sw/qa/complex/writer/testdocuments/TESTMETA.odt
Binary files differ
diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi
index 9b5f411ffd28..e1249a337ee8 100755
--- a/sw/sdi/_annotsh.sdi
+++ b/sw/sdi/_annotsh.sdi
@@ -93,7 +93,6 @@ interface _Annotation
[
ExecMethod = ExecClpbrd ;
StateMethod = StateClpbrd ;
- Volatile ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
@@ -101,7 +100,6 @@ interface _Annotation
[
ExecMethod = ExecClpbrd ;
StateMethod = StateClpbrd ;
- Volatile ;
]
SID_PASTE // api:
@@ -111,7 +109,7 @@ interface _Annotation
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
- FN_PASTESPECIAL // api:
+ SID_PASTE_SPECIAL // api:
[
StateMethod = StateClpbrd ;
ExecMethod = ExecClpbrd ;
diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi
index 50b85eddfab6..882104509b9e 100644
--- a/sw/sdi/_basesh.sdi
+++ b/sw/sdi/_basesh.sdi
@@ -95,7 +95,6 @@ interface BaseTextSelection
[
ExecMethod = ExecClpbrd ;
StateMethod = StateClpbrd ;
- Volatile;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
@@ -103,7 +102,6 @@ interface BaseTextSelection
[
ExecMethod = ExecClpbrd ;
StateMethod = StateClpbrd ;
- Volatile;
]
SID_PASTE // status(final|play)
@@ -127,7 +125,7 @@ interface BaseTextSelection
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
- FN_PASTESPECIAL // status(final|play)
+ SID_PASTE_SPECIAL // status(final|play)
[
ExecMethod = ExecClpbrd ;
StateMethod = StateClpbrd ;
diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi
index 6dfd2c78bd47..9154e6ce2578 100644
--- a/sw/sdi/_docsh.sdi
+++ b/sw/sdi/_docsh.sdi
@@ -133,6 +133,7 @@ interface BaseTextDocument : OfficeDocument
ExecMethod = Execute;
StateMethod = GetState;
]
+
FN_PRINT_LAYOUT
[
ExecMethod = Execute;
diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi
index 8f6eb837af86..0da76e212df1 100644
--- a/sw/sdi/drwtxtsh.sdi
+++ b/sw/sdi/drwtxtsh.sdi
@@ -43,7 +43,6 @@ interface TextDrawText
[
ExecMethod = ExecClpbrd ;
StateMethod = StateClpbrd ;
- Volatile ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
@@ -51,7 +50,6 @@ interface TextDrawText
[
ExecMethod = ExecClpbrd ;
StateMethod = StateClpbrd ;
- Volatile ;
]
SID_PASTE // api:
@@ -61,7 +59,7 @@ interface TextDrawText
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
- FN_PASTESPECIAL // api:
+ SID_PASTE_SPECIAL // api:
[
StateMethod = StateClpbrd ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
diff --git a/sw/sdi/makefile.mk b/sw/sdi/makefile.mk
index 1a3f17a6c69d..25b75feea040 100644
--- a/sw/sdi/makefile.mk
+++ b/sw/sdi/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -38,20 +38,20 @@ PRJNAME=sw
TARGET=swslots
# --- Settings -----------------------------------------------------
-
+.IF "$(L10N_framework)"==""
SVSDIINC=$(PRJ)$/source$/ui$/inc
+.ENDIF
.INCLUDE : $(PRJ)$/inc$/swpre.mk
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/inc$/sw.mk
-
+.IF "$(L10N_framework)"==""
SDI1NAME=$(TARGET)
SDI1EXPORT=swriter
#SIDHRCNAME=swslots.hrc
# --- Files --------------------------------------------------------
-
SVSDI1DEPEND= \
switems.sdi\
swriter.sdi\
@@ -97,7 +97,9 @@ SVSDI1DEPEND= \
annotsh.sdi\
swslots.hrc \
$(INC)$/globals.hrc \
- $(INC)$/cmdid.h
+ $(INC)$/cmdid.h \
+ $(SOLARINCXDIR)$/svxslots.ilb
+.ENDIF
# --- Targets -------------------------------------------------------
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 784100694d4a..315d34197715 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -821,7 +821,7 @@ SfxVoidItem ChangeDatabaseField FN_CHANGE_DBFIELD
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = TRUE,
@@ -1759,7 +1759,7 @@ SfxVoidItem ExecuteMacroField FN_EXECUTE_MACROFIELD
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -1809,7 +1809,7 @@ SfxVoidItem FieldDialog FN_EDIT_FIELD
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = TRUE,
@@ -4370,7 +4370,7 @@ SfxVoidItem InsertMultiIndex FN_INSERT_MULTI_TOX
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = TRUE,
@@ -6509,31 +6509,6 @@ SfxVoidItem PageUpSel FN_PAGEUP_SEL
]
//--------------------------------------------------------------------------
-SfxInt16Item PasteSpecial FN_PASTESPECIAL
-()
-[
- /* flags: */
- AutoUpdate = FALSE,
- Cachable = Volatile,
- FastCall = TRUE,
- HasCoreId = FALSE,
- HasDialog = TRUE,
- ReadOnlyDoc = FALSE,
- Toggle = FALSE,
- Container = FALSE,
- RecordAbsolute = FALSE,
- RecordPerSet;
- Asynchron;
-
- /* config: */
- AccelConfig = TRUE,
- MenuConfig = TRUE,
- StatusBarConfig = FALSE,
- ToolBoxConfig = TRUE,
- GroupId = GID_EDIT;
-]
-
-//--------------------------------------------------------------------------
SfxVoidItem PreviewPrintOptions FN_PREVIEW_PRINT_OPTIONS
()
[
@@ -6592,7 +6567,7 @@ SfxBoolItem PrintLayout FN_PRINT_LAYOUT
[
/* flags: */
AutoUpdate = TRUE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -6873,7 +6848,7 @@ SfxBoolItem Ruler FN_RULER
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -7052,7 +7027,7 @@ SfxUInt16Item SelectionMode FN_STAT_SELMODE
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -7419,7 +7394,7 @@ SfxVoidItem SetOptimalColumnWidth FN_TABLE_ADJUST_CELLS
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -7930,7 +7905,7 @@ SfxStringItem StatePageNumber FN_STAT_PAGE
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -8708,7 +8683,7 @@ SfxBoolItem ViewBounds FN_VIEW_BOUNDS
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
diff --git a/sw/sdi/viewsh.sdi b/sw/sdi/viewsh.sdi
index 18d537144c5b..05b41e6e7482 100644
--- a/sw/sdi/viewsh.sdi
+++ b/sw/sdi/viewsh.sdi
@@ -158,9 +158,17 @@ shell SwView : SfxViewShell
interface TextPrintPreview : View
[ uuid = "1622A480-111A-101D-9757-6E74207A7520" ]
{
+ SID_BROWSER_MODE
+ [
+ StateMethod = GetState;
+ ]
+ FN_PRINT_LAYOUT
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
FN_REFRESH_VIEW // status(final|play)
[
- ExecMethod = Execute ;
StateMethod = GetState ;
]
FN_CHAR_LEFT // status(final|play)
diff --git a/sw/sdi/wdocsh.sdi b/sw/sdi/wdocsh.sdi
index fb704c8c19b4..e2efd025c1df 100644
--- a/sw/sdi/wdocsh.sdi
+++ b/sw/sdi/wdocsh.sdi
@@ -38,7 +38,6 @@ interface WebDocument : BaseTextDocument
[
ExecMethod = Execute ;
StateMethod = GetState ;
- Volatile = TRUE;
Asynchron = TRUE;
]
diff --git a/sw/sdi/wviewsh.sdi b/sw/sdi/wviewsh.sdi
index e38e99246a36..3eff3db1f4a0 100644
--- a/sw/sdi/wviewsh.sdi
+++ b/sw/sdi/wviewsh.sdi
@@ -144,7 +144,6 @@ interface WebSourceView : View
[
ExecMethod = Execute ;
StateMethod = GetState ;
- Volatile;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
@@ -152,7 +151,6 @@ interface WebSourceView : View
[
ExecMethod = Execute ;
StateMethod = GetState ;
- Volatile;
]
SID_PASTE // status(final|play)
@@ -187,6 +185,14 @@ interface WebSourceView : View
[
StateMethod = GetState ;
]
+ SID_BROWSER_MODE
+ [
+ StateMethod = GetState;
+ ]
+ FN_PRINT_LAYOUT
+ [
+ StateMethod = GetState;
+ ]
}
shell SwSrcView : SfxViewShell
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 42b164185fbb..ced1e6261c7b 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -668,8 +668,8 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
// now ask the Break-Iterator for the word
DBG_ASSERT( pBreakIt != NULL, "We always need a break." );
- DBG_ASSERT( pBreakIt->xBreak.is(), "No break-iterator." );
- if( pBreakIt->xBreak.is() )
+ DBG_ASSERT( pBreakIt->GetBreakIter().is(), "No break-iterator." );
+ if( pBreakIt->GetBreakIter().is() )
{
// get locale for this position
USHORT nModelPos = GetPortionData().GetModelPosition( nPos );
@@ -681,7 +681,7 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
const USHORT nWordType = WordType::ANY_WORD;
// get word boundary, as the Break-Iterator sees fit.
- rBound = pBreakIt->xBreak->getWordBoundary(
+ rBound = pBreakIt->GetBreakIter()->getWordBoundary(
rText, nPos, aLocale, nWordType, sal_True );
// It's a word if the first character is an alpha-numeric character.
@@ -748,8 +748,8 @@ sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
// ask the Break-Iterator for the glyph by moving one cell
// forward, and then one cell back
DBG_ASSERT( pBreakIt != NULL, "We always need a break." );
- DBG_ASSERT( pBreakIt->xBreak.is(), "No break-iterator." );
- if( pBreakIt->xBreak.is() )
+ DBG_ASSERT( pBreakIt->GetBreakIter().is(), "No break-iterator." );
+ if( pBreakIt->GetBreakIter().is() )
{
// get locale for this position
USHORT nModelPos = GetPortionData().GetModelPosition( nPos );
@@ -759,9 +759,9 @@ sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
// get word boundary, as the Break-Iterator sees fit.
const USHORT nIterMode = CharacterIteratorMode::SKIPCELL;
sal_Int32 nDone = 0;
- rBound.endPos = pBreakIt->xBreak->nextCharacters(
+ rBound.endPos = pBreakIt->GetBreakIter()->nextCharacters(
rText, nPos, aLocale, nIterMode, 1, nDone );
- rBound.startPos = pBreakIt->xBreak->previousCharacters(
+ rBound.startPos = pBreakIt->GetBreakIter()->previousCharacters(
rText, rBound.endPos, aLocale, nIterMode, 1, nDone );
DBG_ASSERT( rBound.startPos <= nPos, "start pos too high" );
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index fb80f040bdd0..48f4b23136b9 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -489,8 +489,8 @@ void SwAccessiblePortionData::GetSentenceBoundary(
if( pSentences == NULL )
{
DBG_ASSERT( pBreakIt != NULL, "We always need a break." );
- DBG_ASSERT( pBreakIt->xBreak.is(), "No break-iterator." );
- if( pBreakIt->xBreak.is() )
+ DBG_ASSERT( pBreakIt->GetBreakIter().is(), "No break-iterator." );
+ if( pBreakIt->GetBreakIter().is() )
{
pSentences = new Positions_t();
pSentences->reserve(10);
@@ -505,7 +505,7 @@ void SwAccessiblePortionData::GetSentenceBoundary(
USHORT nModelPos = GetModelPosition( nCurrent );
- sal_Int32 nNew = pBreakIt->xBreak->endOfSentence(
+ sal_Int32 nNew = pBreakIt->GetBreakIter()->endOfSentence(
sAccessibleString, nCurrent,
pBreakIt->GetLocale(pTxtNode->GetLang(nModelPos)) ) + 1;
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index 1dd1616df3b7..4d51a36bfb5d 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -74,18 +74,18 @@ SwBreakIt::SwBreakIt(
aForbiddenLang( LANGUAGE_DONTKNOW)
{
DBG_ASSERT( m_xMSF.is(), "SwBreakIt: no MultiServiceFactory" );
- if ( m_xMSF.is() )
- {
- xBreak = uno::Reference< i18n::XBreakIterator >(
- m_xMSF->createInstance(
- rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),
- uno::UNO_QUERY);
-
- xCTLDetect = uno::Reference< i18n::XScriptTypeDetector >(
- m_xMSF->createInstance(
- rtl::OUString::createFromAscii( "com.sun.star.i18n.ScriptTypeDetector" ) ),
- uno::UNO_QUERY);
- }
+ //if ( m_xMSF.is() )
+ //{
+ // xBreak = uno::Reference< i18n::XBreakIterator >(
+ // m_xMSF->createInstance(
+ // rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),
+ // uno::UNO_QUERY);
+
+ // xCTLDetect = uno::Reference< i18n::XScriptTypeDetector >(
+ // m_xMSF->createInstance(
+ // rtl::OUString::createFromAscii( "com.sun.star.i18n.ScriptTypeDetector" ) ),
+ // uno::UNO_QUERY);
+ // }
}
SwBreakIt::~SwBreakIt()
@@ -93,7 +93,16 @@ SwBreakIt::~SwBreakIt()
delete m_pLocale;
delete m_pForbidden;
}
-
+void SwBreakIt::createBreakIterator() const
+{
+ if ( m_xMSF.is() && !xBreak.is() )
+ xBreak.set(m_xMSF->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator"))),uno::UNO_QUERY);
+}
+void SwBreakIt::createScriptTypeDetector()
+{
+ if ( m_xMSF.is() && !xCTLDetect.is() )
+ xCTLDetect.set(m_xMSF->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.ScriptTypeDetector" ))),uno::UNO_QUERY);
+}
void SwBreakIt::_GetLocale( const LanguageType aLang )
{
aLast = aLang;
@@ -113,6 +122,7 @@ void SwBreakIt::_GetForbidden( const LanguageType aLang )
USHORT SwBreakIt::GetRealScriptOfText( const String& rTxt,
xub_StrLen nPos ) const
{
+ createBreakIterator();
USHORT nScript = i18n::ScriptType::WEAK;
if( xBreak.is() && rTxt.Len() )
{
@@ -151,6 +161,7 @@ USHORT SwBreakIt::GetAllScriptsOfText( const String& rTxt ) const
const USHORT coAllScripts = ( SCRIPTTYPE_LATIN |
SCRIPTTYPE_ASIAN |
SCRIPTTYPE_COMPLEX );
+ createBreakIterator();
USHORT nRet = 0, nScript;
if( !xBreak.is() )
nRet = coAllScripts;
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 2e14358afc5f..aba5dbc74283 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -273,7 +273,7 @@ SwCalc::SwCalc( SwDoc& rD )
:
aErrExpr( aEmptyStr, SwSbxValue(), 0 ),
rDoc( rD ),
- pLclData( &GetAppLocaleData() ),
+ pLclData( &SvtSysLocale().GetLocaleData() ),
pCharClass( &GetAppCharClass() ),
nListPor( 0 ),
eError( CALC_NOERR )
@@ -422,7 +422,7 @@ SwCalc::~SwCalc()
{
for( USHORT n = 0; n < TBLSZ; ++n )
delete VarTable[n];
- if( pLclData != &GetAppLocaleData() )
+ if( pLclData != &SvtSysLocale().GetLocaleData() )
delete pLclData;
if( pCharClass != &GetAppCharClass() )
delete pCharClass;
@@ -1622,7 +1622,7 @@ BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
{
const LocaleDataWrapper* pLclD = pLclData;
if( !pLclD )
- pLclD = &GetAppLocaleData();
+ pLclD = &SvtSysLocale().GetLocaleData();
const xub_Unicode nCurrCmdPos = rCommandPos;
rtl_math_ConversionStatus eStatus;
@@ -1634,7 +1634,7 @@ BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
&eStatus, &pEnd );
rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
- if( !pLclData && pLclD != &GetAppLocaleData() )
+ if( !pLclData && pLclD != &SvtSysLocale().GetLocaleData() )
delete (LocaleDataWrapper*)pLclD;
return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
@@ -1643,7 +1643,7 @@ BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
double& rVal, SwDoc* pDoc )
{
- const LocaleDataWrapper* pLclD = &GetAppLocaleData();
+ const LocaleDataWrapper* pLclD = &SvtSysLocale().GetLocaleData();
if( pDoc )
{
@@ -1664,7 +1664,7 @@ BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
&eStatus, &pEnd );
rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
- if( pLclD != &GetAppLocaleData() )
+ if( pLclD != &SvtSysLocale().GetLocaleData() )
delete (LocaleDataWrapper*)pLclD;
return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 63b4f56b1cbd..cecbb7308f49 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -328,10 +328,10 @@ SwIndexReg::~SwIndexReg()
-void SwIndexReg::Update( const SwIndex& rIdx, xub_StrLen nDiff, BOOL bNeg,
- BOOL /* argument is only used in derived class*/ )
+void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff,
+ const bool bNeg, const bool /* argument is only used in derived class*/ )
{
- SwIndex* pStt = (SwIndex*)&rIdx;
+ SwIndex* pStt = const_cast<SwIndex*>(&rIdx);
xub_StrLen nNewVal = rIdx.nIndex;
if( bNeg )
{
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 9563a51324bb..9f275aa09ed3 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -46,9 +46,7 @@
#include <svx/shaditem.hxx>
#include <svx/prntitem.hxx>
#include <svx/brkitem.hxx>
-#ifndef _SVX_TSTPITEM_HXX
#include <svx/tstpitem.hxx>
-#endif
#include <svx/langitem.hxx>
#include <svx/wrlmitem.hxx>
#include <svx/kernitem.hxx>
@@ -62,13 +60,9 @@
#include <svx/lspcitem.hxx>
#include <svx/blnkitem.hxx>
#include <svx/akrnitem.hxx>
-#ifndef _SVX_EMPHITEM_HXX
#include <svx/emphitem.hxx>
-#endif
#include <svx/twolinesitem.hxx>
-#ifndef _SVX_SCRIPSPACEITEM_HXX
#include <svx/scriptspaceitem.hxx>
-#endif
#include <svx/hngpnctitem.hxx>
#include <svx/cmapitem.hxx>
#include <svx/charscaleitem.hxx>
@@ -94,7 +88,6 @@
#include <unotools/transliterationwrapper.hxx>
#include <svx/acorrcfg.hxx>
#include <vcl/svapp.hxx>
-#include <fmthbsh.hxx>
#include <fmtanchr.hxx>
#include <fmtornt.hxx>
#include <fmtsrnd.hxx>
@@ -116,9 +109,7 @@
#include <fmtautofmt.hxx>
#include <fmtinfmt.hxx>
#include <fmtcnct.hxx>
-#ifndef _FMTLINE_HXX
#include <fmtline.hxx>
-#endif
#include <fmtftntx.hxx>
#include <fmtruby.hxx>
#include <fmtautofmt.hxx>
@@ -137,9 +128,7 @@
#include <doc.hxx>
#include <acmplwrd.hxx>
#include <fmtclbl.hxx>
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
#include <breakit.hxx>
#include <checkit.hxx>
#include <swcalwrp.hxx>
@@ -150,6 +139,9 @@
// OD 2004-05-05 #i28701#
#include <fmtwrapinfluenceonobjpos.hxx>
+#include <fmtmeta.hxx>
+
+
using namespace ::com::sun::star;
extern void _FrmFinit();
@@ -319,22 +311,22 @@ SfxItemInfo __FAR_DATA aSlotTab[] =
{ 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY1
{ 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY2
- { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_AUTOFMT
- { FN_TXTATR_INET, 0 }, // RES_TXTATR_INETFMT
{ 0, 0 }, // RES_TXTATR_REFMARK
{ 0, 0 }, // RES_TXTATR_TOXMARK
+ { 0, 0 }, // RES_TXTATR_META
+ { 0, 0 }, // RES_TXTATR_METAFIELD
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_AUTOFMT
+ { FN_TXTATR_INET, 0 }, // RES_TXTATR_INETFMT
{ 0, 0 }, // RES_TXTATR_CHARFMT
+ { SID_ATTR_CHAR_CJK_RUBY, 0 }, // RES_TXTATR_CJK_RUBY
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_UNKNOWN_CONTAINER
{ 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_DUMMY4
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY3
{ 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY1
{ 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY2
@@ -467,14 +459,18 @@ SwAutoCompleteWord* SwDoc::pACmpltWords = 0;
SwCheckIt* pCheckIt = 0;
CharClass* pAppCharClass = 0;
-SwCalendarWrapper* pCalendarWrapper = 0;
+
CollatorWrapper* pCollator = 0, *pCaseCollator = 0;
::utl::TransliterationWrapper* pTransWrp = 0;
/******************************************************************************
* void _InitCore()
******************************************************************************/
-
+salhelper::SingletonRef<SwCalendarWrapper>* s_getCalendarWrapper()
+{
+ static salhelper::SingletonRef<SwCalendarWrapper> aCalendarWrapper;
+ return &aCalendarWrapper;
+}
void _InitCore()
{
SfxPoolItem* pItem;
@@ -540,19 +536,19 @@ void _InitCore()
aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 );
aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFmtRuby( aEmptyStr );
aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] = new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER );
+ aAttrTab[ RES_TXTATR_META - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_META);
+ aAttrTab[ RES_TXTATR_METAFIELD - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_METAFIELD);
aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld;
aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 );
aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn;
- aAttrTab[ RES_TXTATR_SOFTHYPH- POOLATTR_BEGIN ] = new SwFmtSoftHyph;
- aAttrTab[ RES_TXTATR_HARDBLANK- POOLATTR_BEGIN ] = new SwFmtHardBlank( ' ', FALSE );
// TextAttr - Dummies
+ aAttrTab[ RES_TXTATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY4 );
+ aAttrTab[ RES_TXTATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY3 );
aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 );
aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 );
- aAttrTab[ RES_TXTATR_DUMMY6 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY6 );
- aAttrTab[ RES_TXTATR_DUMMY7 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY7 );
// TextAttr - Dummies
aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
@@ -740,9 +736,9 @@ void _InitCore()
SwBreakIt::_Create( xMSF );
pCheckIt = NULL;
- pAppCharClass = new CharClass(
- xMSF, SwBreakIt::Get()->GetLocale( (LanguageType)GetAppLanguage() ));
- pCalendarWrapper = new SwCalendarWrapper( xMSF );
+ /*pAppCharClass = new CharClass(
+ xMSF, SwBreakIt::Get()->GetLocale( (LanguageType)GetAppLanguage() ));*/
+ //pCalendarWrapper = new SwCalendarWrapper( xMSF );
_FrmInit();
_TextInit();
@@ -773,7 +769,6 @@ void _FinitCore()
SwBreakIt::_Delete();
delete pCheckIt;
delete pAppCharClass;
- delete pCalendarWrapper;
delete pCollator;
delete pCaseCollator;
@@ -856,16 +851,15 @@ void _FinitCore()
// returns the APP - CharClass instance - used for all ToUpper/ToLower/...
CharClass& GetAppCharClass()
{
+ if ( !pAppCharClass )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ pAppCharClass = new CharClass(
+ xMSF, SwBreakIt::Get()->GetLocale( (LanguageType)GetAppLanguage() ));
+ }
return *pAppCharClass;
}
-LocaleDataWrapper& GetAppLocaleData()
-{
- SvtSysLocale aSysLocale;
- return (LocaleDataWrapper&)aSysLocale.GetLocaleData();
-}
-
-
void SwCalendarWrapper::LoadDefaultCalendar( USHORT eLang )
{
sUniqueId.Erase();
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 3179e3fb3330..3cdfa7ec03e4 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -42,8 +42,10 @@
#include <svx/linkmgr.hxx>
#include <swtypes.hxx>
#include <undobj.hxx>
+#include <unoobj.hxx>
#include <rtl/random.h>
+
SV_IMPL_REF( SwServerObject )
using namespace ::sw::mark;
@@ -85,9 +87,13 @@ namespace
const SwPaM aEndPaM(rEnd);
io_pDoc->StartUndo(UNDO_UI_REPLACE, NULL);
if(ch_start != aStartMark)
- io_pDoc->Insert(aStartPaM, aStartMark);
+ {
+ io_pDoc->InsertString(aStartPaM, aStartMark);
+ }
if(aEndMark && ch_end != aEndMark)
- io_pDoc->Insert(aEndPaM, aEndMark);
+ {
+ io_pDoc->InsertString(aEndPaM, aEndMark);
+ }
io_pDoc->EndUndo(UNDO_UI_REPLACE, NULL);
};
}
@@ -190,6 +196,7 @@ namespace sw { namespace mark
const ::rtl::OUString& rName,
const ::rtl::OUString& rShortName)
: DdeBookmark(aPaM)
+ , ::sfx2::Metadatable()
, m_aCode(rCode)
, m_sShortName(rShortName)
{
@@ -206,6 +213,54 @@ namespace sw { namespace mark
io_pDoc->SetModified();
}
+ // ::sfx2::Metadatable
+ ::sfx2::IXmlIdRegistry& Bookmark::GetRegistry()
+ {
+ SwDoc *const pDoc( GetMarkPos().GetDoc() );
+ OSL_ENSURE(pDoc, "Bookmark::MakeUnoObject: no doc?");
+ return pDoc->GetXmlIdRegistry();
+ }
+
+ bool Bookmark::IsInClipboard() const
+ {
+ SwDoc *const pDoc( GetMarkPos().GetDoc() );
+ OSL_ENSURE(pDoc, "Bookmark::IsInClipboard: no doc?");
+ return pDoc->IsClipBoard();
+ }
+
+ bool Bookmark::IsInUndo() const
+ {
+ return false;
+ }
+
+ bool Bookmark::IsInContent() const
+ {
+ SwDoc *const pDoc( GetMarkPos().GetDoc() );
+ OSL_ENSURE(pDoc, "Bookmark::IsInContent: no doc?");
+ return !pDoc->IsInHeaderFooter( SwNodeIndex(GetMarkPos().nNode) );
+ }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable >
+ Bookmark::MakeUnoObject()
+ {
+ // re-use existing SwXBookmark
+ SwClientIter iter( *this );
+ SwClient * pClient( iter.First( TYPE( SwXBookmark ) ) );
+ while (pClient) {
+ SwXBookmark *const pBookmark( dynamic_cast<SwXBookmark*>(pClient) );
+ if (pBookmark && pBookmark->GetCoreObject() == this) {
+ return pBookmark;
+ }
+ pClient = iter.Next();
+ }
+
+ // create new SwXBookmark
+ SwDoc *const pDoc( GetMarkPos().GetDoc() );
+ OSL_ENSURE(pDoc, "Bookmark::MakeUnoObject: no doc?");
+ return new SwXBookmark(this, pDoc);
+ }
+
+
Fieldmark::Fieldmark(const SwPaM& rPaM)
: MarkBase(rPaM, MarkBase::GenerateNewName(our_sNamePrefix))
{
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index 49142a2a5107..bf0974e3e9b1 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -171,12 +171,12 @@ SwCallLink::~SwCallLink()
}
}
- if( pBreakIt->xBreak.is() )
+ if( pBreakIt->GetBreakIter().is() )
{
const String& rTxt = ((SwTxtNode*)pCNd)->GetTxt();
if( !nCmp ||
- pBreakIt->xBreak->getScriptType( rTxt, nCmp )
- != pBreakIt->xBreak->getScriptType( rTxt, nCmp - 1 ))
+ pBreakIt->GetBreakIter()->getScriptType( rTxt, nCmp )
+ != pBreakIt->GetBreakIter()->getScriptType( rTxt, nCmp - 1 ))
{
rShell.CallChgLnk();
return;
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 87a579150e76..23a9bf139ef1 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1124,8 +1124,8 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt,
if( !bRet && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD )
& rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
{
- pTxtAttr = pTxtNd->GetTxtAttr( aPos.nContent.GetIndex(),
- RES_TXTATR_FIELD );
+ pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_FIELD );
const SwField* pFld = pTxtAttr
? pTxtAttr->GetFld().GetFld()
: 0;
@@ -1190,7 +1190,7 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt,
if( bRet )
rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
}
- else if( 0 != ( pTxtAttr = pTxtNd->GetTxtAttr(
+ else if ( 0 != ( pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
{
bRet = TRUE;
@@ -1526,9 +1526,8 @@ const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const
const SwTxtNode* pTxtNd = pCursorPos->nNode.GetNode().GetTxtNode();
if ( pTxtNd )
{
- SwTxtAttr* pTxtAttr =
- pTxtNd->GetTxtAttr( pCursorPos->nContent.GetIndex(),
- RES_TXTATR_FIELD );
+ SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
+ pCursorPos->nContent.GetIndex(), RES_TXTATR_FIELD );
const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
if ( pFld && pFld->Which()== RES_POSTITFLD )
{
@@ -1766,7 +1765,7 @@ BOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
if( n < aFPos.nColumnCnt )
{
*pCurCrsr->GetPoint() = aPos;
- GetDoc()->Insert( *pCurCrsr,
+ GetDoc()->InsertPoolItem( *pCurCrsr,
SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0);
}
}
@@ -1792,7 +1791,7 @@ BOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
if( SVX_ADJUST_LEFT != rAdj.GetAdjust() )
aSet.Put( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
- GetDoc()->Insert( *pCurCrsr, aSet, 0 );
+ GetDoc()->InsertItemSet( *pCurCrsr, aSet, 0 );
}
else {
ASSERT( !this, "wo ist mein CntntNode?" );
@@ -1812,7 +1811,9 @@ BOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
sInsert += sSpace;
}
if( sInsert.Len() )
- GetDoc()->Insert( *pCurCrsr, sInsert, true );
+ {
+ GetDoc()->InsertString( *pCurCrsr, sInsert );
+ }
}
// kein break - Ausrichtung muss noch gesetzt werden
case FILL_MARGIN:
@@ -1830,7 +1831,7 @@ BOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
default:
break;
}
- GetDoc()->Insert( *pCurCrsr, aAdj, 0 );
+ GetDoc()->InsertPoolItem( *pCurCrsr, aAdj, 0 );
}
break;
}
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index 4a98c1ce558e..5697912b21fe 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -1189,7 +1189,8 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
if( bReplaceTxt )
{
- int bRegExp = SearchAlgorithms_REGEXP == pSearchOpt->algorithmType;
+ const bool bRegExp(
+ SearchAlgorithms_REGEXP == pSearchOpt->algorithmType);
SwIndex& rSttCntIdx = pCrsr->Start()->nContent;
xub_StrLen nSttCnt = rSttCntIdx.GetIndex();
@@ -1202,12 +1203,11 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
((Ring*)pRegion)->MoveRingTo( &rCursor );
}
- String *pRepl = bRegExp ? ReplaceBackReferences( *pSearchOpt, pCrsr ) : 0;
- if( pRepl )
- rCursor.GetDoc()->Replace( *pCrsr, *pRepl, bRegExp );
- else
- rCursor.GetDoc()->Replace( *pCrsr, pSearchOpt->replaceString, bRegExp );
- delete pRepl;
+ ::std::auto_ptr<String> pRepl( (bRegExp) ?
+ ReplaceBackReferences( *pSearchOpt, pCrsr ) : 0 );
+ rCursor.GetDoc()->ReplaceRange( *pCrsr,
+ (pRepl.get()) ? *pRepl : String(pSearchOpt->replaceString),
+ bRegExp );
rCursor.SaveTblBoxCntnt( pCrsr->GetPoint() );
if( bRegExp )
@@ -1235,7 +1235,9 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
// ReplaceSet angegeben, auf Default zurueck gesetzt
if( !pSet->Count() )
- pCrsr->GetDoc()->Insert( *pCrsr, *pReplSet, 0 );
+ {
+ pCrsr->GetDoc()->InsertItemSet( *pCrsr, *pReplSet, 0 );
+ }
else
{
SfxItemPool* pPool = pReplSet->GetPool();
@@ -1255,7 +1257,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
pItem = aIter.NextItem();
}
aSet.Put( *pReplSet );
- pCrsr->GetDoc()->Insert( *pCrsr, aSet, 0 );
+ pCrsr->GetDoc()->InsertItemSet( *pCrsr, aSet, 0 );
}
#endif
return FIND_NO_RING;
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 89686a3673bc..e5e87a33bc5d 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -126,7 +126,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
if ( bNewHint )
{
const SwTxtAttr* pHt = (*pHts)[n];
- if ( !pHt->GetEnd() && nStt >= nStart )
+ if ( pHt->HasDummyChar() && (nStt >= nStart) )
{
//JP 17.05.00: Task 75806 ask for ">=" and not for ">"
switch( pHt->Which() )
@@ -136,7 +136,9 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
case RES_TXTATR_FIELD:
case RES_TXTATR_REFMARK:
case RES_TXTATR_TOXMARK:
- {
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ {
// JP 06.05.98: mit Bug 50100 werden sie als Trenner erwuenscht und nicht
// mehr zum Wort dazu gehoerend.
// MA 23.06.98: mit Bug 51215 sollen sie konsequenterweise auch am
@@ -161,9 +163,6 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
}
}
break;
- case RES_TXTATR_HARDBLANK:
- rRet.SetChar( nAkt, ((SwTxtHardBlank*)pHt)->GetChar() );
- break;
default:
ASSERT( false, "unknown case in lcl_CleanStr" )
break;
@@ -456,7 +455,7 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
USHORT nCurrScript = 0;
if ( SearchAlgorithms_APPROXIMATE == rSearchOpt.algorithmType &&
- pBreakIt->xBreak.is() )
+ pBreakIt->GetBreakIter().is() )
{
pScriptIter = new SwScriptIterator( sCleanStr, nStart, bSrchForward );
nSearchScript = pBreakIt->GetRealScriptOfText( rSearchOpt.searchString, 0 );
@@ -593,7 +592,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
if( bFnd && bReplace ) // String ersetzen ??
{
// Replace-Methode vom SwDoc benutzen
- int bRegExp = SearchAlgorithms_REGEXP == rSearchOpt.algorithmType;
+ const bool bRegExp(SearchAlgorithms_REGEXP == rSearchOpt.algorithmType);
SwIndex& rSttCntIdx = pCrsr->Start()->nContent;
xub_StrLen nSttCnt = rSttCntIdx.GetIndex();
// damit die Region auch verschoben wird, in den Shell-Cursr-Ring
@@ -605,12 +604,11 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
((Ring*)pRegion)->MoveRingTo( &rCursor );
}
- String *pRepl = bRegExp ? ReplaceBackReferences( rSearchOpt, pCrsr ) : 0;
- if( pRepl )
- rCursor.GetDoc()->Replace( *pCrsr, *pRepl, bRegExp );
- else
- rCursor.GetDoc()->Replace( *pCrsr, rSearchOpt.replaceString, bRegExp );
- delete pRepl;
+ ::std::auto_ptr<String> pRepl( (bRegExp)
+ ? ReplaceBackReferences( rSearchOpt, pCrsr ) : 0 );
+ rCursor.GetDoc()->ReplaceRange( *pCrsr,
+ (pRepl.get()) ? *pRepl : String(rSearchOpt.replaceString),
+ bRegExp );
rCursor.SaveTblBoxCntnt( pCrsr->GetPoint() );
if( bRegExp )
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 6ca8a6de62c2..4b2f9332fb78 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -198,7 +198,12 @@ SwComparePosition ComparePosition(
nRet = POS_INSIDE;
}
else
- nRet = POS_OVERLAP_BEHIND;
+ {
+ if (rStt1 == rStt2)
+ nRet = POS_OUTSIDE;
+ else
+ nRet = POS_OVERLAP_BEHIND;
+ }
}
else if( rEnd2 == rStt1 )
nRet = POS_COLLIDE_START;
@@ -237,7 +242,12 @@ SwComparePosition ComparePosition(
nRet = POS_INSIDE;
}
else
- nRet = POS_OVERLAP_BEHIND;
+ {
+ if (nStt1 == nStt2)
+ nRet = POS_OUTSIDE;
+ else
+ nRet = POS_OVERLAP_BEHIND;
+ }
}
else if( nEnd2 == nStt1 )
nRet = POS_COLLIDE_START;
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index b7a336b5929c..ea5853916b8c 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1188,10 +1188,10 @@ BOOL SwCursor::IsStartWordWT( sal_Int16 nWordType ) const
{
BOOL bRet = FALSE;
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
- bRet = pBreakIt->xBreak->isBeginWord(
+ bRet = pBreakIt->GetBreakIter()->isBeginWord(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos )),
nWordType );
@@ -1203,10 +1203,10 @@ BOOL SwCursor::IsEndWordWT( sal_Int16 nWordType ) const
{
BOOL bRet = FALSE;
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
- bRet = pBreakIt->xBreak->isEndWord(
+ bRet = pBreakIt->GetBreakIter()->isEndWord(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
nWordType );
@@ -1219,10 +1219,10 @@ BOOL SwCursor::IsInWordWT( sal_Int16 nWordType ) const
{
BOOL bRet = FALSE;
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
- Boundary aBoundary = pBreakIt->xBreak->getWordBoundary(
+ Boundary aBoundary = pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
nWordType,
@@ -1261,11 +1261,11 @@ BOOL SwCursor::GoStartWordWT( sal_Int16 nWordType )
{
BOOL bRet = FALSE;
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
SwCrsrSaveState aSave( *this );
xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
- nPtPos = (xub_StrLen)pBreakIt->xBreak->getWordBoundary(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
nWordType,
@@ -1285,11 +1285,11 @@ BOOL SwCursor::GoEndWordWT( sal_Int16 nWordType )
{
BOOL bRet = FALSE;
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
SwCrsrSaveState aSave( *this );
xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
- nPtPos = (xub_StrLen)pBreakIt->xBreak->getWordBoundary(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
nWordType,
@@ -1310,12 +1310,12 @@ BOOL SwCursor::GoNextWordWT( sal_Int16 nWordType )
{
BOOL bRet = FALSE;
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
SwCrsrSaveState aSave( *this );
xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
- nPtPos = (xub_StrLen)pBreakIt->xBreak->nextWord(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->nextWord(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos, 1 ) ),
nWordType ).startPos;
@@ -1334,7 +1334,7 @@ BOOL SwCursor::GoPrevWordWT( sal_Int16 nWordType )
{
BOOL bRet = FALSE;
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
SwCrsrSaveState aSave( *this );
xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
@@ -1342,7 +1342,7 @@ BOOL SwCursor::GoPrevWordWT( sal_Int16 nWordType )
if( nPtPos )
--nPtPos;
- nPtPos = (xub_StrLen)pBreakIt->xBreak->previousWord(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->previousWord(
pTxtNd->GetTxt(), nPtStart,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos, 1 ) ),
nWordType ).startPos;
@@ -1373,10 +1373,10 @@ BOOL SwCursor::SelectWordWT( sal_Int16 nWordType, const Point* pPt )
}
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
- Boundary aBndry( pBreakIt->xBreak->getWordBoundary(
+ Boundary aBndry( pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
nWordType,
@@ -1408,7 +1408,7 @@ BOOL SwCursor::GoSentence( SentenceMoveType eMoveType )
{
BOOL bRet = FALSE;
const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
- if( pTxtNd && pBreakIt->xBreak.is() )
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
{
//mask deleted redlines
String sNodeText(pTxtNd->GetTxt());
@@ -1438,14 +1438,14 @@ BOOL SwCursor::GoSentence( SentenceMoveType eMoveType )
switch ( eMoveType )
{
case END_SENT:
- nPtPos = (xub_StrLen)pBreakIt->xBreak->endOfSentence(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfSentence(
sNodeText,
nPtPos, pBreakIt->GetLocale(
pTxtNd->GetLang( nPtPos ) ));
break;
case NEXT_SENT:
{
- nPtPos = (xub_StrLen)pBreakIt->xBreak->endOfSentence(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfSentence(
sNodeText,
nPtPos, pBreakIt->GetLocale(
pTxtNd->GetLang( nPtPos ) ));
@@ -1455,20 +1455,20 @@ BOOL SwCursor::GoSentence( SentenceMoveType eMoveType )
break;
}
case START_SENT:
- nPtPos = (xub_StrLen)pBreakIt->xBreak->beginOfSentence(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfSentence(
sNodeText,
nPtPos, pBreakIt->GetLocale(
pTxtNd->GetLang( nPtPos ) ));
break;
case PREV_SENT:
- nPtPos = (xub_StrLen)pBreakIt->xBreak->beginOfSentence(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfSentence(
sNodeText,
nPtPos, pBreakIt->GetLocale(
pTxtNd->GetLang( nPtPos ) ));
if (nPtPos == 0)
return FALSE; // the previous sentence is not in this paragraph
if (nPtPos > 0)
- nPtPos = (xub_StrLen)pBreakIt->xBreak->beginOfSentence(
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfSentence(
sNodeText,
nPtPos - 1, pBreakIt->GetLocale(
pTxtNd->GetLang( nPtPos ) ));
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 4d88fbd1cb7a..9fda3564a400 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -111,6 +111,11 @@ SW_DLLPUBLIC const char * dbg_out(const String & aStr)
return aDbgOutResult.GetBuffer();
}
+SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr)
+{
+ return OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US).getStr();
+}
+
struct CompareUShort
{
@@ -173,13 +178,13 @@ map<USHORT,String,CompareUShort> & GetItemWhichMap()
aItemWhichMap[RES_TXTATR_DUMMY5] = String("TXTATR_DUMMY5", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_CJK_RUBY] = String("TXTATR_CJK_RUBY", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_UNKNOWN_CONTAINER] = String("TXTATR_UNKNOWN_CONTAINER", RTL_TEXTENCODING_ASCII_US);
- aItemWhichMap[RES_TXTATR_DUMMY6] = String("TXTATR_DUMMY6", RTL_TEXTENCODING_ASCII_US);
- aItemWhichMap[RES_TXTATR_DUMMY7] = String("TXTATR_DUMMY7", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_META] = String("TXTATR_META", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_METAFIELD] = String("TXTATR_METAFIELD", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_FIELD] = String("TXTATR_FIELD", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_FLYCNT] = String("TXTATR_FLYCNT", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_FTN] = String("TXTATR_FTN", RTL_TEXTENCODING_ASCII_US);
- aItemWhichMap[RES_TXTATR_SOFTHYPH] = String("TXTATR_SOFTHYPH", RTL_TEXTENCODING_ASCII_US);
- aItemWhichMap[RES_TXTATR_HARDBLANK] = String("TXTATR_HARDBLANK", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_DUMMY4] = String("TXTATR_DUMMY4", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_DUMMY3] = String("TXTATR_DUMMY3", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_DUMMY1] = String("TXTATR_DUMMY1", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_DUMMY2] = String("TXTATR_DUMMY2", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_PARATR_LINESPACING] = String("PARATR_LINESPACING", RTL_TEXTENCODING_ASCII_US);
@@ -542,7 +547,7 @@ String lcl_dbg_out(const SwNode & rNode)
String aTmpStr;
aTmpStr += String("<node ", RTL_TEXTENCODING_ASCII_US);
- aTmpStr += String("index =\"", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String("index=\"", RTL_TEXTENCODING_ASCII_US);
aTmpStr += String::CreateFromInt32(rNode.GetIndex());
aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US);
@@ -672,7 +677,15 @@ String lcl_dbg_out(const SwNode & rNode)
}
}
else if (rNode.IsStartNode())
- aTmpStr += String("<start/>", RTL_TEXTENCODING_ASCII_US);
+ {
+ aTmpStr += String("<start end=\"", RTL_TEXTENCODING_ASCII_US);
+
+ const SwStartNode * pStartNode = dynamic_cast<const SwStartNode *> (&rNode);
+ if (pStartNode != NULL)
+ aTmpStr += String::CreateFromInt32(pStartNode->EndOfSectionNode()->GetIndex());
+
+ aTmpStr += String("\"/>", RTL_TEXTENCODING_ASCII_US);
+ }
else if (rNode.IsEndNode())
aTmpStr += String("<end/>", RTL_TEXTENCODING_ASCII_US);
@@ -722,25 +735,68 @@ BOOL lcl_dbg_add_node(const SwNodePtr & pNode, void * pArgs)
return TRUE;
}
-String lcl_dbg_out(SwNodes & rNodes)
+void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, ULONG & nIndex)
{
- String aStr("<nodes>", RTL_TEXTENCODING_ASCII_US);
+ SwNode * pNode = rNodes[nIndex];
+ SwStartNode * pStartNode = dynamic_cast<SwStartNode *> (pNode);
+
+ SwNode * pEndNode = NULL;
+ if (pStartNode != NULL)
+ pEndNode = pStartNode->EndOfSectionNode();
+
+ ULONG nCount = rNodes.Count();
+ ULONG nStartIndex = nIndex;
+
+ bool bDone = false;
- for (ULONG i = 0; i < rNodes.Count(); i++)
+ String aTag;
+ if (pNode->IsTableNode())
+ aTag += String("table", RTL_TEXTENCODING_ASCII_US);
+ else if (pNode->IsSectionNode())
+ aTag += String("section", RTL_TEXTENCODING_ASCII_US);
+ else
+ aTag += String("nodes", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += String("<", RTL_TEXTENCODING_ASCII_US);
+ aStr += aTag;
+ aStr += String(">", RTL_TEXTENCODING_ASCII_US);
+
+ while (! bDone)
{
- SwNode * pNode = rNodes[i];
+ if (pNode->IsStartNode() && nIndex != nStartIndex)
+ lcl_dbg_nodes_inner(aStr, rNodes, nIndex);
+ else
+ {
+ aStr += lcl_dbg_out(*pNode);
+ aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
- if (pNode->IsEndNode())
- aStr += String("</nodes>\n", RTL_TEXTENCODING_ASCII_US);
+ nIndex++;
+ }
- aStr += lcl_dbg_out(*pNode);
- aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
+ if (pNode == pEndNode || nIndex >= nCount)
+ bDone = true;
+ else
+ pNode = rNodes[nIndex];
+ }
- if (pNode->IsStartNode())
- aStr += String("<nodes>", RTL_TEXTENCODING_ASCII_US);
+ aStr += String("</", RTL_TEXTENCODING_ASCII_US);
+ aStr += aTag;
+ aStr += String(">\n", RTL_TEXTENCODING_ASCII_US);
+}
+
+String lcl_dbg_out(SwNodes & rNodes)
+{
+ String aStr("<nodes-array>", RTL_TEXTENCODING_ASCII_US);
+
+ ULONG nIndex = 0;
+ ULONG nCount = rNodes.Count();
+
+ while (nIndex < nCount)
+ {
+ lcl_dbg_nodes_inner(aStr, rNodes, nIndex);
}
- aStr += String("</nodes>\n", RTL_TEXTENCODING_ASCII_US);
+ aStr += String("</nodes-array>\n", RTL_TEXTENCODING_ASCII_US);
return aStr;
}
@@ -1028,5 +1084,24 @@ SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens)
{
return dbg_out(lcl_dbg_out(rTokens));
}
+
+String lcl_dbg_out(const SwNodeRange & rRange)
+{
+ String aStr("[", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += lcl_dbg_out(SwPosition(rRange.aStart));
+ aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+ aStr += lcl_dbg_out(SwPosition(rRange.aEnd));
+
+ aStr += String("]" , RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange)
+{
+ return dbg_out(lcl_dbg_out(rRange));
+}
+
#endif // DEBUG
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 926a555c8a4e..0441d14edf1d 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -627,7 +627,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
{
SwCntntNode *pNode = rPos.nNode.GetNode().GetCntntNode();
if(0 == pNode)
- return FALSE;
+ return false;
{
// Bug 26675: DataChanged vorm loeschen verschicken, dann bekommt
@@ -642,7 +642,10 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
ClearRedo();
// einfuegen vom Undo-Object, z.Z. nur beim TextNode
if( pNode->IsTxtNode() )
- AppendUndo( pUndo = new SwUndoSplitNode( this, rPos, bChkTableStart ));
+ {
+ pUndo = new SwUndoSplitNode( this, rPos, bChkTableStart );
+ AppendUndo(pUndo);
+ }
}
//JP 28.01.97: Sonderfall fuer SplitNode am Tabellenanfang:
@@ -712,7 +715,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
if( pUndo )
pUndo->SetTblFlag();
SetModified();
- return TRUE;
+ return true;
}
}
}
@@ -721,7 +724,10 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
SvULongs aBkmkArr( 15, 15 );
_SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
aBkmkArr, SAVEFLY_SPLIT );
- if( 0 != ( pNode = pNode->SplitCntntNode( rPos ) ))
+ // FIXME: only SwTxtNode has a valid implementation of SplitCntntNode!
+ ASSERT(pNode->IsTxtNode(), "splitting non-text node?");
+ pNode = pNode->SplitCntntNode( rPos );
+ if (pNode)
{
// verschiebe noch alle Bookmarks/TOXMarks/FlyAtCnt
if( aBkmkArr.Count() )
@@ -740,7 +746,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
}
SetModified();
- return TRUE;
+ return true;
}
bool SwDoc::AppendTxtNode( SwPosition& rPos )
@@ -783,73 +789,86 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos )
return TRUE;
}
-bool SwDoc::Insert( const SwPaM &rRg, const String &rStr, bool bHintExpand )
+bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
+ const enum InsertFlags nInsertMode )
{
if( DoesUndo() )
+ {
ClearRedo();
+ }
- const SwPosition* pPos = rRg.GetPoint();
+ const SwPosition& rPos = *rRg.GetPoint();
if( pACEWord ) // Aufnahme in die Autokorrektur
{
if( 1 == rStr.Len() && pACEWord->IsDeleted() )
- pACEWord->CheckChar( *pPos, rStr.GetChar( 0 ) );
+ {
+ pACEWord->CheckChar( rPos, rStr.GetChar( 0 ) );
+ }
delete pACEWord, pACEWord = 0;
}
- SwTxtNode *pNode = pPos->nNode.GetNode().GetTxtNode();
+ SwTxtNode *const pNode = rPos.nNode.GetNode().GetTxtNode();
if(!pNode)
- return FALSE;
+ {
+ return false;
+ }
- const USHORT nInsMode = bHintExpand ? INS_EMPTYEXPAND
- : INS_NOHINTEXPAND;
SwDataChanged aTmp( rRg, 0 );
if( !DoesUndo() || !DoesGroupUndo() )
{
- pNode->Insert( rStr, pPos->nContent, nInsMode );
+ pNode->InsertText( rStr, rPos.nContent, nInsertMode );
if( DoesUndo() )
- AppendUndo( new SwUndoInsert( pPos->nNode,
- pPos->nContent.GetIndex(), rStr.Len() ));
+ {
+ SwUndoInsert * const pUndo( new SwUndoInsert(
+ rPos.nNode, rPos.nContent.GetIndex(), rStr.Len(), nInsertMode));
+ AppendUndo(pUndo);
+ }
}
else
{ // ist Undo und Gruppierung eingeschaltet, ist alles anders !
- USHORT nUndoSize = pUndos->Count();
- xub_StrLen nInsPos = pPos->nContent.GetIndex();
SwUndoInsert * pUndo = NULL; // #111827#
- CharClass& rCC = GetAppCharClass();
+ // don't group the start if hints at the start should be expanded
+ if (!(nInsertMode & IDocumentContentOperations::INS_FORCEHINTEXPAND))
// -> #111827#
- bool bNewUndo = false;
- if( 0 == nUndoSize)
- bNewUndo = true;
- else
{
- pUndo = (SwUndoInsert*)(*pUndos)[ --nUndoSize ];
-
- switch (pUndo->GetId())
+ USHORT const nUndoSize = pUndos->Count();
+ if (0 != nUndoSize)
{
- case UNDO_INSERT:
- case UNDO_TYPING:
- bNewUndo = !pUndo->CanGrouping( *pPos );
+ SwUndo * const pLastUndo = (*pUndos)[ nUndoSize - 1 ];
- break;
+ switch (pLastUndo->GetId())
+ {
+ case UNDO_INSERT:
+ case UNDO_TYPING:
+ if (static_cast<SwUndoInsert*>(pLastUndo)
+ ->CanGrouping( rPos ))
+ {
+ pUndo = static_cast<SwUndoInsert*>(pLastUndo);
+ }
+ break;
- default:
- bNewUndo = true;
+ default:
+ break;
+ }
}
}
// <- #111827#
- if (bNewUndo)
+ CharClass const& rCC = GetAppCharClass();
+ xub_StrLen nInsPos = rPos.nContent.GetIndex();
+
+ if (!pUndo)
{
- pUndo = new SwUndoInsert( pPos->nNode, nInsPos, 0,
+ pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 0, nInsertMode,
!rCC.isLetterNumeric( rStr, 0 ) );
AppendUndo( pUndo );
}
- pNode->Insert( rStr, pPos->nContent, nInsMode );
+ pNode->InsertText( rStr, rPos.nContent, nInsertMode );
for( xub_StrLen i = 0; i < rStr.Len(); ++i )
{
@@ -857,7 +876,7 @@ bool SwDoc::Insert( const SwPaM &rRg, const String &rStr, bool bHintExpand )
// wenn CanGrouping() TRUE returnt, ist schon alles erledigt
if( !pUndo->CanGrouping( rStr.GetChar( i ) ))
{
- pUndo = new SwUndoInsert( pPos->nNode, nInsPos, 1,
+ pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 1, nInsertMode,
!rCC.isLetterNumeric( rStr, i ) );
AppendUndo( pUndo );
}
@@ -866,16 +885,21 @@ bool SwDoc::Insert( const SwPaM &rRg, const String &rStr, bool bHintExpand )
if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
{
- SwPaM aPam( pPos->nNode, aTmp.GetCntnt(),
- pPos->nNode, pPos->nContent.GetIndex());
+ SwPaM aPam( rPos.nNode, aTmp.GetCntnt(),
+ rPos.nNode, rPos.nContent.GetIndex());
if( IsRedlineOn() )
- AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ {
+ AppendRedline(
+ new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ }
else
+ {
SplitRedline( aPam );
+ }
}
SetModified();
- return TRUE;
+ return true;
}
SwFlyFrmFmt* SwDoc::_InsNoTxtNode( const SwPosition& rPos, SwNoTxtNode* pNode,
@@ -1506,7 +1530,7 @@ BOOL SwDoc::RemoveInvisibleContent()
( 1 == pTxtNd->EndOfSectionIndex() - pTxtNd->GetIndex() &&
!GetNodes()[ pTxtNd->GetIndex() - 1 ]->GetTxtNode() ) )
{
- Delete( aPam );
+ DeleteRange( aPam );
}
else
{
@@ -1542,7 +1566,7 @@ BOOL SwDoc::RemoveInvisibleContent()
( 1 == pTxtNd->EndOfSectionIndex() - pTxtNd->GetIndex() &&
!GetNodes()[ pTxtNd->GetIndex() - 1 ]->GetTxtNode() ) )
{
- Delete( aPam );
+ DeleteRange( aPam );
}
else
{
@@ -1628,7 +1652,7 @@ BOOL SwDoc::RemoveInvisibleContent()
&aPam.GetPoint()->nNode );
aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
- Delete( aPam );
+ DeleteRange( aPam );
}
else
{
@@ -1712,7 +1736,8 @@ BOOL SwDoc::ConvertFieldsToText()
//now remove the field and insert the string
SwPaM aPam1(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart());
aPam1.Move();
- Insert( aPam1, sText, true );//insert first to keep the field's attributes
+ //insert first to keep the field's attributes
+ InsertString( aPam1, sText );
SwPaM aPam2(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart());
aPam2.SetMark();
aPam2.Move();
@@ -1918,24 +1943,19 @@ String SwDoc::GetPaMDescr(const SwPaM & rPam) const
// -> #111840#
SwField * SwDoc::GetField(const SwPosition & rPos)
{
- SwField * pResult = NULL;
-
- SwTxtFld * pAttr = rPos.nNode.GetNode().GetTxtNode()->
- GetTxtFld(rPos.nContent);
-
- if (pAttr)
- pResult = (SwField *) pAttr->GetFld().GetFld();
+ SwTxtFld * const pAttr = GetTxtFld(rPos);
- return pResult;
+ return (pAttr) ? const_cast<SwField *>( pAttr->GetFld().GetFld() ) : 0;
}
SwTxtFld * SwDoc::GetTxtFld(const SwPosition & rPos)
{
- SwTxtNode *pNode = rPos.nNode.GetNode().GetTxtNode();
- if( pNode )
- return pNode->GetTxtFld( rPos.nContent );
- else
- return 0;
+ SwTxtNode * const pNode = rPos.nNode.GetNode().GetTxtNode();
+
+ return (pNode)
+ ? static_cast<SwTxtFld*>( pNode->GetTxtAttrForCharAt(
+ rPos.nContent.GetIndex(), RES_TXTATR_FIELD) )
+ : 0;
}
// <- #111840#
@@ -1987,3 +2007,13 @@ void SwDoc::ChkCondColls()
}
}
+void SwDoc::setExternalData(::sw::tExternalDataType eType,
+ ::sw::tExternalDataPointer pPayload)
+{
+ m_externalData[eType] = pPayload;
+}
+
+::sw::tExternalDataPointer SwDoc::getExternalData(::sw::tExternalDataType eType)
+{
+ return m_externalData[eType];
+}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index d838b277bdf5..e1b4f3ee4322 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -995,6 +995,14 @@ SaveBookmark::SaveBookmark(
{
m_aShortName = pBookmark->GetShortName();
m_aCode = pBookmark->GetKeyCode();
+
+ ::sfx2::Metadatable * const pMetadatable(
+ const_cast< ::sfx2::Metadatable * >( // CreateUndo should be const?
+ dynamic_cast< ::sfx2::Metadatable const* >(pBookmark)));
+ if (pMetadatable)
+ {
+ m_pMetadataUndo = pMetadatable->CreateUndo();
+ }
}
m_nNode1 = rBkmk.GetMarkPos().nNode.GetIndex();
m_nCntnt1 = rBkmk.GetMarkPos().nContent.GetIndex();
@@ -1073,6 +1081,16 @@ void SaveBookmark::SetInDoc(
{
pBookmark->SetKeyCode(m_aCode);
pBookmark->SetShortName(m_aShortName);
+ if (m_pMetadataUndo)
+ {
+ ::sfx2::Metadatable * const pMeta(
+ dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
+ OSL_ENSURE(pMeta, "metadata undo, but not metadatable?");
+ if (pMeta)
+ {
+ pMeta->RestoreMetadata(m_pMetadataUndo);
+ }
+ }
}
}
}
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index fb94d433d14f..68c84dd3b644 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1196,7 +1196,8 @@ BOOL SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
SwPaM aCpyPam( rSrcNd, nStt );
aCpyPam.SetMark();
aCpyPam.GetPoint()->nContent = nSEnd;
- aCpyPam.GetDoc()->Copy( aCpyPam, *aPam.GetPoint(), false );
+ aCpyPam.GetDoc()->CopyRange( aCpyPam, *aPam.GetPoint(),
+ false );
pDoc->DoUndo( bUndo );
}
@@ -1624,7 +1625,9 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn )
RedlineMode_t eOld = pDoc->GetRedlineMode();
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
- pSrcRedl->GetDoc()->Copy( *(SwPaM*)pSrcRedl, *pDestRedl->GetPoint(), false );
+ pSrcRedl->GetDoc()->CopyRange(
+ *const_cast<SwPaM*>(static_cast<const SwPaM*>(pSrcRedl)),
+ *pDestRedl->GetPoint(), false );
pDoc->SetRedlineMode_intern( eOld );
pDoc->DoUndo( bUndo );
diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx
index f03ca5b5d352..36c23b14b8a0 100644
--- a/sw/source/core/doc/docdde.cxx
+++ b/sw/source/core/doc/docdde.cxx
@@ -62,17 +62,24 @@ using namespace ::com::sun::star;
namespace
{
- static ::sw::mark::DdeBookmark* lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName)
+ static ::sw::mark::DdeBookmark* lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName, bool bCaseSensitive)
{
//Iterating over all bookmarks, checking DdeBookmarks
- const String sNameLc = GetAppCharClass().lower(rName);
+ const ::rtl::OUString sNameLc = bCaseSensitive ? rName : GetAppCharClass().lower(rName);
for(IDocumentMarkAccess::const_iterator_t ppMark = rMarkAccess.getMarksBegin();
ppMark != rMarkAccess.getMarksEnd();
ppMark++)
{
- ::sw::mark::DdeBookmark* const pBkmk = dynamic_cast< ::sw::mark::DdeBookmark*>(ppMark->get());
- if(pBkmk && GetAppCharClass().lower(pBkmk->GetName()) == sNameLc)
- return pBkmk;
+ if (::sw::mark::DdeBookmark* const pBkmk = dynamic_cast< ::sw::mark::DdeBookmark*>(ppMark->get()))
+ {
+ if (
+ (bCaseSensitive && (pBkmk->GetName() == sNameLc)) ||
+ (!bCaseSensitive && GetAppCharClass().lower(pBkmk->GetName()) == String(sNameLc))
+ )
+ {
+ return pBkmk;
+ }
+ }
}
return NULL;
}
@@ -80,22 +87,26 @@ namespace
struct _FindItem
{
- const String& rItem;
+ const String m_Item;
SwTableNode* pTblNd;
SwSectionNode* pSectNd;
_FindItem(const String& rS)
- : rItem(rS), pTblNd(0), pSectNd(0)
+ : m_Item(rS), pTblNd(0), pSectNd(0)
{}
};
-BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
+BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs, bool bCaseSensitive )
{
+ _FindItem * const pItem( static_cast<_FindItem*>(pArgs) );
SwSection* pSect = rpSectFmt->GetSection();
if( pSect )
{
- String sNm( GetAppCharClass().lower( pSect->GetName() ));
- if( sNm.Equals( ((_FindItem*)pArgs)->rItem ))
+ String sNm( bCaseSensitive ? pSect->GetName() : GetAppCharClass().lower( pSect->GetName() ));
+ String sCompare( (bCaseSensitive)
+ ? pItem->m_Item
+ : GetAppCharClass().lower( pItem->m_Item ) );
+ if( sNm == sCompare )
{
// gefunden, als erfrage die Daten
const SwNodeIndex* pIdx;
@@ -103,7 +114,7 @@ BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
&rpSectFmt->GetDoc()->GetNodes() == &pIdx->GetNodes() )
{
// eine Tabelle im normalen NodesArr
- ((_FindItem*)pArgs)->pSectNd = pIdx->GetNode().GetSectionNode();
+ pItem->pSectNd = pIdx->GetNode().GetSectionNode();
return FALSE;
}
//nein!! // sollte der Namen schon passen, der Rest aber nicht, dann haben wir
@@ -112,13 +123,22 @@ BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
}
return TRUE; // dann weiter
}
+BOOL lcl_FindSectionCaseSensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
+{
+ return lcl_FindSection( rpSectFmt, pArgs, true );
+}
+BOOL lcl_FindSectionCaseInsensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
+{
+ return lcl_FindSection( rpSectFmt, pArgs, false );
+}
BOOL lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs )
{
+ _FindItem * const pItem( static_cast<_FindItem*>(pArgs) );
String sNm( GetAppCharClass().lower( rpTableFmt->GetName() ));
- if( sNm.Equals( ((_FindItem*)pArgs)->rItem ))
+ if (sNm.Equals( pItem->m_Item ))
{
SwTable* pTmpTbl;
SwTableBox* pFBox;
@@ -128,7 +148,7 @@ BOOL lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs )
&rpTableFmt->GetDoc()->GetNodes() == &pFBox->GetSttNd()->GetNodes() )
{
// eine Tabelle im normalen NodesArr
- ((_FindItem*)pArgs)->pTblNd = (SwTableNode*)
+ pItem->pTblNd = (SwTableNode*)
pFBox->GetSttNd()->FindTableNode();
return FALSE;
}
@@ -143,20 +163,30 @@ BOOL lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs )
bool SwDoc::GetData( const String& rItem, const String& rMimeType,
uno::Any & rValue ) const
{
- ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem);
- if(pBkmk) return SwServerObject(*pBkmk).GetData(rValue, rMimeType);
-
- // haben wir ueberhaupt das Item vorraetig?
- String sItem(GetAppCharClass().lower(rItem));
- _FindItem aPara( sItem );
- ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
- lcl_FindSection, &aPara );
- if( aPara.pSectNd )
+ //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
+ bool bCaseSensitive = true;
+ while( true )
{
- // gefunden, als erfrage die Daten
- return SwServerObject( *aPara.pSectNd ).GetData( rValue, rMimeType );
+ ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
+ if(pBkmk)
+ return SwServerObject(*pBkmk).GetData(rValue, rMimeType);
+
+ // haben wir ueberhaupt das Item vorraetig?
+ String sItem( bCaseSensitive ? rItem : GetAppCharClass().lower(rItem));
+ _FindItem aPara( sItem );
+ ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
+ bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+ if( aPara.pSectNd )
+ {
+ // gefunden, als erfrage die Daten
+ return SwServerObject( *aPara.pSectNd ).GetData( rValue, rMimeType );
+ }
+ if( !bCaseSensitive )
+ break;
+ bCaseSensitive = false;
}
+ _FindItem aPara( GetAppCharClass().lower( rItem ));
((SwFrmFmts*)pTblFrmFmtTbl)->ForEach( 0, pTblFrmFmtTbl->Count(),
lcl_FindTable, &aPara );
if( aPara.pTblNd )
@@ -172,19 +202,30 @@ bool SwDoc::GetData( const String& rItem, const String& rMimeType,
bool SwDoc::SetData( const String& rItem, const String& rMimeType,
const uno::Any & rValue )
{
- ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem);
- if(pBkmk) return SwServerObject(*pBkmk).SetData(rMimeType, rValue);
-
- // haben wir ueberhaupt das Item vorraetig?
- String sItem(GetAppCharClass().lower(rItem));
- _FindItem aPara( sItem );
- pSectionFmtTbl->ForEach( 0, pSectionFmtTbl->Count(), lcl_FindSection, &aPara );
- if( aPara.pSectNd )
+ //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
+ bool bCaseSensitive = true;
+ while( true )
{
- // gefunden, als erfrage die Daten
- return SwServerObject( *aPara.pSectNd ).SetData( rMimeType, rValue );
+ ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
+ if(pBkmk)
+ return SwServerObject(*pBkmk).SetData(rMimeType, rValue);
+
+ // haben wir ueberhaupt das Item vorraetig?
+ String sItem( bCaseSensitive ? rItem : GetAppCharClass().lower(rItem));
+ _FindItem aPara( sItem );
+ pSectionFmtTbl->ForEach( 0, pSectionFmtTbl->Count(), bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+ if( aPara.pSectNd )
+ {
+ // gefunden, als erfrage die Daten
+ return SwServerObject( *aPara.pSectNd ).SetData( rMimeType, rValue );
+ }
+ if( !bCaseSensitive )
+ break;
+ bCaseSensitive = false;
}
+ String sItem(GetAppCharClass().lower(rItem));
+ _FindItem aPara( sItem );
pTblFrmFmtTbl->ForEach( 0, pTblFrmFmtTbl->Count(), lcl_FindTable, &aPara );
if( aPara.pTblNd )
{
@@ -200,31 +241,42 @@ bool SwDoc::SetData( const String& rItem, const String& rMimeType,
{
SwServerObject* pObj = NULL;
- // bookmarks
- ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem);
- if(pBkmk && pBkmk->IsExpanded()
- && (0 == (pObj = pBkmk->GetRefObject())))
- {
- // mark found, but no link yet -> create hotlink
- pObj = new SwServerObject(*pBkmk);
- pBkmk->SetRefObject(pObj);
- GetLinkManager().InsertServer(pObj);
- }
- if(pObj) return pObj;
-
- _FindItem aPara(GetAppCharClass().lower(rItem));
- // sections
- ((SwSectionFmts&)*pSectionFmtTbl).ForEach(0, pSectionFmtTbl->Count(), lcl_FindSection, &aPara);
- if(aPara.pSectNd
- && (0 == (pObj = aPara.pSectNd->GetSection().GetObject())))
+ //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
+ bool bCaseSensitive = true;
+ while( true )
{
- // section found, but no link yet -> create hotlink
- pObj = new SwServerObject( *aPara.pSectNd );
- aPara.pSectNd->GetSection().SetRefObject( pObj );
- GetLinkManager().InsertServer(pObj);
+ // bookmarks
+ ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
+ if(pBkmk && pBkmk->IsExpanded()
+ && (0 == (pObj = pBkmk->GetRefObject())))
+ {
+ // mark found, but no link yet -> create hotlink
+ pObj = new SwServerObject(*pBkmk);
+ pBkmk->SetRefObject(pObj);
+ GetLinkManager().InsertServer(pObj);
+ }
+ if(pObj)
+ return pObj;
+
+ _FindItem aPara(bCaseSensitive ? rItem : GetAppCharClass().lower(rItem));
+ // sections
+ ((SwSectionFmts&)*pSectionFmtTbl).ForEach(0, pSectionFmtTbl->Count(), bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara);
+ if(aPara.pSectNd
+ && (0 == (pObj = aPara.pSectNd->GetSection().GetObject())))
+ {
+ // section found, but no link yet -> create hotlink
+ pObj = new SwServerObject( *aPara.pSectNd );
+ aPara.pSectNd->GetSection().SetRefObject( pObj );
+ GetLinkManager().InsertServer(pObj);
+ }
+ if(pObj)
+ return pObj;
+ if( !bCaseSensitive )
+ break;
+ bCaseSensitive = false;
}
- if(pObj) return pObj;
+ _FindItem aPara( GetAppCharClass().lower(rItem) );
// tables
((SwFrmFmts*)pTblFrmFmtTbl)->ForEach(0, pTblFrmFmtTbl->Count(), lcl_FindTable, &aPara);
if(aPara.pTblNd
@@ -329,31 +381,39 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam,
return FALSE;
}
- ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, sItem);
- if(pBkmk)
+ //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
+ bool bCaseSensitive = true;
+ while( true )
{
- if(pBkmk->IsExpanded())
- rpPam = new SwPaM(
- pBkmk->GetMarkPos(),
- pBkmk->GetOtherMarkPos());
- return static_cast<bool>(rpPam);
- }
+ ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, sItem, bCaseSensitive);
+ if(pBkmk)
+ {
+ if(pBkmk->IsExpanded())
+ rpPam = new SwPaM(
+ pBkmk->GetMarkPos(),
+ pBkmk->GetOtherMarkPos());
+ return static_cast<bool>(rpPam);
+ }
- // alte "Mechanik"
- rCC.toLower( sItem );
- _FindItem aPara( sItem );
+ //
+ _FindItem aPara( bCaseSensitive ? sItem : rCC.lower( sItem ) );
- if( pSectionFmtTbl->Count() )
- {
- ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
- lcl_FindSection, &aPara );
- if( aPara.pSectNd )
+ if( pSectionFmtTbl->Count() )
{
- rpRange = new SwNodeRange( *aPara.pSectNd, 1,
- *aPara.pSectNd->EndOfSectionNode() );
- return TRUE;
+ ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
+ bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+ if( aPara.pSectNd )
+ {
+ rpRange = new SwNodeRange( *aPara.pSectNd, 1,
+ *aPara.pSectNd->EndOfSectionNode() );
+ return TRUE;
+ }
}
+ if( !bCaseSensitive )
+ break;
+ bCaseSensitive = false;
}
return FALSE;
}
+
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index d19a7bbbc09e..12e5d597a7c4 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -70,7 +70,7 @@
#include <fldbas.hxx>
#include <swwait.hxx>
#include <GetMetricVal.hxx>
-
+#include <svtools/syslocale.hxx>
#ifndef _STATSTR_HRC
#include <statstr.hrc>
#endif
@@ -111,7 +111,7 @@ static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId,
nMinRight = nMinTop = nMinBottom = GetMetricVal( CM_1 );
nMinLeft = nMinRight * 2;
}
- else if( MEASURE_METRIC == GetAppLocaleData().getMeasurementSystemEnum() )
+ else if( MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
{
nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; //2 Zentimeter
}
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 16ceedbeefc6..ddc6024c89ae 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -163,24 +163,11 @@ SV_DECL_PTRARR_DEL( _SaveRedlines, _SaveRedline*, 0, 4 )
SV_IMPL_VARARR( _SaveFlyArr, _SaveFly )
SV_IMPL_PTRARR( _SaveRedlines, _SaveRedline* )
-sal_Bool lcl_MayOverwrite( const SwTxtNode *pNode, const xub_StrLen nPos )
+bool lcl_MayOverwrite( const SwTxtNode *pNode, const xub_StrLen nPos )
{
- sal_Bool bRet = sal_True;
- const SwTxtAttr *pHt;
sal_Unicode cChr = pNode->GetTxt().GetChar( nPos );
- if( ( CH_TXTATR_BREAKWORD == cChr || CH_TXTATR_INWORD == cChr ) &&
- 0 != (pHt = pNode->GetTxtAttr( nPos )) )
- switch( pHt->Which() )
- {
- case RES_TXTATR_FLYCNT:
- case RES_TXTATR_FTN:
- case RES_TXTATR_FIELD:
- case RES_TXTATR_REFMARK:
- case RES_TXTATR_TOXMARK:
- bRet = sal_False;
- break;
- }
- return bRet;
+ return !( ( CH_TXTATR_BREAKWORD == cChr || CH_TXTATR_INWORD == cChr ) &&
+ (0 != pNode->GetTxtAttrForCharAt( nPos ) ) );
}
void lcl_SkipAttr( const SwTxtNode *pNode, SwIndex &rIdx, xub_StrLen &rStart )
@@ -421,7 +408,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
{
SwTxtNode& rTxtNd = (SwTxtNode&)pSrch->GetTxtNode();
SwIndex aIdx( &rTxtNd, nFtnSttIdx );
- rTxtNd.Erase( aIdx, 1 );
+ rTxtNd.EraseText( aIdx, 1 );
}
else
{
@@ -449,7 +436,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
// dann weg damit
SwTxtNode& rTxtNd = (SwTxtNode&)pSrch->GetTxtNode();
SwIndex aIdx( &rTxtNd, nFtnSttIdx );
- rTxtNd.Erase( aIdx, 1 );
+ rTxtNd.EraseText( aIdx, 1 );
}
else
{
@@ -764,64 +751,6 @@ void SwDoc::DeleteSection( SwNode *pNode )
}
-
-/*************************************************************************
-|* SwDoc::Insert(char)
-|* Beschreibung Zeichen einfuegen
-*************************************************************************/
-
-bool SwDoc::Insert( const SwPaM &rRg, sal_Unicode c )
-{
- if( DoesUndo() )
- ClearRedo();
-
- const SwPosition & rPos = *rRg.GetPoint();
-
- if( pACEWord ) // Aufnahme in die Autokorrektur
- {
- if( pACEWord->IsDeleted() )
- pACEWord->CheckChar( rPos, c );
- delete pACEWord, pACEWord = 0;
- }
- SwTxtNode *pNode = rPos.nNode.GetNode().GetTxtNode();
- if(!pNode)
- return sal_False;
- sal_Bool bInsOneChar = sal_True;
-
- SwDataChanged aTmp( rRg, 0 );
-
- pNode->Insert( c, rPos.nContent );
-
- if ( DoesUndo() )
- {
- sal_uInt16 nUndoSize = pUndos->Count();
- SwUndo * pUndo;
- if( DoesGroupUndo() && bInsOneChar && nUndoSize-- &&
- UNDO_INSERT == ( pUndo = (*pUndos)[ nUndoSize ])->GetId() &&
- ((SwUndoInsert*)pUndo)->CanGrouping( rPos, c ))
- ; // wenn CanGrouping() sal_True returnt, ist schon alles erledigt
- else
- AppendUndo( new SwUndoInsert( rPos.nNode,
- rPos.nContent.GetIndex(), 1,
- !GetAppCharClass().isLetterNumeric(
- pNode->GetTxt(),
- rPos.nContent.GetIndex() - 1 )));
- }
-
- if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
- {
- SwPaM aPam( rPos.nNode, rPos.nContent.GetIndex() - 1,
- rPos.nNode, rPos.nContent.GetIndex() );
- if( IsRedlineOn() )
- AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
- else
- SplitRedline( aPam );
- }
-
- SetModified();
- return sal_True;
-}
-
void SwDoc::SetModified(SwPaM &rPaM)
{
SwDataChanged aTmp( rPaM, 0 );
@@ -829,91 +758,8 @@ void SwDoc::SetModified(SwPaM &rPaM)
}
/*************************************************************************
-|* SwDoc::Overwrite(char)
-|* Beschreibung Zeichen ueberschreiben
-*************************************************************************/
-
-bool SwDoc::Overwrite( const SwPaM &rRg, sal_Unicode c )
-{
- SwPosition& rPt = *(SwPosition*)rRg.GetPoint();
- if( pACEWord ) // Aufnahme in die Autokorrektur
- {
- pACEWord->CheckChar( rPt, c );
- delete pACEWord, pACEWord = 0;
- }
-
- SwTxtNode *pNode = rPt.nNode.GetNode().GetTxtNode();
- if(!pNode)
- return sal_False;
-
- sal_uInt16 nOldAttrCnt = pNode->GetpSwpHints()
- ? pNode->GetpSwpHints()->Count() : 0;
- SwDataChanged aTmp( rRg, 0 );
- SwIndex& rIdx = rPt.nContent;
- xub_StrLen nStart = rIdx.GetIndex();
-
- // hinter das Zeichen (zum aufspannen der Attribute !!)
- if( nStart < pNode->GetTxt().Len() )
- lcl_SkipAttr( pNode, rIdx, nStart );
-
- if( DoesUndo() )
- {
- ClearRedo();
- sal_uInt16 nUndoSize = pUndos->Count();
- SwUndo * pUndo;
- if( DoesGroupUndo() && nUndoSize-- &&
- UNDO_OVERWRITE == ( pUndo = (*pUndos)[ nUndoSize ])->GetId() &&
- ((SwUndoOverwrite*)pUndo)->CanGrouping( this, rPt, c ))
- ;// wenn CanGrouping() sal_True returnt, ist schon alles erledigt
- else
- AppendUndo( new SwUndoOverwrite( this, rPt, c ));
- }
- else
- {
- BOOL bOldExpFlg = pNode->IsIgnoreDontExpand();
- pNode->SetIgnoreDontExpand( TRUE );
-
- // hinter das Zeichen (zum aufspannen der Attribute !!)
- if( nStart < pNode->GetTxt().Len() )
- rIdx++;
- pNode->Insert( c, rIdx );
- if( nStart+1 < rIdx.GetIndex() )
- {
- rIdx = nStart;
- pNode->Erase( rIdx, 1 );
- rIdx++;
- }
- pNode->SetIgnoreDontExpand( bOldExpFlg );
- }
-
- sal_uInt16 nNewAttrCnt = pNode->GetpSwpHints()
- ? pNode->GetpSwpHints()->Count() : 0;
- if( nOldAttrCnt != nNewAttrCnt )
- {
- SwUpdateAttr aHint( 0, 0, 0 );
- SwClientIter aIter( *pNode );
- SwClient* pGTO = aIter.First(TYPE( SwCrsrShell ));
- while( pGTO )
- {
- pGTO->Modify( 0, &aHint );
- pGTO = aIter.Next();
- }
- }
-
- if( !DoesUndo() && !IsIgnoreRedline() && GetRedlineTbl().Count() )
- {
- SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
- DeleteRedline( aPam, true, USHRT_MAX );
- }
- else if( IsRedlineOn() )
- {
- SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
- AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
- }
-
- SetModified();
- return sal_True;
-}
+ * SwDoc::Overwrite()
+ ************************************************************************/
bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
{
@@ -949,8 +795,11 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
for( xub_StrLen nCnt = 0; nCnt < rStr.Len(); ++nCnt )
{
// hinter das Zeichen (zum aufspannen der Attribute !!)
- if( (nStart = rIdx.GetIndex()) < pNode->GetTxt().Len() )
+ nStart = rIdx.GetIndex();
+ if ( nStart < pNode->GetTxt().Len() )
+ {
lcl_SkipAttr( pNode, rIdx, nStart );
+ }
c = rStr.GetChar( nCnt );
if( DoesUndo() )
{
@@ -969,11 +818,11 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
// hinter das Zeichen (zum Aufspannen der Attribute !!)
if( nStart < pNode->GetTxt().Len() )
rIdx++;
- pNode->Insert( c, rIdx );
+ pNode->InsertText( c, rIdx, INS_EMPTYEXPAND );
if( nStart+1 < rIdx.GetIndex() )
{
rIdx = nStart;
- pNode->Erase( rIdx, 1 );
+ pNode->EraseText( rIdx, 1 );
rIdx++;
}
}
@@ -1001,6 +850,8 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
}
else if( IsRedlineOn() )
{
+ // FIXME: this redline is WRONG: there is no DELETE, and the skipped
+ // characters are also included in aPam
SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
}
@@ -1017,7 +868,7 @@ bool SwDoc::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
sal_Bool bOneNode = rPaM.GetPoint()->nNode == rPaM.GetMark()->nNode;
aIdx--; // vor den Move Bereich !!
- sal_Bool bRet = Move( rPaM, rPos, eMvFlags );
+ bool bRet = MoveRange( rPaM, rPos, eMvFlags );
if( bRet && !bOneNode )
{
if( bJoinTxt )
@@ -1036,12 +887,15 @@ bool SwDoc::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
return bRet;
}
-bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
+// mst: it seems that this is mostly used by SwDoc internals; the only
+// way to call this from the outside seems to be the special case in
+// SwDoc::CopyRange (but i have not managed to actually hit that case)
+bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
{
// keine Moves-Abfangen
const SwPosition *pStt = rPaM.Start(), *pEnd = rPaM.End();
if( !rPaM.HasMark() || *pStt >= *pEnd || (*pStt <= rPos && rPos < *pEnd))
- return sal_False;
+ return false;
// sicher die absatzgebundenen Flys, damit sie verschoben werden koennen.
_SaveFlyArr aSaveFlyArr;
@@ -1088,7 +942,7 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
}
sal_Bool bSplit = sal_False;
- SwPaM * pSavePam = new SwPaM( rPos, rPos );
+ SwPaM aSavePam( rPos, rPos );
// stelle den SPoint an den Anfang vom Bereich (Definition)
if( rPaM.GetPoint() == pEnd )
@@ -1116,7 +970,7 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
_SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
aBkmkArr, SAVEFLY_SPLIT );
- pTNd = (SwTxtNode*)pTNd->SplitCntntNode( rPos );
+ pTNd = static_cast<SwTxtNode*>(pTNd->SplitCntntNode( rPos ));
if( aBkmkArr.Count() )
_RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
@@ -1132,9 +986,11 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
// setze den Pam um einen "Inhalt" zurueck; dadurch steht er immer
// ausserhalb des manipulierten Bereiches. Falls kein Inhalt mehr vor-
// handen, dann auf den StartNode (es ist immer einer vorhanden !!!)
- sal_Bool bNullCntnt = !pSavePam->Move( fnMoveBackward, fnGoCntnt );
+ sal_Bool bNullCntnt = !aSavePam.Move( fnMoveBackward, fnGoCntnt );
if( bNullCntnt )
- pSavePam->GetPoint()->nNode--;
+ {
+ aSavePam.GetPoint()->nNode--;
+ }
// kopiere alle Bookmarks, die im Move Bereich stehen in ein
// Array, das alle Angaben auf die Position als Offset speichert.
@@ -1151,31 +1007,33 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
// Bereich mehr existiert, ist das immernoch ein gueltiger Move!
if( *rPaM.GetPoint() != *rPaM.GetMark() )
{
- // jetzt kommt das eigentliche Verschieben
- GetNodes().Move( rPaM, rPos, GetNodes() );
+ // now do the actual move
+ GetNodes().MoveRange( rPaM, rPos, GetNodes() );
- if( rPaM.HasMark() ) // es wurde kein Move ausgefuehrt !!
+ // after a MoveRange() the Mark is deleted
+ if ( rPaM.HasMark() ) // => no Move occurred!
{
- delete pSavePam;
delete pUndoMove;
- return sal_False; // Nach einem Move() ist der GetMark geloescht
+ return false;
}
}
else
rPaM.DeleteMark();
- ASSERT( *pSavePam->GetMark() == rPos ||
- ( pSavePam->GetMark()->nNode.GetNode().GetCntntNode() == NULL ),
+ ASSERT( *aSavePam.GetMark() == rPos ||
+ ( aSavePam.GetMark()->nNode.GetNode().GetCntntNode() == NULL ),
"PaM wurde nicht verschoben, am Anfang/Ende keine ContentNodes?" );
- *pSavePam->GetMark() = rPos;
+ *aSavePam.GetMark() = rPos;
rPaM.SetMark(); // um den neuen Bereich eine Sel. aufspannen
- pTNd = pSavePam->GetNode()->GetTxtNode();
+ pTNd = aSavePam.GetNode()->GetTxtNode();
if( DoesUndo() )
{
// korrigiere erstmal den Content vom SavePam
if( bNullCntnt )
- pSavePam->GetPoint()->nContent = 0;
+ {
+ aSavePam.GetPoint()->nContent = 0;
+ }
// die Methode SwEditShell::Move() fuegt nach dem Move den Text-Node
// zusammen, in dem der rPaM steht. Wurde der Inhalt nach hinten
@@ -1189,7 +1047,7 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
bCorrSavePam = bCorrSavePam &&
0 != ( pPamTxtNd = rPaM.GetNode()->GetTxtNode() )
&& pPamTxtNd->CanJoinNext()
- && *rPaM.GetPoint() <= *pSavePam->GetPoint();
+ && (*rPaM.GetPoint() <= *aSavePam.GetPoint());
// muessen am SavePam 2 Nodes zusammengefasst werden ??
if( bJoin && pTNd->CanJoinNext() )
@@ -1198,16 +1056,20 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
// kein temp. sdbcx::Index bei &&
// es sollten wohl nur die Indexwerte verglichen werden.
if( bCorrSavePam && rPaM.GetPoint()->nNode.GetIndex()+1 ==
- pSavePam->GetPoint()->nNode.GetIndex() )
- pSavePam->GetPoint()->nContent += pPamTxtNd->Len();
+ aSavePam.GetPoint()->nNode.GetIndex() )
+ {
+ aSavePam.GetPoint()->nContent += pPamTxtNd->Len();
+ }
bJoin = sal_False;
}
// else if( !bCorrSavePam && !pSavePam->Move( fnMoveForward, fnGoCntnt ))
- else if( !pSavePam->Move( fnMoveForward, fnGoCntnt ))
- pSavePam->GetPoint()->nNode++;
+ else if ( !aSavePam.Move( fnMoveForward, fnGoCntnt ) )
+ {
+ aSavePam.GetPoint()->nNode++;
+ }
// zwischen SPoint und GetMark steht jetzt der neu eingefuegte Bereich
- pUndoMove->SetDestRange( *pSavePam, *rPaM.GetPoint(),
+ pUndoMove->SetDestRange( aSavePam, *rPaM.GetPoint(),
bJoin, bCorrSavePam );
AppendUndo( pUndoMove );
}
@@ -1229,15 +1091,17 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
}
if( bNullCntnt )
{
- pSavePam->GetPoint()->nNode++;
- pSavePam->GetPoint()->nContent.Assign( pSavePam->GetCntntNode(), 0 );
+ aSavePam.GetPoint()->nNode++;
+ aSavePam.GetPoint()->nContent.Assign( aSavePam.GetCntntNode(), 0 );
}
else if( bRemove ) // No move forward after joining with next paragraph
- pSavePam->Move( fnMoveForward, fnGoCntnt );
+ {
+ aSavePam.Move( fnMoveForward, fnGoCntnt );
+ }
}
// setze jetzt wieder die text::Bookmarks in das Dokument
- *rPaM.GetMark() = *pSavePam->Start();
+ *rPaM.GetMark() = *aSavePam.Start();
for(
::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin();
pBkmk != aSaveBkmks.end();
@@ -1246,15 +1110,16 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
this,
rPaM.GetMark()->nNode,
&rPaM.GetMark()->nContent);
- *rPaM.GetPoint() = *pSavePam->End();
+ *rPaM.GetPoint() = *aSavePam.End();
// verschiebe die Flys an die neue Position
_RestFlyInRange( aSaveFlyArr, rPaM.Start()->nNode, &(rPos.nNode) );
// restore redlines (if DOC_MOVEREDLINES is used)
if( aSaveRedl.Count() )
- lcl_RestoreRedlines( this, *pSavePam->Start(), aSaveRedl );
- delete pSavePam; // Better to delete an object _after_ the last use
+ {
+ lcl_RestoreRedlines( this, *aSavePam.Start(), aSaveRedl );
+ }
if( bUpdateFtn )
{
@@ -1268,10 +1133,11 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
}
SetModified();
- return sal_True;
+ return true;
}
-bool SwDoc::Move( SwNodeRange& rRange, SwNodeIndex& rPos, SwMoveFlags eMvFlags )
+bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
+ SwMoveFlags eMvFlags )
{
// bewegt alle Nodes an die neue Position. Dabei werden die
// text::Bookmarks mit verschoben !! (zur Zeit ohne Undo)
@@ -1539,7 +1405,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
pOldTxtNd->Len(), aBkmkArr );
SwIndex aAlphaIdx(pTxtNd);
- pOldTxtNd->Cut( pTxtNd, aAlphaIdx, SwIndex(pOldTxtNd),
+ pOldTxtNd->CutText( pTxtNd, aAlphaIdx, SwIndex(pOldTxtNd),
pOldTxtNd->Len() );
SwPosition aAlphaPos( aIdx, aAlphaIdx );
pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, sal_True );
@@ -1609,14 +1475,85 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
}
}
-// OD 2009-08-20 #i100466#
-// Add handling of new optional parameter <bForceJoinNext>
-bool SwDoc::DeleteAndJoin( SwPaM & rPam,
- const bool bForceJoinNext )
+static void
+lcl_CalcBreaks( ::std::vector<xub_StrLen> & rBreaks, SwPaM const & rPam )
{
- if( lcl_StrLenOverFlow( rPam ) )
- return sal_False;
- if( IsRedlineOn() )
+ SwTxtNode const * const pTxtNode(
+ rPam.End()->nNode.GetNode().GetTxtNode() );
+ if (!pTxtNode)
+ return; // left-overlap only possible at end of selection...
+
+ const xub_StrLen nStart(rPam.Start()->nContent.GetIndex());
+ const xub_StrLen nEnd (rPam.End ()->nContent.GetIndex());
+ if (nEnd == pTxtNode->Len())
+ return; // paragraph selected until the end
+
+ for (xub_StrLen i = nStart; i < nEnd; ++i)
+ {
+ const sal_Unicode c(pTxtNode->GetTxt().GetChar(i));
+ if ((CH_TXTATR_INWORD == c) || (CH_TXTATR_BREAKWORD == c))
+ {
+ SwTxtAttr const * const pAttr( pTxtNode->GetTxtAttrForCharAt(i) );
+ if (pAttr && pAttr->GetEnd() && (*pAttr->GetEnd() > nEnd))
+ {
+ ASSERT(pAttr->HasDummyChar(), "GetTxtAttrForCharAt broken?");
+ rBreaks.push_back(i);
+ }
+ }
+ }
+}
+
+bool lcl_DoWithBreaks(SwDoc & rDoc, SwPaM & rPam,
+ bool (SwDoc::*pFunc)(SwPaM&, bool), const bool bForceJoinNext = false)
+{
+ ::std::vector<xub_StrLen> Breaks;
+
+ lcl_CalcBreaks(Breaks, rPam);
+
+ if (!Breaks.size())
+ {
+ return (rDoc.*pFunc)(rPam, bForceJoinNext);
+ }
+
+ // N.B.: deletion must be split into several parts if the text node
+ // contains a text attribute with end and with dummy character
+ // and the selection does not contain the text attribute completely,
+ // but overlaps its start (left), where the dummy character is.
+
+ SwPosition const & rSelectionEnd( *rPam.End() );
+
+ bool bRet( true );
+ // iterate from end to start, to avoid invalidating the offsets!
+ ::std::vector<xub_StrLen>::reverse_iterator iter( Breaks.rbegin() );
+ SwPaM aPam( rSelectionEnd, rSelectionEnd ); // end node!
+ SwPosition & rEnd( *aPam.End() );
+ SwPosition & rStart( *aPam.Start() );
+
+ while (iter != Breaks.rend())
+ {
+ rStart.nContent = *iter + 1;
+ if (rEnd.nContent > rStart.nContent) // check if part is empty
+ {
+ bRet &= (rDoc.*pFunc)(aPam, bForceJoinNext);
+ }
+ rEnd.nContent = *iter;
+ ++iter;
+ }
+
+ rStart = *rPam.Start(); // set to original start
+ if (rEnd.nContent > rStart.nContent) // check if part is empty
+ {
+ bRet &= (rDoc.*pFunc)(aPam, bForceJoinNext);
+ }
+
+ return bRet;
+}
+
+
+bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool )
+{
+ ASSERT( IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" );
+
{
sal_uInt16 nUndoSize = 0;
SwUndoRedlineDelete* pUndo = 0;
@@ -1656,9 +1593,13 @@ bool SwDoc::DeleteAndJoin( SwPaM & rPam,
//JP 06.01.98: MUSS noch optimiert werden!!!
SetRedlineMode( eOld );
}
- return sal_True;
+ return true;
}
+}
+bool SwDoc::DeleteAndJoinImpl( SwPaM & rPam,
+ const bool bForceJoinNext )
+{
sal_Bool bJoinTxt, bJoinPrev;
lcl_GetJoinFlags( rPam, bJoinTxt, bJoinPrev );
// --> OD 2009-08-20 #i100466#
@@ -1674,8 +1615,9 @@ SetRedlineMode( eOld );
SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() );
- if( !Delete( aDelPam ) )
- return sal_False;
+ const bool bSuccess( DeleteRangeImpl( aDelPam ) );
+ if (!bSuccess)
+ return false;
*rPam.GetPoint() = *aDelPam.GetPoint();
}
@@ -1685,15 +1627,15 @@ SetRedlineMode( eOld );
lcl_JoinText( rPam, bJoinPrev );
}
- return sal_True;
+ return true;
}
-bool SwDoc::Delete( SwPaM & rPam )
+bool SwDoc::DeleteRangeImpl( SwPaM & rPam, const bool )
{
SwPosition *pStt = (SwPosition*)rPam.Start(), *pEnd = (SwPosition*)rPam.End();
if( !rPam.HasMark() || *pStt >= *pEnd )
- return sal_False;
+ return false;
if( pACEWord )
{
@@ -1748,7 +1690,7 @@ bool SwDoc::Delete( SwPaM & rPam )
SetModified();
- return sal_True;
+ return true;
}
if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
@@ -1782,7 +1724,7 @@ bool SwDoc::Delete( SwPaM & rPam )
// falls schon leer, dann nicht noch aufrufen
if( nLen )
{
- pStartTxtNode->Erase( pStt->nContent, nLen );
+ pStartTxtNode->EraseText( pStt->nContent, nLen );
if( !pStartTxtNode->Len() )
{
@@ -1814,7 +1756,7 @@ bool SwDoc::Delete( SwPaM & rPam )
if( pEnd->nContent.GetIndex() )
{
SwIndex aIdx( pCNd, 0 );
- pEndTxtNode->Erase( aIdx, pEnd->nContent.GetIndex() );
+ pEndTxtNode->EraseText( aIdx, pEnd->nContent.GetIndex() );
if( !pEndTxtNode->Len() )
{
@@ -1859,9 +1801,29 @@ bool SwDoc::Delete( SwPaM & rPam )
CompressRedlines();
SetModified();
- return sal_True;
+ return true;
+}
+
+// OD 2009-08-20 #i100466#
+// Add handling of new optional parameter <bForceJoinNext>
+bool SwDoc::DeleteAndJoin( SwPaM & rPam,
+ const bool bForceJoinNext )
+{
+ if ( lcl_StrLenOverFlow( rPam ) )
+ return false;
+
+ return lcl_DoWithBreaks( *this, rPam, (IsRedlineOn())
+ ? &SwDoc::DeleteAndJoinWithRedlineImpl
+ : &SwDoc::DeleteAndJoinImpl,
+ bForceJoinNext );
}
+bool SwDoc::DeleteRange( SwPaM & rPam )
+{
+ return lcl_DoWithBreaks( *this, rPam, &SwDoc::DeleteRangeImpl );
+}
+
+
void lcl_syncGrammarError( SwTxtNode &rTxtNode, linguistic2::ProofreadingResult& rResult,
xub_StrLen /*nBeginGrammarCheck*/, const ModelToViewHelper::ConversionMap* pConversionMap )
{
@@ -2235,12 +2197,86 @@ sal_Bool lcl_GetTokenToParaBreak( String& rStr, String& rRet, sal_Bool bRegExpRp
return bRet;
}
+bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr,
+ const bool bRegExReplace )
+{
+ // unfortunately replace works slightly differently from delete,
+ // so we cannot use lcl_DoWithBreaks here...
+
+ ::std::vector<xub_StrLen> Breaks;
+
+ SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
+ aPam.Normalize(FALSE);
+ if (aPam.GetPoint()->nNode != aPam.GetMark()->nNode)
+ {
+ aPam.Move(fnMoveBackward);
+ }
+ ASSERT((aPam.GetPoint()->nNode == aPam.GetMark()->nNode), "invalid pam?");
+
+ lcl_CalcBreaks(Breaks, aPam);
+
+ while (!Breaks.empty() // skip over prefix of dummy chars
+ && (aPam.GetMark()->nContent.GetIndex() == *Breaks.begin()) )
+ {
+ // skip!
+ ++aPam.GetMark()->nContent; // always in bounds if Breaks valid
+ Breaks.erase(Breaks.begin());
+ }
+ *rPam.Start() = *aPam.GetMark(); // update start of original pam w/ prefix
+
+ if (!Breaks.size())
+ {
+ return ReplaceRangeImpl(rPam, rStr, bRegExReplace); // original pam!
+ }
+
+ // N.B.: deletion must be split into several parts if the text node
+ // contains a text attribute with end and with dummy character
+ // and the selection does not contain the text attribute completely,
+ // but overlaps its start (left), where the dummy character is.
+
+ bool bRet( true );
+ // iterate from end to start, to avoid invalidating the offsets!
+ ::std::vector<xub_StrLen>::reverse_iterator iter( Breaks.rbegin() );
+ ASSERT(aPam.GetPoint() == aPam.End(), "wrong!");
+ SwPosition & rEnd( *aPam.End() );
+ SwPosition & rStart( *aPam.Start() );
+
+ // set end of temp pam to original end (undo Move backward above)
+ rEnd = *rPam.End();
+ // after first deletion, rEnd will point into the original text node again!
+
+ while (iter != Breaks.rend())
+ {
+ rStart.nContent = *iter + 1;
+ if (rEnd.nContent != rStart.nContent) // check if part is empty
+ {
+ bRet &= (IsRedlineOn())
+ ? DeleteAndJoinWithRedlineImpl(aPam)
+ : DeleteAndJoinImpl(aPam, false);
+ }
+ rEnd.nContent = *iter;
+ ++iter;
+ }
+
+ rStart = *rPam.Start(); // set to original start
+ ASSERT(rEnd.nContent > rStart.nContent, "replace part empty!");
+ if (rEnd.nContent > rStart.nContent) // check if part is empty
+ {
+ bRet &= ReplaceRangeImpl(aPam, rStr, bRegExReplace);
+ }
+
+ rPam = aPam; // update original pam (is this required?)
+
+ return bRet;
+}
+
// N.B.: it is possible to call Replace with a PaM that spans 2 paragraphs:
// search with regex for "$", then replace _all_
-bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc )
+bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
+ const bool bRegExReplace )
{
if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark() )
- return sal_False;
+ return false;
sal_Bool bJoinTxt, bJoinPrev;
lcl_GetJoinFlags( rPam, bJoinTxt, bJoinPrev );
@@ -2257,7 +2293,7 @@ bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc )
ASSERT( pStt->nNode == pEnd->nNode ||
( pStt->nNode.GetIndex() + 1 == pEnd->nNode.GetIndex() &&
!pEnd->nContent.GetIndex() ),
- "Point & Mark zeigen auf verschiedene Nodes" );
+ "invalid range: Point and Mark on different nodes" );
sal_Bool bOneNode = pStt->nNode == pEnd->nNode;
// eigenes Undo ????
@@ -2304,6 +2340,10 @@ bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc )
aSet.ClearItem( RES_TXTATR_REFMARK );
aSet.ClearItem( RES_TXTATR_TOXMARK );
+ aSet.ClearItem( RES_TXTATR_CJK_RUBY );
+ aSet.ClearItem( RES_TXTATR_INETFMT );
+ aSet.ClearItem( RES_TXTATR_META );
+ aSet.ClearItem( RES_TXTATR_METAFIELD );
if( aDelPam.GetPoint() != aDelPam.End() )
aDelPam.Exchange();
@@ -2314,9 +2354,9 @@ bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc )
sal_Bool bFirst = sal_True;
String sIns;
- while( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExpRplc ))
+ while ( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExReplace ) )
{
- Insert( aDelPam, sIns, true );
+ InsertString( aDelPam, sIns );
if( bFirst )
{
SwNodeIndex aMkNd( aDelPam.GetMark()->nNode, -1 );
@@ -2334,7 +2374,9 @@ bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc )
SplitNode( *aDelPam.GetPoint(), false );
}
if( sIns.Len() )
- Insert( aDelPam, sIns, true );
+ {
+ InsertString( aDelPam, sIns );
+ }
SwPaM aTmpRange( *aDelPam.GetPoint() );
aTmpRange.SetMark();
@@ -2346,7 +2388,7 @@ bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc )
*aTmpRange.GetMark() = *aDelPam.GetPoint();
RstTxtAttrs( aTmpRange );
- Insert( aTmpRange, aSet, 0 );
+ InsertItemSet( aTmpRange, aSet, 0 );
}
if( DoesUndo() )
@@ -2396,7 +2438,7 @@ SetRedlineMode( eOld );
pUndoRpl = new SwUndoReplace();
AppendUndo( pUndoRpl );
}
- pUndoRpl->AddEntry( aDelPam, sRepl, bRegExpRplc );
+ pUndoRpl->AddEntry( aDelPam, sRepl, bRegExReplace );
DoUndo( sal_False );
}
@@ -2414,12 +2456,16 @@ SetRedlineMode( eOld );
sal_Bool bFirst = sal_True;
String sIns;
- while( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExpRplc ))
+ while ( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExReplace ) )
{
if( !bFirst || nStt == pTxtNd->GetTxt().Len() )
- Insert( aDelPam, sIns, true );
+ {
+ InsertString( aDelPam, sIns );
+ }
else if( nStt < nEnd || sIns.Len() )
- pTxtNd->Replace( pStt->nContent, nEnd - nStt, sIns );
+ {
+ pTxtNd->ReplaceText( pStt->nContent, nEnd - nStt, sIns );
+ }
SplitNode( *pStt, false);
bFirst = sal_False;
}
@@ -2427,9 +2473,13 @@ SetRedlineMode( eOld );
if( bFirst || sIns.Len() )
{
if( !bFirst || nStt == pTxtNd->GetTxt().Len() )
- Insert( aDelPam, sIns, true );
+ {
+ InsertString( aDelPam, sIns );
+ }
else if( nStt < nEnd || sIns.Len() )
- pTxtNd->Replace( pStt->nContent, nEnd - nStt, sIns );
+ {
+ pTxtNd->ReplaceText( pStt->nContent, nEnd - nStt, sIns );
+ }
}
*rPam.GetMark() = *aDelPam.GetMark();
@@ -2453,7 +2503,7 @@ SetRedlineMode( eOld );
lcl_JoinText( rPam, bJoinPrev );
SetModified();
- return sal_True;
+ return true;
}
// speicher die akt. Werte fuer die automatische Aufnahme von Ausnahmen
@@ -2619,8 +2669,8 @@ void SwDoc::TransliterateText( const SwPaM& rPaM,
if( pStt == pEnd && pTNd ) // no region ?
{
Boundary aBndry;
- if( pBreakIt->xBreak.is() )
- aBndry = pBreakIt->xBreak->getWordBoundary(
+ if( pBreakIt->GetBreakIter().is() )
+ aBndry = pBreakIt->GetBreakIter()->getWordBoundary(
pTNd->GetTxt(), nSttCnt,
pBreakIt->GetLocale( pTNd->GetLang( nSttCnt ) ),
WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
@@ -2750,7 +2800,7 @@ void SwDoc::RemoveLeadingWhiteSpace(const SwPosition & rPos )
aPam.GetPoint()->nContent = 0;
aPam.SetMark();
aPam.GetMark()->nContent = nIdx;
- Delete( aPam );
+ DeleteRange( aPam );
}
}
}
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 184fd08a4afc..507e63ba7a47 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -274,18 +274,17 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms
SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
- SwTxtAttr * pHnt = pTxtNode->GetTxtAttr( nIdx, RES_TXTATR_FLYCNT );
-#ifndef PRODUCT
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
"Missing FlyInCnt-Hint." );
ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == &rFmt,
"Wrong TxtFlyCnt-Hint." );
-#endif
- ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt();
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt();
//Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet
//werden.
- pTxtNode->Delete( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
}
//Endlich kann das Attribut gesetzt werden. Es muss das erste Attribut
@@ -305,8 +304,8 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms
SwTxtNode *pNd = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pNd, "Crsr steht nicht auf TxtNode." );
- pNd->InsertItem( SwFmtFlyCnt( (SwFlyFrmFmt*)&rFmt ),
- pPos->nContent.GetIndex(), 0 );
+ SwFmtFlyCnt aFmt( static_cast<SwFlyFrmFmt*>(&rFmt) );
+ pNd->InsertItem( aFmt, pPos->nContent.GetIndex(), 0 );
}
if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, FALSE, &pItem ))
@@ -830,10 +829,10 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
// 'center to baseline'
SetAttr( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ), *pContact->GetFmt() );
SwTxtNode *pNd = aPos.nNode.GetNode().GetTxtNode();
- ASSERT( pNd, "Crsr steht nicht auf TxtNode." );
+ ASSERT( pNd, "Cursor not positioned at TxtNode." );
- pNd->InsertItem( SwFmtFlyCnt( pContact->GetFmt() ),
- aPos.nContent.GetIndex(), 0 );
+ SwFmtFlyCnt aFmt( pContact->GetFmt() );
+ pNd->InsertItem( aFmt, aPos.nContent.GetIndex(), 0 );
}
break;
default:
@@ -880,12 +879,13 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
SwTxtNode* pTxtNode( pOldAsCharAnchorPos->nNode.GetNode().GetTxtNode() );
ASSERT( pTxtNode, "<SwDoc::ChgAnchor(..)> - missing previous anchor text node for as-character anchored object" );
ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
- SwTxtAttr* pHnt = pTxtNode->GetTxtAttr( nIndx, RES_TXTATR_FLYCNT );
- ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt();
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt( nIndx, RES_TXTATR_FLYCNT );
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt();
//Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet
//werden.
- pTxtNode->Delete( RES_TXTATR_FLYCNT, nIndx, nIndx );
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIndx, nIndx );
delete pOldAsCharAnchorPos;
}
// <--
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 9db1c98685f3..c054b7ee5579 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -411,8 +411,8 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
else
{
Boundary aBndry;
- if( pBreakIt->xBreak.is() )
- aBndry = pBreakIt->xBreak->getWordBoundary(
+ if( pBreakIt->GetBreakIter().is() )
+ aBndry = pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
@@ -461,6 +461,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
ParaRstFmt aPara( pStt, pEnd, pHst );
+ // mst: not including META here; it seems attrs with CH_TXTATR are omitted
USHORT __FAR_DATA aResetableSetRange[] = {
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
@@ -468,9 +469,10 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
// --> OD 2008-02-25 #refactorlists#
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
// <--
- RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
- RES_TXTATR_CJK_RUBY, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0
};
@@ -524,12 +526,15 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
{
if ( pHst )
{
- SwRegHistory( pTNd, aCharSet, 0, pTNd->GetTxt().Len(), nsSetAttrMode::SETATTR_NOFORMATATTR, pHst );
+ SwRegHistory history( pTNd, *pTNd, pHst );
+ history.InsertItems( aCharSet, 0, pTNd->GetTxt().Len(),
+ nsSetAttrMode::SETATTR_NOFORMATATTR );
}
else
{
- SwTxtAttr* pNew = pTNd->MakeTxtAttr( aCharSet, 0, pTNd->GetTxt().Len() );
- pTNd->Insert( pNew );
+ SwTxtAttr* pNew =
+ MakeTxtAttr( *this, aCharSet, 0, pTNd->GetTxt().Len() );
+ pTNd->InsertHint( pNew );
}
}
}
@@ -550,11 +555,12 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
{
if( IsInRange( aCharFmtSetRange, pItem->Which() ))
{
- SwTxtAttr* pTAttr = pTNd->MakeTxtAttr( *pItem, 0,
- pTNd->GetTxt().Len() );
+ SwTxtAttr* pTAttr = MakeTxtAttr( *this,
+ const_cast<SfxPoolItem&>(*pItem),
+ 0, pTNd->GetTxt().Len() );
SwpHints & rHints = pTNd->GetOrCreateSwpHints();
rHints.SwpHintsArray::Insert( pTAttr );
- if( pHst )
+ if ( pHst )
{
SwRegHistory aRegH( pTNd, *pTNd, pHst );
pTNd->ResetAttr( pItem->Which() );
@@ -597,8 +603,9 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
// Einfuegen der Hints nach Inhaltsformen;
// wird in SwDoc::Insert(..., SwFmtHint &rHt) benutzt
-BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
- USHORT nFlags, SwUndoAttr* pUndo )
+static bool
+lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
+ const SetAttrMode nFlags, SwUndoAttr *const pUndo)
{
// teil die Sets auf (fuer Selektion in Nodes)
const SfxItemSet* pCharSet = 0;
@@ -668,7 +675,7 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
}
SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0;
- BOOL bRet = FALSE;
+ bool bRet = false;
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
SwCntntNode* pNode = pStt->nNode.GetNode().GetCntntNode();
@@ -686,7 +693,7 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
ASSERT( false,
"<InsAttr(..)> - PaM in front of label, but text node has no numbering rule set. This is a serious defect, please inform OD." );
DELETECHARSETS
- return FALSE;
+ return false;
}
// <--
@@ -704,7 +711,7 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
}
DELETECHARSETS
- return TRUE;
+ return true;
}
// <- #i27615#
@@ -718,12 +725,12 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
aTxtSet.Put( rChgSet );
if( aTxtSet.Count() )
{
- SwRegHistory( (SwTxtNode*)pNode, aTxtSet, rSt.GetIndex(),
- rSt.GetIndex(), nFlags, pHistory );
- bRet = TRUE;
+ SwRegHistory history( pNode, *pNode, pHistory );
+ bRet = history.InsertItems(
+ aTxtSet, rSt.GetIndex(), rSt.GetIndex(), nFlags ) || bRet;
- if( pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline() &&
- pDoc->GetRedlineTbl().Count() ))
+ if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
+ && pDoc->GetRedlineTbl().Count())))
{
SwPaM aPam( pStt->nNode, pStt->nContent.GetIndex()-1,
pStt->nNode, pStt->nContent.GetIndex() );
@@ -747,7 +754,8 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
// TEST_TEMP ToDo: AutoFmt!
SfxItemSet aTxtSet( pDoc->GetAttrPool(),
RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK,
- RES_TXTATR_DUMMY5, RES_TXTATR_WITHEND_END-1,
+ RES_TXTATR_META, RES_TXTATR_METAFIELD,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_WITHEND_END-1,
0 );
aTxtSet.Put( rChgSet );
@@ -757,12 +765,12 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
USHORT nEnd = pStt->nNode == pEnd->nNode
? pEnd->nContent.GetIndex()
: pNode->Len();
- SwRegHistory( (SwTxtNode*)pNode, aTxtSet, nInsCnt,
- nEnd, nFlags, pHistory );
- bRet = TRUE;
+ SwRegHistory history( pNode, *pNode, pHistory );
+ bRet = history.InsertItems( aTxtSet, nInsCnt, nEnd, nFlags )
+ || bRet;
- if( pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline() &&
- pDoc->GetRedlineTbl().Count() ) )
+ if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
+ && pDoc->GetRedlineTbl().Count())))
{
// wurde Text-Inhalt eingefuegt? (RefMark/TOXMarks ohne Ende)
BOOL bTxtIns = nInsCnt != rSt.GetIndex();
@@ -784,7 +792,6 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
// bei PageDesc's, die am Node gesetzt werden, muss immer das
// Auto-Flag gesetzt werden!!
- const SvxLRSpaceItem* pLRSpace = 0;
if( pOtherSet && pOtherSet->Count() )
{
SwTableNode* pTblNd;
@@ -811,11 +818,12 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt();
SwRegHistory aRegH( pFmt, *pTblNd, pHistory );
pFmt->SetFmtAttr( aNew );
+ bRet = true;
}
else
{
SwRegHistory aRegH( pNode, *pNode, pHistory );
- pNode->SetAttr( aNew );
+ bRet = pNode->SetAttr( aNew ) || bRet;
}
}
@@ -823,13 +831,13 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
// we know, that there is only one attribute in pOtherSet. We cannot
// perform the following operations, instead we return:
if ( bOtherAttr )
- return TRUE;
+ return bRet;
const_cast<SfxItemSet*>(pOtherSet)->ClearItem( RES_PAGEDESC );
if( !pOtherSet->Count() )
{
DELETECHARSETS
- return TRUE;
+ return bRet;
}
}
@@ -848,25 +856,22 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt();
SwRegHistory aRegH( pFmt, *pTblNd, pHistory );
pFmt->SetFmtAttr( *pBreak );
+ bRet = true;
// bOtherAttr = true means that pOtherSet == rChgSet. In this case
// we know, that there is only one attribute in pOtherSet. We cannot
// perform the following operations, instead we return:
if ( bOtherAttr )
- return TRUE;
+ return bRet;
const_cast<SfxItemSet*>(pOtherSet)->ClearItem( RES_BREAK );
if( !pOtherSet->Count() )
{
DELETECHARSETS
- return TRUE;
+ return bRet;
}
}
- // fuer Sonderbehandlung von LR-Space innerhalb einer Numerierung !!!
- pOtherSet->GetItemState( RES_LR_SPACE, FALSE,
- (const SfxPoolItem**)&pLRSpace );
-
{
// wenns eine PoolNumRule ist, diese ggfs. anlegen
const SwNumRuleItem* pRule;
@@ -891,7 +896,7 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
{
- SwTxtNode* pTxtNd = (SwTxtNode*)pNode;
+ SwTxtNode* pTxtNd = static_cast<SwTxtNode*>(pNode);
const SwIndex& rSt = pStt->nContent;
USHORT nMkPos, nPtPos = rSt.GetIndex();
const String& rStr = pTxtNd->GetTxt();
@@ -909,8 +914,8 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
else
{
Boundary aBndry;
- if( pBreakIt->xBreak.is() )
- aBndry = pBreakIt->xBreak->getWordBoundary(
+ if( pBreakIt->GetBreakIter().is() )
+ aBndry = pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
@@ -946,10 +951,10 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
pTxtNd->RstAttr( aSt, nPtPos, 0, pCharSet );
}
- // eintragen des Attributes im Node erledigt die SwRegHistory !!
- SwRegHistory( (SwTxtNode*)pNode, *pCharSet,
- nMkPos, nPtPos, nFlags, pHistory );
- bRet = TRUE;
+ // the SwRegHistory inserts the attribute into the TxtNode!
+ SwRegHistory history( pNode, *pNode, pHistory );
+ bRet = history.InsertItems( *pCharSet, nMkPos, nPtPos, nFlags )
+ || bRet;
if( pDoc->IsRedlineOn() )
{
@@ -963,8 +968,7 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
if( pOtherSet && pOtherSet->Count() )
{
SwRegHistory aRegH( pNode, *pNode, pHistory );
- pNode->SetAttr( *pOtherSet );
- bRet = TRUE;
+ bRet = pNode->SetAttr( *pOtherSet ) || bRet;
}
DELETECHARSETS
@@ -993,25 +997,26 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
if( pStt->nContent.GetIndex() != 0 || aCntEnd.GetIndex() != nLen )
{
- // eintragen des Attributes im Node erledigt die SwRegHistory !!
+ // the SwRegHistory inserts the attribute into the TxtNode!
if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
{
- SwRegHistory( (SwTxtNode*)pNode, *pCharSet,
- pStt->nContent.GetIndex(), aCntEnd.GetIndex(),
- nFlags, pHistory );
+ SwRegHistory history( pNode, *pNode, pHistory );
+ bRet = history.InsertItems(*pCharSet,
+ pStt->nContent.GetIndex(), aCntEnd.GetIndex(), nFlags)
+ || bRet;
}
if( pOtherSet && pOtherSet->Count() )
{
SwRegHistory aRegH( pNode, *pNode, pHistory );
- pNode->SetAttr( *pOtherSet );
+ bRet = pNode->SetAttr( *pOtherSet ) || bRet;
}
// lediglich Selektion in einem Node.
if( pStt->nNode == pEnd->nNode )
{
DELETECHARSETS
- return TRUE;
+ return bRet;
}
++nNodes;
aSt.Assign( pStt->nNode.GetNode(), +1 );
@@ -1036,11 +1041,12 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
USHORT nLen = pNode->Len();
if( aCntEnd.GetIndex() != nLen )
{
- // eintragen des Attributes im Node erledigt die SwRegHistory !!
+ // the SwRegHistory inserts the attribute into the TxtNode!
if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
{
- SwRegHistory( (SwTxtNode*)pNode, *pCharSet,
- 0, aCntEnd.GetIndex(), nFlags, pHistory );
+ SwRegHistory history( pNode, *pNode, pHistory );
+ history.InsertItems(*pCharSet,
+ 0, aCntEnd.GetIndex(), nFlags);
}
if( pOtherSet && pOtherSet->Count() )
@@ -1113,14 +1119,14 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
}
DELETECHARSETS
- return nNodes != 0;
+ return (nNodes != 0) || bRet;
}
-bool SwDoc::Insert( const SwPaM &rRg, const SfxPoolItem &rHt, USHORT nFlags )
+bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt,
+ const SetAttrMode nFlags )
{
SwDataChanged aTmp( rRg, 0 );
- BOOL bRet;
SwUndoAttr* pUndoAttr = 0;
if( DoesUndo() )
{
@@ -1130,7 +1136,7 @@ bool SwDoc::Insert( const SwPaM &rRg, const SfxPoolItem &rHt, USHORT nFlags )
SfxItemSet aSet( GetAttrPool(), rHt.Which(), rHt.Which() );
aSet.Put( rHt );
- bRet = InsAttr( this, rRg, aSet, nFlags, pUndoAttr );
+ bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr );
if( DoesUndo() )
AppendUndo( pUndoAttr );
@@ -1140,17 +1146,18 @@ bool SwDoc::Insert( const SwPaM &rRg, const SfxPoolItem &rHt, USHORT nFlags )
return bRet;
}
-bool SwDoc::Insert( const SwPaM &rRg, const SfxItemSet &rSet, USHORT nFlags )
+bool SwDoc::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet,
+ const SetAttrMode nFlags )
{
SwDataChanged aTmp( rRg, 0 );
SwUndoAttr* pUndoAttr = 0;
if( DoesUndo() )
{
ClearRedo();
- pUndoAttr = new SwUndoAttr( rRg, rSet );
+ pUndoAttr = new SwUndoAttr( rRg, rSet, nFlags );
}
- BOOL bRet = InsAttr( this, rRg, rSet, nFlags, pUndoAttr );
+ bool bRet = lcl_InsAttr( this, rRg, rSet, nFlags, pUndoAttr );
if( DoesUndo() )
AppendUndo( pUndoAttr );
@@ -2096,7 +2103,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr,
}
}
-void SwDoc::_CopyPageDescHeaderFooter( BOOL bCpyHeader,
+void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader,
const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
{
// jetzt noch Header-/Footer-Attribute richtig behandeln
@@ -2139,7 +2146,7 @@ void SwDoc::_CopyPageDescHeaderFooter( BOOL bCpyHeader,
aTmpIdx = *pSttNd->EndOfSectionNode();
rSrcNds._Copy( aRg, aTmpIdx );
aTmpIdx = *pSttNd;
- rSrcFmt.GetDoc()->_CopyFlyInFly( aRg, 0, aTmpIdx );
+ rSrcFmt.GetDoc()->CopyFlyInFlyImpl( aRg, 0, aTmpIdx );
pNewFmt->SetFmtAttr( SwFmtCntnt( pSttNd ));
}
else
@@ -2499,7 +2506,7 @@ void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, USHORT nPoolId,
{
aPam.SetMark();
aPam.GetMark()->nContent.Assign( pTNd, pTNd->GetTxt().Len() );
- Insert( aPam, *pSet, 0 );
+ InsertItemSet( aPam, *pSet, 0 );
}
}
@@ -2541,7 +2548,7 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet )
SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
}
- Insert( rPam, rSet, nsSetAttrMode::SETATTR_DONTEXPAND );
+ InsertItemSet( rPam, rSet, nsSetAttrMode::SETATTR_DONTEXPAND );
SetRedlineMode_intern( eOld );
}
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index b340b1ce45fb..113319494e03 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -307,7 +307,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath,
pDoc->GetNodes().Delete( aIdx, 1 );
// alle Flys in dem Bereich
- _CopyFlyInFly( aRg, 0, aIdx );
+ CopyFlyInFlyImpl( aRg, 0, aIdx );
// und noch alle Bookmarks
@@ -653,7 +653,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel )
pDoc->GetNodes().Delete( aIdx, 1 );
// alle Flys in dem Bereich
- _CopyFlyInFly( aRg, 0, aIdx );
+ CopyFlyInFlyImpl( aRg, 0, aIdx );
// und noch alle Bookmarks
diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx
index 2f3f58e76f3b..a118bf754025 100644
--- a/sw/source/core/doc/docglos.cxx
+++ b/sw/source/core/doc/docglos.cxx
@@ -183,7 +183,7 @@ BOOL SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry,
SwDontExpandItem aACD;
aACD.SaveDontExpandItems( rInsPos );
- pGDoc->Copy( aCpyPam, rInsPos, false );
+ pGDoc->CopyRange( aCpyPam, rInsPos, false );
aACD.RestoreDontExpandItems( rInsPos );
if( pShell )
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 77df07dcb2d3..1af12a64bf2f 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -362,17 +362,20 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt )
{
const SwPosition* pPos = rAnchor.GetCntntAnchor();
SwTxtNode *pTxtNd = pPos->nNode.GetNode().GetTxtNode();
- SwTxtFlyCnt* pAttr;
- // Attribut steht noch im TextNode, loeschen
- if( pTxtNd && 0 != ( pAttr = ((SwTxtFlyCnt*)pTxtNd->GetTxtAttr(
- pPos->nContent.GetIndex() ))) &&
- pAttr->GetFlyCnt().GetFrmFmt() == pFmt )
+ // attribute is still in text node, delete it
+ if ( pTxtNd )
{
- // Pointer auf 0, nicht loeschen
- ((SwFmtFlyCnt&)pAttr->GetFlyCnt()).SetFlyFmt();
- SwIndex aIdx( pPos->nContent );
- pTxtNd->Erase( aIdx, 1 );
+ SwTxtFlyCnt* const pAttr = static_cast<SwTxtFlyCnt*>(
+ pTxtNd->GetTxtAttrForCharAt( pPos->nContent.GetIndex(),
+ RES_TXTATR_FLYCNT ));
+ if ( pAttr && (pAttr->GetFlyCnt().GetFrmFmt() == pFmt) )
+ {
+ // dont delete, set pointer to 0
+ const_cast<SwFmtFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFmt();
+ SwIndex aIdx( pPos->nContent );
+ pTxtNd->EraseText( aIdx, 1 );
+ }
}
}
@@ -550,9 +553,10 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
if( bSetTxtFlyAtt && FLY_IN_CNTNT == rNewAnchor.GetAnchorId() )
{
- SwPosition* pPos = (SwPosition*)rNewAnchor.GetCntntAnchor();
- pPos->nNode.GetNode().GetTxtNode()->InsertItem(SwFmtFlyCnt( pDest ),
- pPos->nContent.GetIndex(), 0 );
+ const SwPosition* pPos = rNewAnchor.GetCntntAnchor();
+ SwFmtFlyCnt aFmt( pDest );
+ pPos->nNode.GetNode().GetTxtNode()->InsertItem(
+ aFmt, pPos->nContent.GetIndex(), 0 );
}
if( bMakeFrms )
@@ -698,7 +702,10 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos,
ASSERT(pTxtNode!= 0, "There should be a SwTxtNode!");
if (pTxtNode != NULL)
- pTxtNode->InsertItem(SwFmtFlyCnt( pFmt ), nStt, nStt );
+ {
+ SwFmtFlyCnt aFmt( pFmt );
+ pTxtNode->InsertItem( aFmt, nStt, nStt );
+ }
}
if( SFX_ITEM_SET != pFmt->GetAttrSet().GetItemState( RES_FRM_SIZE ))
@@ -844,7 +851,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
GetNodes().MakeTxtNode( aRg.aStart,
(SwTxtFmtColl*)GetDfltTxtFmtColl() );
- Move( aRg, aPos.nNode, DOC_MOVEDEFAULT );
+ MoveNodeRange( aRg, aPos.nNode, DOC_MOVEDEFAULT );
}
else
{
@@ -885,8 +892,11 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht.
do {
if( pTmp->HasMark() &&
*pTmp->GetPoint() != *pTmp->GetMark() )
- Copy( *pTmp, aPos, false );
- } while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ) );
+ {
+ CopyRange( *pTmp, aPos, false );
+ }
+ pTmp = static_cast<SwPaM*>(pTmp->GetNext());
+ } while ( &rPam != pTmp );
mbCopyIsMove = bOldFlag;
mbUndo = bOldUndo;
@@ -894,8 +904,11 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht.
do {
if( pTmp->HasMark() &&
*pTmp->GetPoint() != *pTmp->GetMark() )
+ {
DeleteAndJoin( *pTmp );
- } while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ) );
+ }
+ pTmp = static_cast<SwPaM*>(pTmp->GetNext());
+ } while ( &rPam != pTmp );
}
} while( sal_False );
}
@@ -982,8 +995,9 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
if( FLY_IN_CNTNT == eAnchorId )
{
xub_StrLen nStt = rRg.GetPoint()->nContent.GetIndex();
+ SwFmtFlyCnt aFmt( pFmt );
rRg.GetPoint()->nNode.GetNode().GetTxtNode()->InsertItem(
- SwFmtFlyCnt( pFmt ), nStt, nStt );
+ aFmt, nStt, nStt );
}
SwDrawContact* pContact = new SwDrawContact( pFmt, &rDrawObj );
@@ -1379,16 +1393,16 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
- SwTxtAttr *pHnt = pTxtNode->GetTxtAttr( nIdx, RES_TXTATR_FLYCNT );
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt(nIdx, RES_TXTATR_FLYCNT);
-#ifndef PRODUCT
ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
"Missing FlyInCnt-Hint." );
- ASSERT( pHnt && ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).
- GetFrmFmt() == pOldFmt,
+ ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pOldFmt,
"Wrong TxtFlyCnt-Hint." );
-#endif
- ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt( pNewFmt );
+
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt(
+ pNewFmt );
}
@@ -1466,7 +1480,7 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
//String einfuegen
SwIndex aIdx( pNew, 0 );
- pNew->Insert( aTxt, aIdx );
+ pNew->InsertText( aTxt, aIdx );
//
//Feld einfuegen
@@ -1475,7 +1489,8 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
SwSetExpField aFld( (SwSetExpFieldType*)pType, aEmptyStr, SVX_NUM_ARABIC);
if( bOrderNumberingFirst )
nIdx = 0;
- pNew->InsertItem( SwFmtFld( aFld ), nIdx, nIdx );
+ SwFmtFld aFmt( aFld );
+ pNew->InsertItem( aFmt, nIdx, nIdx );
if(rCharacterStyle.Len())
{
SwCharFmt* pCharFmt = FindCharFmtByName( rCharacterStyle );
@@ -1484,9 +1499,12 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
const USHORT nMyId = SwStyleNameMapper::GetPoolIdFromUIName(rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
pCharFmt = GetCharFmtFromPool( nMyId );
}
- if(pCharFmt)
- pNew->InsertItem( SwFmtCharFmt( pCharFmt ), 0,
- nSepIdx + 1, nsSetAttrMode::SETATTR_DONTEXPAND );
+ if (pCharFmt)
+ {
+ SwFmtCharFmt aCharFmt( pCharFmt );
+ pNew->InsertItem( aCharFmt, 0,
+ nSepIdx + 1, nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
}
}
@@ -1672,7 +1690,8 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
- SwTxtAttr *pHnt = pTxtNode->GetTxtAttr( nIdx, RES_TXTATR_FLYCNT );
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
#ifndef PRODUCT
ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
@@ -1681,7 +1700,7 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
GetFrmFmt() == (SwFrmFmt*)pOldFmt,
"Wrong TxtFlyCnt-Hint." );
#endif
- ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt( pNewFmt );
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt( pNewFmt );
}
@@ -1751,7 +1770,7 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
// insert text
SwIndex aIdx( pNew, 0 );
- pNew->Insert( aTxt, aIdx );
+ pNew->InsertText( aTxt, aIdx );
// insert field
if ( pType )
@@ -1759,7 +1778,8 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
SwSetExpField aFld( (SwSetExpFieldType*)pType, aEmptyStr, SVX_NUM_ARABIC );
if( bOrderNumberingFirst )
nIdx = 0;
- pNew->InsertItem( SwFmtFld( aFld ), nIdx, nIdx );
+ SwFmtFld aFmt( aFld );
+ pNew->InsertItem( aFmt, nIdx, nIdx );
if ( rCharacterStyle.Len() )
{
SwCharFmt* pCharFmt = FindCharFmtByName( rCharacterStyle );
@@ -1769,7 +1789,11 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
pCharFmt = GetCharFmtFromPool( nMyId );
}
if ( pCharFmt )
- pNew->InsertItem( SwFmtCharFmt( pCharFmt ), 0, nSepIdx + 1, nsSetAttrMode::SETATTR_DONTEXPAND );
+ {
+ SwFmtCharFmt aCharFmt( pCharFmt );
+ pNew->InsertItem( aCharFmt, 0, nSepIdx + 1,
+ nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
}
}
}
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 67c64e27b9d0..2a36ce970615 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -123,6 +123,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <sfx2/Metadatable.hxx>
+#include <fmtmeta.hxx> // MetaFieldManager
using namespace ::com::sun::star;
@@ -206,6 +207,7 @@ SwDoc::SwDoc() :
aUndoNodes( this ),
mpAttrPool(new SwAttrPool(this)),
pMarkManager(new ::sw::mark::MarkManager(*this)),
+ m_pMetaFieldManager(new ::sw::MetaFieldManager()),
pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),
pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ),
@@ -1039,6 +1041,12 @@ SwDoc::GetXmlIdRegistry()
return *m_pXmlIdRegistry;
}
+::sw::MetaFieldManager &
+SwDoc::GetMetaFieldManager()
+{
+ return *m_pMetaFieldManager;
+}
+
void SwDoc::InitTOXTypes()
{
ShellResource* pShellRes = ViewShell::GetShellRes();
@@ -1379,7 +1387,7 @@ void SwDoc::Paste( const SwDoc& rSource )
aIndexBefore--;
- rSource.Copy( aCpyPam, rInsPos, true );
+ rSource.CopyRange( aCpyPam, rInsPos, true );
{
aIndexBefore++;
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 0d5fb13e7670..d0afa8debc27 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1031,12 +1031,14 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
"<SwDoc::SetNumRule(..)> - could not create new list. Serious defect -> please inform OD." );
sListId = pNewList->GetListId();
}
- Insert( rPam, SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
+ InsertPoolItem( rPam,
+ SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
}
else if ( sContinuedListId.Len() > 0 )
{
// apply given list id
- Insert( rPam, SfxStringItem( RES_PARATR_LIST_ID, sContinuedListId ), 0 );
+ InsertPoolItem( rPam,
+ SfxStringItem( RES_PARATR_LIST_ID, sContinuedListId ), 0 );
}
}
// <--
@@ -1084,7 +1086,7 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
if ( bSetItem )
// <--
{
- Insert( rPam, SwNumRuleItem( pNew->GetName() ), 0 );
+ InsertPoolItem( rPam, SwNumRuleItem( pNew->GetName() ), 0 );
}
// --> OD 2008-02-08 #newlistlevelattrs#
@@ -1124,33 +1126,34 @@ void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted)
}
else
{
- Insert( rPam, SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, FALSE ), 0 );
+ InsertPoolItem( rPam,
+ SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, FALSE ), 0 );
}
}
-void SwDoc::ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule)
-{
- if (DoesUndo())
- StartUndo(UNDO_START, NULL);
+//void SwDoc::ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule)
+//{
+// if (DoesUndo())
+// StartUndo(UNDO_START, NULL);
- ULONG nStt = rPaM.Start()->nNode.GetIndex();
- ULONG nEnd = rPaM.End()->nNode.GetIndex();
+// ULONG nStt = rPaM.Start()->nNode.GetIndex();
+// ULONG nEnd = rPaM.End()->nNode.GetIndex();
- for (ULONG n = nStt; n <= nEnd; n++)
- {
- SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode();
+// for (ULONG n = nStt; n <= nEnd; n++)
+// {
+// SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode();
- if (pCNd && NULL != pCNd->GetNumRule())
- {
- SwPaM aPam(*pCNd);
+// if (pCNd && NULL != pCNd->GetNumRule())
+// {
+// SwPaM aPam(*pCNd);
- Insert(aPam, SwNumRuleItem(rNumRule.GetName()), 0);
- }
- }
+// InsertPoolItem(aPam, SwNumRuleItem(rNumRule.GetName()), 0);
+// }
+// }
- if (DoesUndo())
- EndUndo(UNDO_START, NULL);
-}
+// if (DoesUndo())
+// EndUndo(UNDO_START, NULL);
+//}
void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag )
{
@@ -1544,8 +1547,8 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
SwPosition aPos(*pCNd);
aListStyleData.pReplaceNumRule =
const_cast<SwNumRule *>
- (SearchNumRule( aPos, FALSE, pCNd->HasNumber(),
- FALSE, 0,
+ (SearchNumRule( aPos, false, pCNd->HasNumber(),
+ false, 0,
aListStyleData.sListId, true ));
}
@@ -1849,13 +1852,13 @@ BOOL SwDoc::GotoNextNum( SwPosition& rPos, BOOL bOverUpper,
// -> #i23731#
// --> OD 2008-03-18 #refactorlists# - add output parameter <sListId>
-const SwNumRule * SwDoc::SearchNumRule(SwPosition & rPos,
- BOOL bForward,
- BOOL bNum,
- BOOL bOutline,
+const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
+ const bool bForward,
+ const bool bNum,
+ const bool bOutline,
int nNonEmptyAllowed,
String& sListId,
- bool _bInvestigateStartNode)
+ const bool bInvestigateStartNode)
{
const SwNumRule * pResult = NULL;
SwTxtNode * pTxtNd = rPos.nNode.GetNode().GetTxtNode();
@@ -1871,7 +1874,7 @@ const SwNumRule * SwDoc::SearchNumRule(SwPosition & rPos,
do
{
// --> OD 2005-10-20 #i55391#
- if ( !_bInvestigateStartNode )
+ if ( !bInvestigateStartNode )
{
if (bForward)
aIdx++;
@@ -1886,9 +1889,9 @@ const SwNumRule * SwDoc::SearchNumRule(SwPosition & rPos,
const SwNumRule * pNumRule = pTxtNd->GetNumRule();
if (pNumRule)
{
- if (pNumRule->IsOutlineRule() == bOutline && // #115901#
- ( (bNum && pNumRule->Get(0).IsEnumeration()) ||
- (!bNum && pNumRule->Get(0).IsItemize()) )) // #i22362#, #i29560#
+ if ( ( pNumRule->IsOutlineRule() == ( bOutline ? TRUE : FALSE ) ) && // #115901#
+ ( ( bNum && pNumRule->Get(0).IsEnumeration()) ||
+ ( !bNum && pNumRule->Get(0).IsItemize() ) ) ) // #i22362#, #i29560#
{
pResult = pTxtNd->GetNumRule();
// --> OD 2008-03-18 #refactorlists#
@@ -1911,7 +1914,7 @@ const SwNumRule * SwDoc::SearchNumRule(SwPosition & rPos,
}
// --> OD 2005-10-20 #i55391#
- if ( _bInvestigateStartNode )
+ if ( bInvestigateStartNode )
{
if (bForward)
aIdx++;
@@ -2275,7 +2278,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv )
}
}
- Copy( aPam, aInsPos, false );
+ CopyRange( aPam, aInsPos, false );
if( bDelLastPara )
{
// dann muss der letzte leere Node wieder entfernt werden
@@ -2361,7 +2364,7 @@ SetRedlineMode( eOld );
}
- Move( aMvRg, aIdx, DOC_MOVEREDLINES );
+ MoveNodeRange( aMvRg, aIdx, DOC_MOVEREDLINES );
if( pUndo )
{
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index fe537adf82d8..daeda48ccae3 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1725,7 +1725,7 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos,
rDoc.DeleteAndJoin( aPam );
else
{
- rDoc.Delete( aPam );
+ rDoc.DeleteRange( aPam );
if( pCSttNd && !pCEndNd )
{
@@ -1835,7 +1835,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos,
rDoc.DeleteAndJoin( aPam );
else
{
- rDoc.Delete( aPam );
+ rDoc.DeleteRange( aPam );
if( pCSttNd && !pCEndNd )
{
@@ -2899,10 +2899,12 @@ void SwRedlineExtraData_FmtColl::Reject( SwPaM& rPam ) const
// nicht angefasst.
SfxItemSet aTmp( *pSet );
aTmp.Differentiate( *pTNd->GetpSwAttrSet() );
- pDoc->Insert( rPam, aTmp, 0 );
+ pDoc->InsertItemSet( rPam, aTmp, 0 );
}
else
- pDoc->Insert( rPam, *pSet, 0 );
+ {
+ pDoc->InsertItemSet( rPam, *pSet, 0 );
+ }
}
rPam.DeleteMark();
}
@@ -2964,7 +2966,10 @@ void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const
// eigentlich muesste hier das Attribut zurueck gesetzt werden!!!
for( USHORT n = 0, nEnd = aWhichIds.Count(); n < nEnd; ++n )
- pDoc->Insert( rPam, *GetDfltAttr( aWhichIds[ n ] ), nsSetAttrMode::SETATTR_DONTEXPAND );
+ {
+ pDoc->InsertPoolItem( rPam, *GetDfltAttr( aWhichIds[ n ] ),
+ nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
pDoc->SetRedlineMode_intern( eOld );
}
@@ -3359,7 +3364,8 @@ void SwRedline::MoveToSection()
{
if( pCSttNd && !pCEndNd )
bDelLastPara = TRUE;
- pDoc->Move( aPam, aPos, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ pDoc->MoveRange( aPam, aPos,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
}
}
else
@@ -3368,7 +3374,8 @@ void SwRedline::MoveToSection()
SwNormalStartNode );
SwPosition aPos( *pSttNd->EndOfSectionNode() );
- pDoc->Move( aPam, aPos, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ pDoc->MoveRange( aPam, aPos,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
}
pCntntSect = new SwNodeIndex( *pSttNd );
@@ -3419,7 +3426,7 @@ void SwRedline::CopyToSection()
SwNodeIndex aNdIdx( *pSttNd, 1 );
SwTxtNode* pTxtNd = aNdIdx.GetNode().GetTxtNode();
SwPosition aPos( aNdIdx, SwIndex( pTxtNd ));
- pDoc->Copy( *this, aPos, false );
+ pDoc->CopyRange( *this, aPos, false );
// JP 08.10.98: die Vorlage vom EndNode ggfs. mit uebernehmen
// - ist im Doc::Copy nicht erwuenscht
@@ -3444,7 +3451,7 @@ void SwRedline::CopyToSection()
if( pCEndNd )
{
SwPosition aPos( *pSttNd->EndOfSectionNode() );
- pDoc->Copy( *this, aPos, false );
+ pDoc->CopyRange( *this, aPos, false );
}
else
{
@@ -3498,7 +3505,7 @@ void SwRedline::DelCopyOfSection()
{
if( pCSttNd && !pCEndNd )
bDelLastPara = TRUE;
- pDoc->Delete( aPam );
+ pDoc->DeleteRange( aPam );
if( bDelLastPara )
{
@@ -3539,7 +3546,9 @@ void SwRedline::DelCopyOfSection()
}
}
else
- pDoc->Delete( aPam );
+ {
+ pDoc->DeleteRange( aPam );
+ }
if( pStt == GetPoint() )
Exchange();
@@ -3622,7 +3631,10 @@ void SwRedline::MoveFromSection()
pDoc->AppendTxtNode( aPos );
}
else
- pDoc->Move( aPam, aPos, IDocumentContentOperations::DOC_MOVEALLFLYS );
+ {
+ pDoc->MoveRange( aPam, aPos,
+ IDocumentContentOperations::DOC_MOVEALLFLYS );
+ }
SetMark();
*GetPoint() = aPos;
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index 2c8f36e9f9b8..09977c9e0f7b 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -147,16 +147,20 @@ USHORT SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
{
// set/reset the attribut
if( pEntry->GetRubyAttr().GetText().Len() )
- Insert( aPam, pEntry->GetRubyAttr(), 0 );
+ {
+ InsertPoolItem( aPam, pEntry->GetRubyAttr(), 0 );
+ }
else
+ {
ResetAttrs( aPam, TRUE, &aDelArr );
+ }
}
if( aCheckEntry.GetText() != pEntry->GetText() &&
pEntry->GetText().Len() )
{
// text is changed, so replace the original
- Replace( aPam, pEntry->GetText(), FALSE );
+ ReplaceRange( aPam, pEntry->GetText(), false );
}
aPam.DeleteMark();
}
@@ -176,10 +180,11 @@ USHORT SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
if( pEntry->GetRubyAttr().GetText().Len() &&
pEntry->GetText().Len() )
{
- Insert( aPam, pEntry->GetText(), true );
+ InsertString( aPam, pEntry->GetText() );
aPam.SetMark();
aPam.GetMark()->nContent -= pEntry->GetText().Len();
- Insert( aPam, pEntry->GetRubyAttr(), nsSetAttrMode::SETATTR_DONTEXPAND );
+ InsertPoolItem( aPam, pEntry->GetRubyAttr(),
+ nsSetAttrMode::SETATTR_DONTEXPAND );
}
else
break;
@@ -246,7 +251,7 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT )
if( !bHasMark && nStart && ( !pAttr || nStart != *pAttr->GetStart()) )
{
// skip to the word begin!
- long nWordStt = pBreakIt->xBreak->getWordBoundary(
+ long nWordStt = pBreakIt->GetBreakIter()->getWordBoundary(
*pTxt, nStart,
pBreakIt->GetLocale( pTNd->GetLang( nStart )),
WordType::ANYWORD_IGNOREWHITESPACES,
@@ -335,10 +340,10 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT )
{
rPam.SetMark();
bAlphaNum = bIsAlphaNum;
- if( bChkNxtWrd && pBreakIt->xBreak.is() )
+ if( bChkNxtWrd && pBreakIt->GetBreakIter().is() )
{
// search the end of this word
- nWordEnd = pBreakIt->xBreak->getWordBoundary(
+ nWordEnd = pBreakIt->GetBreakIter()->getWordBoundary(
*pTxt, nStart,
pBreakIt->GetLocale( pTNd->GetLang( nStart )),
WordType::ANYWORD_IGNOREWHITESPACES,
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index c69483346a96..67fec1f7d33d 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -452,7 +452,8 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
aRg.aEnd = aRg.aStart.GetIndex() + 1;
// Nodes verschieben
- Move( aRg, aStart, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ MoveNodeRange( aRg, aStart,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
// Undo Verschiebungen einpflegen
if(pUndoSort)
@@ -777,7 +778,8 @@ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar,
// Einfuegen der Source
SwNodeIndex aIns( *pTar->GetSttNd()->EndOfSectionNode() );
- pDoc->Move( aRg, aIns, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ pDoc->MoveNodeRange( aRg, aIns,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
// Falls erster Node leer -> weg damit
if(bDelFirst)
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 0d9607b290c6..0119274f7b5e 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -182,7 +182,7 @@ USHORT SwDoc::GetCurTOXMark( const SwPosition& rPos,
Beschreibung: Marke loeschen
--------------------------------------------------------------------*/
-void SwDoc::Delete( const SwTOXMark* pTOXMark )
+void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
{
// hole den TextNode und
const SwTxtTOXMark* pTxtTOXMark = pTOXMark->GetTxtTOXMark();
@@ -202,12 +202,15 @@ void SwDoc::Delete( const SwTOXMark* pTOXMark )
SwRegHistory aRHst( rTxtNd, &pUndo->GetHistory() );
rTxtNd.GetpSwpHints()->Register( &aRHst );
- rTxtNd.Delete( const_cast<SwTxtTOXMark*>( pTxtTOXMark ), TRUE );
+ }
+
+ rTxtNd.DeleteAttribute( const_cast<SwTxtTOXMark*>(pTxtTOXMark) );
+
+ if ( DoesUndo() )
+ {
if( rTxtNd.GetpSwpHints() )
rTxtNd.GetpSwpHints()->DeRegister();
}
- else
- rTxtNd.Delete( const_cast<SwTxtTOXMark*>( pTxtTOXMark ), TRUE );
SetModified();
}
@@ -372,7 +375,7 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
pNew->SetTOXName(sSectNm);
pNew->SwSection::SetName(sSectNm);
SwPaM aPam( rPos );
- SwSection* pSect = Insert( aPam, *pNew, pSet, FALSE );
+ SwSection* pSect = InsertSwSection( aPam, *pNew, pSet, false );
if( pSect )
{
SwSectionNode* pSectNd = pSect->GetFmt()->GetSectionNode();
@@ -956,7 +959,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
SwTxtNode* pHeadNd = pDoc->GetNodes().MakeTxtNode( aIdx,
GetTxtFmtColl( FORM_TITLE ) );
- pHeadNd->Insert( GetTitle(), SwIndex( pHeadNd ));
+ pHeadNd->InsertText( GetTitle(), SwIndex( pHeadNd ) );
String sNm( GetTOXName() );
// ??Resource
@@ -1245,7 +1248,7 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl,
{
// Stichwortverzeichnismarkierung
lang::Locale aLocale;
- if ( pBreakIt->xBreak.is() )
+ if ( pBreakIt->GetBreakIter().is() )
{
aLocale = pBreakIt->GetLocale(
pTOXSrc->GetLang( *pTxtMark->GetStart() ) );
@@ -1939,9 +1942,12 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx,
else
pCharFmt = pDoc->FindCharFmtByName( aToken.sCharStyleName);
- if(pCharFmt)
- pTOXNd->InsertItem( SwFmtCharFmt( pCharFmt ), nStartCharStyle,
- rTxt.Len(), nsSetAttrMode::SETATTR_DONTEXPAND );
+ if (pCharFmt)
+ {
+ SwFmtCharFmt aFmt( pCharFmt );
+ pTOXNd->InsertItem( aFmt, nStartCharStyle,
+ rTxt.Len(), nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
}
aIt++; // #i21237#
@@ -2139,7 +2145,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
break;
}
}
- pNd->Erase(aPos, nEndPos - nStartPos + 2);
+ pNd->EraseText(aPos, nEndPos - nStartPos + 2);
for( i = 1; i < rNums.Count(); ++i)
{
@@ -2213,7 +2219,8 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
GetNumType() ).GetNumStr( nBeg+nCount );
}
}
- pNd->Insert( aNumStr, aPos, INS_EMPTYEXPAND );
+ pNd->InsertText( aNumStr, aPos,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
if(pPageNoCharFmt)
{
SwFmtCharFmt aCharFmt( pPageNoCharFmt );
diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
index bbb2f51b8302..03cb8f5366f3 100644
--- a/sw/source/core/doc/extinput.cxx
+++ b/sw/source/core/doc/extinput.cxx
@@ -89,7 +89,7 @@ SwExtTextInput::~SwExtTextInput()
if ( bLang )
{
SvxLanguageItem aLangItem( eInputLanguage, nWhich );
- pDoc->Insert(*this, aLangItem, 0 );
+ pDoc->InsertPoolItem(*this, aLangItem, 0 );
}
}
rIdx = nSttCnt;
@@ -100,9 +100,9 @@ SwExtTextInput::~SwExtTextInput()
if( nLen > sOverwriteText.Len() )
{
rIdx += sOverwriteText.Len();
- pTNd->Erase( rIdx, nLen - sOverwriteText.Len() );
+ pTNd->EraseText( rIdx, nLen - sOverwriteText.Len() );
rIdx = nSttCnt;
- pTNd->Replace( rIdx, sOverwriteText.Len(),
+ pTNd->ReplaceText( rIdx, sOverwriteText.Len(),
sOverwriteText );
if( bInsText )
{
@@ -110,13 +110,15 @@ SwExtTextInput::~SwExtTextInput()
pDoc->StartUndo( UNDO_OVERWRITE, NULL );
pDoc->Overwrite( *this, sTxt.Copy( 0,
sOverwriteText.Len() ));
- pDoc->Insert( *this, sTxt.Copy( sOverwriteText.Len() ), true);
+ pDoc->InsertString( *this,
+ sTxt.Copy( sOverwriteText.Len() ) );
pDoc->EndUndo( UNDO_OVERWRITE, NULL );
}
}
else
{
- pTNd->Replace( rIdx, nLen, sOverwriteText.Copy( 0, nLen ));
+ pTNd->ReplaceText( rIdx, nLen,
+ sOverwriteText.Copy( 0, nLen ));
if( bInsText )
{
rIdx = nSttCnt;
@@ -126,10 +128,12 @@ SwExtTextInput::~SwExtTextInput()
}
else
{
- pTNd->Erase( rIdx, nEndCnt - nSttCnt );
+ pTNd->EraseText( rIdx, nEndCnt - nSttCnt );
if( bInsText )
- pDoc->Insert( *this, sTxt, true );
+ {
+ pDoc->InsertString( *this, sTxt );
+ }
}
}
}
@@ -159,7 +163,7 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData )
// some characters
nReplace = nReplace - rNewStr.Len();
aIdx += rNewStr.Len();
- pTNd->Replace( aIdx, nReplace,
+ pTNd->ReplaceText( aIdx, nReplace,
sOverwriteText.Copy( rNewStr.Len(), nReplace ));
aIdx = nSttCnt;
nReplace = rNewStr.Len();
@@ -168,14 +172,14 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData )
{
nReplace = nReplace - sOverwriteText.Len();
aIdx += sOverwriteText.Len();
- pTNd->Erase( aIdx, nReplace );
+ pTNd->EraseText( aIdx, nReplace );
aIdx = nSttCnt;
nReplace = sOverwriteText.Len();
}
else if( (nReplace = sOverwriteText.Len()) > rNewStr.Len() )
nReplace = rNewStr.Len();
- pTNd->Replace( aIdx, nReplace, rNewStr );
+ pTNd->ReplaceText( aIdx, nReplace, rNewStr );
if( !HasMark() )
SetMark();
GetMark()->nContent = aIdx;
@@ -183,9 +187,12 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData )
else
{
if( nSttCnt < nEndCnt )
- pTNd->Erase( aIdx, nEndCnt - nSttCnt );
+ {
+ pTNd->EraseText( aIdx, nEndCnt - nSttCnt );
+ }
- pTNd->Insert( rNewStr, aIdx, INS_EMPTYEXPAND );
+ pTNd->InsertText( rNewStr, aIdx,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
if( !HasMark() )
SetMark();
}
diff --git a/sw/source/core/doc/makefile.mk b/sw/source/core/doc/makefile.mk
index 9e01f6ff1e80..c7459cd164a0 100644
--- a/sw/source/core/doc/makefile.mk
+++ b/sw/source/core/doc/makefile.mk
@@ -49,6 +49,7 @@ EXCEPTIONSFILES = \
$(SLO)$/docbm.obj \
$(SLO)$/doccomp.obj \
$(SLO)$/docdraw.obj \
+ $(SLO)$/docedt.obj \
$(SLO)$/docfmt.obj \
$(SLO)$/docglbl.obj \
$(SLO)$/docglos.obj \
@@ -70,7 +71,6 @@ SLOFILES = $(EXCEPTIONSFILES) \
$(SLO)$/doccorr.obj \
$(SLO)$/docdde.obj \
$(SLO)$/docdesc.obj \
- $(SLO)$/docedt.obj \
$(SLO)$/docfld.obj \
$(SLO)$/docfly.obj \
$(SLO)$/docftn.obj \
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 301dd08fa560..9f464aac5424 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -36,6 +36,7 @@
#include <tools/urlobj.hxx>
#include <vcl/print.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
#include <svtools/imapobj.hxx>
#include <svtools/imap.hxx>
#include <svtools/urihelper.hxx>
@@ -1027,8 +1028,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
//TODO/LATER: is it a problem that the JopSetup isn't used?
//xRef->DoDraw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), *pJobSetup );
+ // get hi-contrast image, but never for printing
Graphic* pGraphic = NULL;
- if ( pOut && ( pOut->GetDrawMode() & DRAWMODE_SETTINGSFILL ) )
+ if (pOut && !bPrn && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
pGraphic = pOLENd->GetHCGraphic();
// when it is not possible to get HC-representation, the original image should be used
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 065d0085de64..5e2b2fead999 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1719,7 +1719,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
};
const USHORT* pArr = MEASURE_METRIC ==
- GetAppLocaleData().getMeasurementSystemEnum()
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? aAbsSpace
: aAbsSpaceInch;
#else
@@ -1773,7 +1773,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
};
const USHORT* pArr = MEASURE_METRIC ==
- GetAppLocaleData().getMeasurementSystemEnum()
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? aAbsSpace
: aAbsSpaceInch;
#else
@@ -1876,7 +1876,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
};
const USHORT* pArr = MEASURE_METRIC ==
- GetAppLocaleData().getMeasurementSystemEnum()
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? aAbsSpace
: aAbsSpaceInch;
#else
@@ -1930,7 +1930,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
347, 1194
};
const USHORT* pArr0to2 = MEASURE_METRIC ==
- GetAppLocaleData().getMeasurementSystemEnum()
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? aAbsSpace0to2
: aAbsSpaceInch0to2;
#else
@@ -2070,7 +2070,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
};
const USHORT* pArr = MEASURE_METRIC ==
- GetAppLocaleData().getMeasurementSystemEnum()
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? aAbsSpace
: aAbsSpaceInch;
#else
@@ -2131,7 +2131,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
};
const USHORT* pArr = MEASURE_METRIC ==
- GetAppLocaleData().getMeasurementSystemEnum()
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? aAbsSpace
: aAbsSpaceInch;
#else
@@ -2236,7 +2236,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
};
const USHORT* pArr = MEASURE_METRIC ==
- GetAppLocaleData().getMeasurementSystemEnum()
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? aAbsSpace
: aAbsSpaceInch;
#else
@@ -2303,7 +2303,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
};
const USHORT* pArr = MEASURE_METRIC ==
- GetAppLocaleData().getMeasurementSystemEnum()
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? aAbsSpace
: aAbsSpaceInch;
#else
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 2534dc6da659..a2263bc3f442 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -203,6 +203,14 @@ namespace
pNewBookmark->SetKeyCode(pOldBookmark->GetKeyCode());
pNewBookmark->SetShortName(pOldBookmark->GetShortName());
}
+ ::sfx2::Metadatable const*const pMetadatable(
+ dynamic_cast< ::sfx2::Metadatable const* >(pMark));
+ ::sfx2::Metadatable *const pNewMetadatable(
+ dynamic_cast< ::sfx2::Metadatable * >(pNewMark));
+ if (pMetadatable && pNewMetadatable)
+ {
+ pNewMetadatable->RegisterAsCopyOf(*pMetadatable);
+ }
}
pDestDoc->DoUndo(bDoesUndo);
}
@@ -271,7 +279,8 @@ SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
// ??? reicht das ??? was ist mit PostIts/Feldern/FeldTypen ???
// --> OD 2008-11-18 #i96213# - force copy of all attributes
- pCpyTxtNd->Copy( pTxtNd, SwIndex( pCpyTxtNd ), pCpyTxtNd->GetTxt().Len(), true );
+ pCpyTxtNd->CopyText( pTxtNd, SwIndex( pCpyTxtNd ),
+ pCpyTxtNd->GetTxt().Len(), true );
// <--
//FEATURE::CONDCOLL
@@ -673,7 +682,8 @@ void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange& rCpyRg )
// Kopieren eines Bereiches im oder in ein anderes Dokument !
-bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
+bool
+SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const
{
const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
@@ -682,7 +692,7 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
// kein Copy abfangen.
if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) )
- return FALSE;
+ return false;
// verhinder das Kopieren in Fly's, die im Bereich verankert sind.
if( pDoc == this )
@@ -699,7 +709,9 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
--nEnd, --nDiff;
if( nDiff &&
lcl_ChkFlyFly( pDoc, nStt, nEnd, rPos.nNode.GetIndex() ) )
- return FALSE;
+ {
+ return false;
+ }
}
SwPaM* pRedlineRange = 0;
@@ -709,20 +721,25 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
RedlineMode_t eOld = pDoc->GetRedlineMode();
- BOOL bRet = FALSE;
+ bool bRet = false;
if( pDoc != this )
- bRet = _Copy( rPam, rPos, TRUE, bCopyAll, pRedlineRange ); // nur normales Kopieren
+ { // ordinary copy
+ bRet = CopyImpl( rPam, rPos, true, bCopyAll, pRedlineRange );
+ }
// Copy in sich selbst (ueber mehrere Nodes wird hier gesondert
// behandelt; in einem TextNode wird normal behandelt)
else if( ! ( *pStt <= rPos && rPos < *pEnd &&
( pStt->nNode != pEnd->nNode ||
!pStt->nNode.GetNode().IsTxtNode() )) )
- bRet = _Copy( rPam, rPos, TRUE, bCopyAll, pRedlineRange ); // nur normales Kopieren
-
+ { // ordinary copy
+ bRet = CopyImpl( rPam, rPos, true, bCopyAll, pRedlineRange );
+ }
else
{
ASSERT( this == pDoc, " falscher Copy-Zweig!" );
+ ASSERT(false, "mst: i thought this could be dead code;"
+ "please tell me what you did to get here!");
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
BOOL bDoUndo = pDoc->DoesUndo();
@@ -742,7 +759,8 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection(
SwNodeIndex( GetNodes().GetEndOfAutotext() ));
aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode();
- pDoc->_Copy( rPam, *aPam.GetPoint(), FALSE, bCopyAll, 0 ); // kopieren ohne Frames
+ // copy without Frames
+ pDoc->CopyImpl( rPam, *aPam.GetPoint(), false, bCopyAll, 0 );
aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext();
aPam.SetMark();
@@ -752,7 +770,8 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
aPam.GetPoint()->nNode = *aPam.GetNode()->StartOfSectionNode();
pNode = pDoc->GetNodes().GoNext( &aPam.GetPoint()->nNode );
pNode->MakeStartIndex( &aPam.GetPoint()->nContent );
- pDoc->Move( aPam, rPos, DOC_MOVEDEFAULT ); // auf gewuenschte Position moven
+ // move to desired position
+ pDoc->MoveRange( aPam, rPos, DOC_MOVEDEFAULT );
pNode = aPam.GetCntntNode();
*aPam.GetPoint() = rPos; // Cursor umsetzen fuers Undo !
@@ -776,7 +795,7 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
}
pDoc->SetModified();
- bRet = TRUE;
+ bRet = true;
}
pDoc->SetRedlineMode_intern( eOld );
@@ -795,42 +814,79 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
// Kopieren eines Bereiches im oder in ein anderes Dokument !
// Die Position darf nicht im Bereich liegen !!
-BOOL lcl_MarksWholeNode(const SwPaM & rPam)
+bool lcl_MarksWholeNode(const SwPaM & rPam)
{
- BOOL bResult = FALSE;
- const SwPosition * pStt = rPam.Start(), * pEnd = rPam.End();
+ bool bResult = false;
+ const SwPosition* pStt = rPam.Start();
+ const SwPosition* pEnd = rPam.End();
if (NULL != pStt && NULL != pEnd)
{
- SwTxtNode * pSttNd = pStt->nNode.GetNode().GetTxtNode();
- SwTxtNode * pEndNd = pEnd->nNode.GetNode().GetTxtNode();
+ const SwTxtNode* pSttNd = pStt->nNode.GetNode().GetTxtNode();
+ const SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode();
if (NULL != pSttNd && NULL != pEndNd &&
pStt->nContent.GetIndex() == 0 &&
pEnd->nContent.GetIndex() == pEndNd->Len())
{
- bResult = TRUE;
+ bResult = true;
}
}
return bResult;
}
-BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
- BOOL bMakeNewFrms, bool bCopyAll, SwPaM* pCpyRange ) const
+// --> OD 2009-08-25 #i86492#
+bool lcl_ContainsOnlyParagraphsInList( const SwPaM& rPam )
+{
+ bool bRet = false;
+
+ const SwTxtNode* pTxtNd = rPam.Start()->nNode.GetNode().GetTxtNode();
+ const SwTxtNode* pEndTxtNd = rPam.End()->nNode.GetNode().GetTxtNode();
+ if ( pTxtNd && pTxtNd->IsInList() &&
+ pEndTxtNd && pEndTxtNd->IsInList() )
+ {
+ bRet = true;
+ SwNodeIndex aIdx(rPam.Start()->nNode);
+
+ do
+ {
+ aIdx++;
+ pTxtNd = aIdx.GetNode().GetTxtNode();
+
+ if ( !pTxtNd || !pTxtNd->IsInList() )
+ {
+ bRet = false;
+ break;
+ }
+ } while ( pTxtNd && pTxtNd != pEndTxtNd );
+ }
+
+
+ return bRet;
+}
+// <--
+
+bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
+ const bool bMakeNewFrms, const bool bCopyAll,
+ SwPaM *const pCpyRange ) const
{
SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
- bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
+ const bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
+
+ SwPosition* pStt = rPam.Start();
+ SwPosition* pEnd = rPam.End();
- SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
// kein Copy abfangen.
if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) ||
//JP 29.6.2001: 88963 - dont copy if inspos is in region of start to end
//JP 15.11.2001: don't test inclusive the end, ever exclusive
( pDoc == this && *pStt <= rPos && rPos < *pEnd ))
- return FALSE;
+ {
+ return false;
+ }
- BOOL bEndEqualIns = pDoc == this && rPos == *pEnd;
+ const bool bEndEqualIns = pDoc == this && rPos == *pEnd;
// falls Undo eingeschaltet, erzeuge das UndoCopy-Objekt
SwUndoCpyDoc* pUndo = 0;
@@ -858,43 +914,63 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
SwNodeRange aRg( pStt->nNode, pEnd->nNode );
SwNodeIndex aInsPos( rPos.nNode );
- BOOL bOneNode = pStt->nNode == pEnd->nNode;
- SwTxtNode* pSttNd = pStt->nNode.GetNode().GetTxtNode();
- SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode();
- SwTxtNode* pDestNd = aInsPos.GetNode().GetTxtNode();
- BOOL bCopyCollFmt = !pDoc->IsInsOnlyTextGlossary() && (
- ( pDestNd && !pDestNd->GetTxt().Len() ) ||
- ( !bOneNode && !rPos.nContent.GetIndex() ));
- BOOL bCopyBookmarks = TRUE;
- BOOL bStartIsTxtNode = 0 != pSttNd;
-
- // --> OD 2008-03-18 #refactorlists#
- String aDummy;
- const SwNumRule * pNumRuleToPropagate =
- pDoc->SearchNumRule(rPos, FALSE, FALSE, TRUE, 0, aDummy);
+ const bool bOneNode = pStt->nNode == pEnd->nNode;
+ SwTxtNode* pSttTxtNd = pStt->nNode.GetNode().GetTxtNode();
+ SwTxtNode* pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode();
+ SwTxtNode* pDestTxtNd = aInsPos.GetNode().GetTxtNode();
+ bool bCopyCollFmt = !pDoc->IsInsOnlyTextGlossary() &&
+ ( ( pDestTxtNd && !pDestTxtNd->GetTxt().Len() ) ||
+ ( !bOneNode && !rPos.nContent.GetIndex() ) );
+ bool bCopyBookmarks = true;
+ BOOL bStartIsTxtNode = 0 != pSttTxtNd;
+
+ // --> OD 2009-08-25 #i86492#
+ // Correct the search for a previous list:
+ // First search for non-outline numbering list. Then search for non-outline
+ // bullet list.
+ // Keep also the <ListId> value for possible propagation.
+ String aListIdToPropagate;
+ const SwNumRule* pNumRuleToPropagate =
+ pDoc->SearchNumRule( rPos, false, true, false, 0, aListIdToPropagate, true );
+ if ( !pNumRuleToPropagate )
+ {
+ pNumRuleToPropagate =
+ pDoc->SearchNumRule( rPos, false, false, false, 0, aListIdToPropagate, true );
+ }
+ // <--
+ // --> OD 2009-08-25 #i86492#
+ // Do not propagate previous found list, if
+ // - destination is an empty paragraph which is not in a list and
+ // - source contains at least one paragraph which is not in a list
+ if ( pNumRuleToPropagate &&
+ pDestTxtNd && !pDestTxtNd->GetTxt().Len() && !pDestTxtNd->IsInList() &&
+ !lcl_ContainsOnlyParagraphsInList( rPam ) )
+ {
+ pNumRuleToPropagate = 0;
+ }
// <--
// Block, damit aus diesem gesprungen werden kann !!
do {
- if( pSttNd )
+ if( pSttTxtNd )
{
// den Anfang nicht komplett kopieren ?
if( !bCopyCollFmt || bColumnSel || pStt->nContent.GetIndex() )
{
SwIndex aDestIdx( rPos.nContent );
BOOL bCopyOk = FALSE;
- if( !pDestNd )
+ if( !pDestTxtNd )
{
if( pStt->nContent.GetIndex() || bOneNode )
- pDestNd = pDoc->GetNodes().MakeTxtNode( aInsPos,
+ pDestTxtNd = pDoc->GetNodes().MakeTxtNode( aInsPos,
pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD));
else
{
- pDestNd = (SwTxtNode*)pSttNd->MakeCopy( pDoc, aInsPos );
+ pDestTxtNd = static_cast<SwTxtNode*>(pSttTxtNd->MakeCopy( pDoc, aInsPos ));
bCopyOk = TRUE;
}
- aDestIdx.Assign( pDestNd, 0 );
- bCopyCollFmt = TRUE;
+ aDestIdx.Assign( pDestTxtNd, 0 );
+ bCopyCollFmt = true;
}
else if( !bOneNode || bColumnSel )
{
@@ -911,8 +987,8 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
aCpyPam.Move( fnMoveBackward, fnGoCntnt );
}
- pDestNd = pDoc->GetNodes()[ aInsPos.GetIndex()-1 ]->GetTxtNode();
- aDestIdx.Assign( pDestNd, pDestNd->GetTxt().Len() );
+ pDestTxtNd = pDoc->GetNodes()[ aInsPos.GetIndex()-1 ]->GetTxtNode();
+ aDestIdx.Assign( pDestTxtNd, pDestTxtNd->GetTxt().Len() );
// korrigiere den Bereich wieder !!
if( bEndEqualIns )
@@ -925,59 +1001,84 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
rPam.Exchange();
aRg.aEnd = pEnd->nNode;
- pEndNd = pEnd->nNode.GetNode().GetTxtNode();
+ pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode();
}
else if( rPos == *pEnd ) // Wurde das Ende auch verschoben
{
pEnd->nNode--;
- pEnd->nContent.Assign( pDestNd, nCntntEnd );
+ pEnd->nContent.Assign( pDestTxtNd, nCntntEnd );
aRg.aEnd = pEnd->nNode;
- pEndNd = pEnd->nNode.GetNode().GetTxtNode();
+ pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode();
}
}
- const SfxPoolItem * pItem = NULL;
- const SfxItemSet * pAttrSet = pDestNd->GetpSwAttrSet();
-
/* #107213#: Safe numrule item at destination. */
- int aState = SFX_ITEM_UNKNOWN;
+ // --> OD 2009-08-25 #i86492#
+ // Safe also <ListId> item of destination.
+ int aNumRuleState = SFX_ITEM_UNKNOWN;
SwNumRuleItem aNumRuleItem;
-
- if (pAttrSet != NULL)
+ int aListIdState = SFX_ITEM_UNKNOWN;
+ SfxStringItem aListIdItem( RES_PARATR_LIST_ID, String() );
{
- aState =
- pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem);
-
- if (SFX_ITEM_SET == aState)
- aNumRuleItem = *((SwNumRuleItem *) pItem);
+ const SfxItemSet * pAttrSet = pDestTxtNd->GetpSwAttrSet();
+ if (pAttrSet != NULL)
+ {
+ const SfxPoolItem * pItem = NULL;
+ aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem);
+ if (SFX_ITEM_SET == aNumRuleState)
+ aNumRuleItem = *((SwNumRuleItem *) pItem);
+
+ aListIdState =
+ pAttrSet->GetItemState(RES_PARATR_LIST_ID, FALSE, &pItem);
+ if (SFX_ITEM_SET == aListIdState)
+ {
+ aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ }
+ }
}
+ // <--
/* #107213# */
if( !bCopyOk )
{
- xub_StrLen nCpyLen = ( bOneNode ? pEnd->nContent.GetIndex()
- : pSttNd->GetTxt().Len() )
- - pStt->nContent.GetIndex();
- pSttNd->Copy( pDestNd, aDestIdx, pStt->nContent, nCpyLen );
+ const xub_StrLen nCpyLen = ( (bOneNode)
+ ? pEnd->nContent.GetIndex()
+ : pSttTxtNd->GetTxt().Len() )
+ - pStt->nContent.GetIndex();
+ pSttTxtNd->CopyText( pDestTxtNd, aDestIdx,
+ pStt->nContent, nCpyLen );
if( bEndEqualIns )
pEnd->nContent -= nCpyLen;
}
if( bOneNode )
{
- // ist der DestinationNode leer, kopiere die Vorlage mit
if( bCopyCollFmt )
{
- pSttNd->CopyCollFmt( *pDestNd );
+ pSttTxtNd->CopyCollFmt( *pDestTxtNd );
/* #107213# If only a part of one paragraph is copied
restore the numrule at the destination. */
- if (! lcl_MarksWholeNode(rPam))
+ // --> OD 2009-08-25 #i86492#
+ // restore also <ListId> item
+ if ( !lcl_MarksWholeNode(rPam) )
{
- if (SFX_ITEM_SET == aState)
- pDestNd->SetAttr(aNumRuleItem);
+ if (SFX_ITEM_SET == aNumRuleState)
+ {
+ pDestTxtNd->SetAttr(aNumRuleItem);
+ }
+ else
+ {
+ pDestTxtNd->ResetAttr(RES_PARATR_NUMRULE);
+ }
+ if (SFX_ITEM_SET == aListIdState)
+ {
+ pDestTxtNd->SetAttr(aListIdItem);
+ }
else
- pDestNd->ResetAttr(RES_PARATR_NUMRULE);
+ {
+ pDestTxtNd->ResetAttr(RES_PARATR_LIST_ID);
+ }
}
}
@@ -987,13 +1088,13 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
aRg.aStart++;
}
}
- else if( pDestNd )
+ else if( pDestTxtNd )
{
// Problems with insertion of table selections into "normal" text solved.
// We have to set the correct PaM for Undo, if this PaM starts in a textnode,
// the undo operation will try to merge this node after removing the table.
// If we didn't split a textnode, the PaM should start at the inserted table node
- if( rPos.nContent.GetIndex() == pDestNd->Len() )
+ if( rPos.nContent.GetIndex() == pDestTxtNd->Len() )
{ // Insertion at the last position of a textnode (empty or not)
aInsPos++; // The table will be inserted behind the text node
}
@@ -1040,15 +1141,15 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
}
}
- pDestNd = aInsPos.GetNode().GetTxtNode();
- if( pEndNd )
+ pDestTxtNd = aInsPos.GetNode().GetTxtNode();
+ if( pEndTxtNd )
{
SwIndex aDestIdx( rPos.nContent );
- if( !pDestNd )
+ if( !pDestTxtNd )
{
- pDestNd = pDoc->GetNodes().MakeTxtNode( aInsPos,
+ pDestTxtNd = pDoc->GetNodes().MakeTxtNode( aInsPos,
pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD));
- aDestIdx.Assign( pDestNd, 0 );
+ aDestIdx.Assign( pDestTxtNd, 0 );
aInsPos--;
// #112756# #98130# if we have to insert an extra text node
@@ -1060,42 +1161,66 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
bStartIsTxtNode = TRUE;
}
- const SfxPoolItem * pItem = NULL;
- const SfxItemSet* pAttrSet = pDestNd->GetpSwAttrSet();
-
/* #107213# Save numrule at destination */
- int aState = SFX_ITEM_UNKNOWN;
+ // --> OD 2009-08-25 #i86492#
+ // Safe also <ListId> item of destination.
+ int aNumRuleState = SFX_ITEM_UNKNOWN;
SwNumRuleItem aNumRuleItem;
-
- if (pAttrSet != NULL)
+ int aListIdState = SFX_ITEM_UNKNOWN;
+ SfxStringItem aListIdItem( RES_PARATR_LIST_ID, String() );
{
- aState =
- pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem);
+ const SfxItemSet* pAttrSet = pDestTxtNd->GetpSwAttrSet();
+ if (pAttrSet != NULL)
+ {
+ const SfxPoolItem * pItem = NULL;
- if (SFX_ITEM_SET == aState)
- aNumRuleItem = *((SwNumRuleItem *) pItem);
+ aNumRuleState =
+ pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem);
+ if (SFX_ITEM_SET == aNumRuleState)
+ aNumRuleItem = *((SwNumRuleItem *) pItem);
+
+ aListIdState =
+ pAttrSet->GetItemState(RES_PARATR_LIST_ID, FALSE, &pItem);
+ if (SFX_ITEM_SET == aListIdState)
+ aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ }
}
+ // <--
/* #107213# */
- BOOL bEmptyDestNd = 0 == pDestNd->GetTxt().Len();
- pEndNd->Copy( pDestNd, aDestIdx, SwIndex( pEndNd ),
+ const bool bEmptyDestNd = 0 == pDestTxtNd->GetTxt().Len();
+ pEndTxtNd->CopyText( pDestTxtNd, aDestIdx, SwIndex( pEndTxtNd ),
pEnd->nContent.GetIndex() );
// auch alle FormatVorlagen kopieren
if( bCopyCollFmt && ( bOneNode || bEmptyDestNd ))
{
- pEndNd->CopyCollFmt( *pDestNd );
+ pEndTxtNd->CopyCollFmt( *pDestTxtNd );
- if (bOneNode)
+ if ( bOneNode )
{
/* #107213# If only a part of one paragraph is copied
restore the numrule at the destination. */
- if ( ! lcl_MarksWholeNode(rPam))
+ // --> OD 2009-08-25 #i86492#
+ // restore also <ListId> item
+ if ( !lcl_MarksWholeNode(rPam) )
{
- if (SFX_ITEM_SET == aState)
- pDestNd->SetAttr(aNumRuleItem);
+ if (SFX_ITEM_SET == aNumRuleState)
+ {
+ pDestTxtNd->SetAttr(aNumRuleItem);
+ }
else
- pDestNd->ResetAttr(RES_PARATR_NUMRULE);
+ {
+ pDestTxtNd->ResetAttr(RES_PARATR_NUMRULE);
+ }
+ if (SFX_ITEM_SET == aListIdState)
+ {
+ pDestTxtNd->SetAttr(aListIdItem);
+ }
+ else
+ {
+ pDestTxtNd->ResetAttr(RES_PARATR_LIST_ID);
+ }
}
}
}
@@ -1104,13 +1229,13 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
if( bCopyAll || aRg.aStart != aRg.aEnd )
{
SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
- if( pSttNd && bCopyCollFmt && pDestNd->HasSwAttrSet() )
+ if( pSttTxtNd && bCopyCollFmt && pDestTxtNd->HasSwAttrSet() )
{
- aBrkSet.Put( *pDestNd->GetpSwAttrSet() );
+ aBrkSet.Put( *pDestTxtNd->GetpSwAttrSet() );
if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_BREAK, FALSE ) )
- pDestNd->ResetAttr( RES_BREAK );
+ pDestTxtNd->ResetAttr( RES_BREAK );
if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_PAGEDESC, FALSE ) )
- pDestNd->ResetAttr( RES_PAGEDESC );
+ pDestTxtNd->ResetAttr( RES_PAGEDESC );
}
if( aInsPos == pEnd->nNode )
@@ -1124,13 +1249,13 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
else
CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, FALSE );
- bCopyBookmarks = FALSE;
+ bCopyBookmarks = false;
// harte Umbrueche wieder in den ersten Node setzen
- if( aBrkSet.Count() && 0 != ( pDestNd = pDoc->GetNodes()[
+ if( aBrkSet.Count() && 0 != ( pDestTxtNd = pDoc->GetNodes()[
aCpyPam.GetPoint()->nNode.GetIndex()+1 ]->GetTxtNode() ) )
{
- pDestNd->SetAttr( aBrkSet );
+ pDestTxtNd->SetAttr( aBrkSet );
}
}
} while( FALSE );
@@ -1169,13 +1294,19 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
*pCpyRange->GetMark() = *aCpyPam.GetMark();
}
- if (pNumRuleToPropagate)
- pDoc->ReplaceNumRule(aCpyPam, *pNumRuleToPropagate);
+ if ( pNumRuleToPropagate )
+ {
+ // --> OD 2009-08-25 #i86492#
+ // use <SwDoc::SetNumRule(..)>, because it also handles the <ListId>
+// pDoc->ReplaceNumRule(aCpyPam, *pNumRuleToPropagate);
+ pDoc->SetNumRule( aCpyPam, *pNumRuleToPropagate, false,
+ aListIdToPropagate, sal_True, true );
+ }
pDoc->SetRedlineMode_intern( eOld );
pDoc->SetModified();
- return TRUE;
+ return true;
}
@@ -1220,7 +1351,7 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte
// Undo abschalten
BOOL bUndo = pDest->DoesUndo();
pDest->DoUndo( FALSE );
- _CopyFlyInFly( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly );
+ CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly );
pDest->DoUndo( bUndo );
SwNodeRange aCpyRange( aSavePos, rInsPos );
@@ -1256,14 +1387,15 @@ void lcl_ChainFmts( SwFlyFrmFmt *pSrc, SwFlyFrmFmt *pDest )
}
}
-void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, const SwNodeIndex& rSttIdx,
- BOOL bCopyFlyAtFly ) const
+void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg,
+ const xub_StrLen nEndContentIndex, const SwNodeIndex& rStartIdx,
+ const bool bCopyFlyAtFly ) const
{
// Bug 22727: suche erst mal alle Flys zusammen, sortiere sie entsprechend
// ihrer Ordnungsnummer und kopiere sie erst dann. Damit wird
// die Ordnungsnummer (wird nur im DrawModel verwaltet)
// beibehalten.
- SwDoc* pDest = rSttIdx.GetNode().GetDoc();
+ SwDoc *const pDest = rStartIdx.GetNode().GetDoc();
_ZSortFlys aArr;
USHORT nArrLen = GetSpzFrmFmts()->Count();
USHORT n;
@@ -1380,10 +1512,10 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentI
nAnchorTxtNdNumInRange = 1;
}
// Second, search corresponding text node in destination document
- // by counting forward from start insert position <rSttIdx> the
+ // by counting forward from start insert position <rStartIdx> the
// determined number of text nodes.
- aIdx = rSttIdx;
- SwNodeIndex aAnchorNdIdx( rSttIdx );
+ aIdx = rStartIdx;
+ SwNodeIndex aAnchorNdIdx( rStartIdx );
const SwNode& aEndOfContentNd =
aIdx.GetNode().GetNodes().GetEndOfContent();
while ( nAnchorTxtNdNumInRange > 0 &&
@@ -1403,7 +1535,7 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentI
// text node in the destination document.
ASSERT( false,
"<SwDoc::_CopyFlyInFly(..)> - found anchor node index isn't a text node" );
- aAnchorNdIdx = rSttIdx;
+ aAnchorNdIdx = rStartIdx;
while ( !aAnchorNdIdx.GetNode().IsTxtNode() )
{
++aAnchorNdIdx;
@@ -1415,7 +1547,7 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentI
else
{
long nOffset = pNewPos->nNode.GetIndex() - rRg.aStart.GetIndex();
- SwNodeIndex aIdx( rSttIdx, nOffset );
+ SwNodeIndex aIdx( rStartIdx, nOffset );
pNewPos->nNode = aIdx;
}
// <--
@@ -1440,8 +1572,8 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentI
const SwStartNode* pSNd;
if( rCntnt.GetCntntIdx() &&
0 != ( pSNd = rCntnt.GetCntntIdx()->GetNode().GetStartNode() ) &&
- pSNd->GetIndex() < rSttIdx.GetIndex() &&
- rSttIdx.GetIndex() < pSNd->EndOfSectionIndex() )
+ pSNd->GetIndex() < rStartIdx.GetIndex() &&
+ rStartIdx.GetIndex() < pSNd->EndOfSectionIndex() )
{
bMakeCpy = FALSE;
aArr.Remove( n, 1 );
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 67838b7fb3f7..0f44f1f3898a 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -158,8 +158,8 @@ void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSection& rSect,
}
}
-SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
- const SfxItemSet* pAttr, BOOL bUpdate )
+SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
+ const SfxItemSet* pAttr, bool bUpdate )
{
const SwNode* pPrvNd = 0;
USHORT nRegionRet = 0;
@@ -178,10 +178,11 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
if( !pStt->nContent.GetIndex() &&
pEnd->nNode.GetNode().GetCntntNode()->Len() ==
pEnd->nContent.GetIndex() )
-
- ::lcl_CheckEmptyLayFrm( GetNodes(), (SwSection&)rNew,
+ {
+ ::lcl_CheckEmptyLayFrm( GetNodes(), const_cast<SwSection&>(rNew),
pStt->nNode.GetNode(),
pEnd->nNode.GetNode() );
+ }
}
SwUndoInsSection* pUndoInsSect = 0;
@@ -193,9 +194,11 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
DoUndo( FALSE );
}
- SwSectionFmt* pFmt = MakeSectionFmt( 0 );
- if( pAttr )
+ SwSectionFmt* const pFmt = MakeSectionFmt( 0 );
+ if ( pAttr )
+ {
pFmt->SetFmtAttr( *pAttr );
+ }
SwSectionNode* pNewSectNode = 0;
@@ -222,16 +225,27 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
{
if( pUndoInsSect )
{
- SwTxtNode* pTNd;
if( !( pPrvNd && 1 == nRegionRet ) &&
- pSttPos->nContent.GetIndex() &&
- 0 != ( pTNd = pSttPos->nNode.GetNode().GetTxtNode() ))
- pUndoInsSect->SaveSplitNode( pTNd, TRUE );
-
- if( !( pPrvNd && 2 == nRegionRet ) &&
- 0 != ( pTNd = pEndPos->nNode.GetNode().GetTxtNode() ) &&
- pTNd->GetTxt().Len() != pEndPos->nContent.GetIndex() )
- pUndoInsSect->SaveSplitNode( pTNd, FALSE );
+ pSttPos->nContent.GetIndex() )
+ {
+ SwTxtNode* const pTNd =
+ pSttPos->nNode.GetNode().GetTxtNode();
+ if (pTNd)
+ {
+ pUndoInsSect->SaveSplitNode( pTNd, TRUE );
+ }
+ }
+
+ if ( !( pPrvNd && 2 == nRegionRet ) )
+ {
+ SwTxtNode *const pTNd =
+ pEndPos->nNode.GetNode().GetTxtNode();
+ if (pTNd &&
+ (pTNd->GetTxt().Len() != pEndPos->nContent.GetIndex()))
+ {
+ pUndoInsSect->SaveSplitNode( pTNd, FALSE );
+ }
+ }
}
const SwCntntNode* pCNd;
@@ -241,7 +255,9 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
pSttPos->nContent.Assign( pSttPos->nNode.GetNode().GetCntntNode(), 0 );
}
else if( pSttPos->nContent.GetIndex() )
+ {
SplitNode( *pSttPos, false );
+ }
if( pPrvNd && 2 == nRegionRet )
{
@@ -293,7 +309,9 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
else
{
if( pUndoInsSect && pCNd->IsTxtNode() )
+ {
pUndoInsSect->SaveSplitNode( (SwTxtNode*)pCNd, TRUE );
+ }
SplitNode( *pPos, false );
pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, TRUE );
}
@@ -309,9 +327,13 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
{
SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, 1 );
if( IsRedlineOn() )
+ {
AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ }
else
+ {
SplitRedline( aPam );
+ }
}
// ist eine Condition gesetzt
@@ -320,7 +342,9 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
// dann berechne bis zu dieser Position
SwCalc aCalc( *this );
if( ! IsInReading() )
+ {
FldsToCalc( aCalc, pNewSectNode->GetIndex(), USHRT_MAX );
+ }
SwSection& rNewSect = pNewSectNode->GetSection();
rNewSect.SetCondHidden( aCalc.Calculate( rNewSect.GetCondition() ).GetBool() );
}
@@ -335,7 +359,9 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
( FTNEND_ATTXTEND_OWNNUMSEQ == ( nVal = ((SwFmtEndAtTxtEnd&)
pAttr->Get( RES_END_AT_TXTEND )).GetValue() ) ||
FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ))
+ {
bUpdateFtn = TRUE;
+ }
}
if( pUndoInsSect )
@@ -346,10 +372,14 @@ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
}
if( rNew.IsLinkType() )
+ {
pNewSectNode->GetSection().CreateLink( bUpdate ? CREATE_UPDATE : CREATE_CONNECT );
+ }
if( bUpdateFtn )
+ {
GetFtnIdxs().UpdateFtn( SwNodeIndex( *pNewSectNode ));
+ }
SetModified();
return &pNewSectNode->GetSection();
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index a832c33ec958..a7e7675966c3 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1034,7 +1034,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
nChPos + 1 );
// Trennzeichen loeschen und SuchString korrigieren
- pTxtNd->Erase( aCntPos.nContent, 1 );
+ pTxtNd->EraseText( aCntPos.nContent, 1 );
pTxt = pTxtNd->GetTxt().GetBuffer();
nChPos = 0;
--nChPos, --pTxt; // for the ++ in the for loop !!!
@@ -1551,7 +1551,8 @@ BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara )
{
// Inserting the seperator
SwIndex aCntIdx( pDelPara->pLastNd, pDelPara->pLastNd->GetTxt().Len());
- pDelPara->pLastNd->Insert( pDelPara->cCh, aCntIdx );
+ pDelPara->pLastNd->InsertText( pDelPara->cCh, aCntIdx,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
if( pDelPara->pUndo )
pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex(),
aCntIdx.GetIndex() );
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index acd1ceabce9b..61dd90bc509c 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1249,13 +1249,13 @@ BOOL SwCntntNode::GoNext(SwIndex * pIdx, USHORT nMode ) const
{
const SwTxtNode& rTNd = *GetTxtNode();
xub_StrLen nPos = pIdx->GetIndex();
- if( pBreakIt->xBreak.is() )
+ if( pBreakIt->GetBreakIter().is() )
{
sal_Int32 nDone = 0;
sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
CharacterIteratorMode::SKIPCELL :
CharacterIteratorMode::SKIPCONTROLCHARACTER;
- nPos = (xub_StrLen)pBreakIt->xBreak->nextCharacters( rTNd.GetTxt(), nPos,
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->nextCharacters( rTNd.GetTxt(), nPos,
pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
nItrMode, 1, nDone );
@@ -1297,13 +1297,13 @@ BOOL SwCntntNode::GoPrevious(SwIndex * pIdx, USHORT nMode ) const
{
const SwTxtNode& rTNd = *GetTxtNode();
xub_StrLen nPos = pIdx->GetIndex();
- if( pBreakIt->xBreak.is() )
+ if( pBreakIt->GetBreakIter().is() )
{
sal_Int32 nDone = 0;
sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
CharacterIteratorMode::SKIPCELL :
CharacterIteratorMode::SKIPCONTROLCHARACTER;
- nPos = (xub_StrLen)pBreakIt->xBreak->previousCharacters( rTNd.GetTxt(), nPos,
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->previousCharacters( rTNd.GetTxt(), nPos,
pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
nItrMode, 1, nDone );
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index ef39f7ced4a4..ce24e4ba06b5 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -47,6 +47,7 @@
#include <ddefld.hxx>
#include <swddetbl.hxx>
#include <frame.hxx>
+#include <fmtmeta.hxx>
#include <docsh.hxx>
#include <svtools/smplhint.hxx>
@@ -288,7 +289,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz,
SwTxtNode* pTxtNd = pCNd->GetTxtNode();
if( pTxtNd )
{
- const SwpHints* pHts = pTxtNd->GetpSwpHints();
+ SwpHints * const pHts = pTxtNd->GetpSwpHints();
// setze die OultineNodes im neuen Nodes-Array
//if( bInsOutlineIdx && NO_NUMBERING != //#outline level,removed by zhaojianwei
// pTxtNd->GetTxtColl()->GetOutlineLevel() )
@@ -306,16 +307,17 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz,
// Sonderbehandlung fuer die Felder!
if( pHts && pHts->Count() )
{
- const SwTxtAttr* pAttr;
int bToUndo = &pDestDoc->GetNodes() != &rNds;
for( USHORT i = pHts->Count(); i; )
{
USHORT nDelMsg = 0;
- switch( (pAttr = (*pHts)[ --i ])->Which() )
+ SwTxtAttr * const pAttr = pHts->GetTextHint( --i );
+ switch ( pAttr->Which() )
{
case RES_TXTATR_FIELD:
{
- SwTxtFld* pTxtFld = (SwTxtFld*)pAttr;
+ SwTxtFld* pTxtFld =
+ static_cast<SwTxtFld*>(pAttr);
rNds.GetDoc()->InsDelFldInFldLst( !bToUndo, *pTxtFld );
const SwFieldType* pTyp = pTxtFld->GetFld().GetFld()->GetTyp();
@@ -345,6 +347,15 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz,
case RES_TXTATR_REFMARK:
nDelMsg = RES_REFMARK_DELETED;
break;
+
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ static_cast<SwFmtMeta&>(pAttr->GetAttr())
+ .NotifyRemoval();
+ break;
+
+ default:
+ break;
}
if( nDelMsg && bToUndo )
{
@@ -1762,10 +1773,10 @@ USHORT HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange )
|* Letzte Aenderung JP 09.07.92
|*
*************************************************************************/
-void SwNodes::Move( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes,
- BOOL )
+void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
{
- SwPosition *pStt = (SwPosition*)rPam.Start(), *pEnd = (SwPosition*)rPam.End();
+ SwPosition * const pStt = rPam.Start();
+ SwPosition * const pEnd = rPam.End();
if( !rPam.HasMark() || *pStt >= *pEnd )
return;
@@ -1775,10 +1786,9 @@ void SwNodes::Move( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes,
SwNodeIndex aEndIdx( pEnd->nNode );
SwNodeIndex aSttIdx( pStt->nNode );
- SwTxtNode* pSrcNd = (*this)[ aSttIdx ]->GetTxtNode();
+ SwTxtNode* const pSrcNd = (*this)[ aSttIdx ]->GetTxtNode();
SwTxtNode* pDestNd = rNodes[ rPos.nNode ]->GetTxtNode();
BOOL bSplitDestNd = TRUE;
- BOOL bSttTxtNd = 0 != pSrcNd;
BOOL bCopyCollFmt = pDestNd && !pDestNd->GetTxt().Len();
if( pSrcNd )
@@ -1792,67 +1802,74 @@ void SwNodes::Move( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes,
rPos.nContent.Assign( pDestNd, 0 );
bCopyCollFmt = TRUE;
}
-/*!NOSPLIT bSplitDestNd = !bSplitNd &&
- ( pDestNd->Len() > rPos.nContent.GetIndex() ||
- !aEndIdx.GetNode().IsTxtNode() );
-*/
-// ASSERT( bSplitNd, "Move mit bSplitNode = FALSE" );
bSplitDestNd = pDestNd->Len() > rPos.nContent.GetIndex() ||
pEnd->nNode.GetNode().IsTxtNode();
// verschiebe jetzt noch den Inhalt in den neuen Node
BOOL bOneNd = pStt->nNode == pEnd->nNode;
- xub_StrLen nLen = ( bOneNd ? pEnd->nContent.GetIndex() : pSrcNd->Len() )
- - pStt->nContent.GetIndex();
+ const xub_StrLen nLen =
+ ( (bOneNd) ? pEnd->nContent.GetIndex() : pSrcNd->Len() )
+ - pStt->nContent.GetIndex();
if( !pEnd->nNode.GetNode().IsCntntNode() )
{
bOneNd = TRUE;
- ULONG nSttNdIdx = pStt->nNode.GetIndex() + 1,
- nEndNdIdx = pEnd->nNode.GetIndex();
+ ULONG nSttNdIdx = pStt->nNode.GetIndex() + 1;
+ const ULONG nEndNdIdx = pEnd->nNode.GetIndex();
for( ; nSttNdIdx < nEndNdIdx; ++nSttNdIdx )
+ {
if( (*this)[ nSttNdIdx ]->IsCntntNode() )
{
bOneNd = FALSE;
break;
}
+ }
}
// das kopieren / setzen der Vorlagen darf erst nach
// dem Splitten erfolgen
-//!NOSPLIT if( !bOneNd && ( bSplitNd || bSplitDestNd ))
if( !bOneNd && bSplitDestNd )
{
if( !rPos.nContent.GetIndex() )
+ {
bCopyCollFmt = TRUE;
+ }
if( rNodes.IsDocNodes() )
{
- SwDoc* pInsDoc = pDestNd->GetDoc();
- BOOL bIsUndo = pInsDoc->DoesUndo();
- pInsDoc->DoUndo( FALSE );
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ const bool bIsUndo = pInsDoc->DoesUndo();
+ pInsDoc->DoUndo( false );
pInsDoc->SplitNode( rPos, false );
pInsDoc->DoUndo( bIsUndo );
}
else
+ {
pDestNd->SplitCntntNode( rPos );
+ }
if( rPos.nNode == aEndIdx )
+ {
aEndIdx--;
+ }
bSplitDestNd = TRUE;
pDestNd = rNodes[ rPos.nNode.GetIndex() - 1 ]->GetTxtNode();
if( nLen )
- pSrcNd->Cut( pDestNd, SwIndex( pDestNd, pDestNd->Len()),
+ {
+ pSrcNd->CutText( pDestNd, SwIndex( pDestNd, pDestNd->Len()),
pStt->nContent, nLen );
+ }
+ }
+ else if ( nLen )
+ {
+ pSrcNd->CutText( pDestNd, rPos.nContent, pStt->nContent, nLen );
}
- else if( nLen )
- pSrcNd->Cut( pDestNd, rPos.nContent, pStt->nContent, nLen );
if( bCopyCollFmt )
{
- SwDoc* pInsDoc = pDestNd->GetDoc();
- BOOL bIsUndo = pInsDoc->DoesUndo();
- pInsDoc->DoUndo( FALSE );
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ const bool bIsUndo = pInsDoc->DoesUndo();
+ pInsDoc->DoUndo( false );
pSrcNd->CopyCollFmt( *pDestNd );
pInsDoc->DoUndo( bIsUndo );
bCopyCollFmt = FALSE;
@@ -1865,7 +1882,8 @@ void SwNodes::Move( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes,
// wird aufgehoben !
pEnd->nContent = pStt->nContent;
rPam.DeleteMark();
- GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( 0, rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) );
+ GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( 0,
+ rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) );
return;
}
@@ -1875,106 +1893,117 @@ void SwNodes::Move( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes,
{
if( rPos.nContent.GetIndex() )
{
-//!NOSPLIT if( !bSplitNd && rPos.nContent.GetIndex() == pDestNd->Len() )
if( rPos.nContent.GetIndex() == pDestNd->Len() )
+ {
rPos.nNode++;
+ }
else if( rPos.nContent.GetIndex() )
{
// falls im EndNode gesplittet wird, dann muss der EndIdx
// korrigiert werden !!
- BOOL bCorrEnde = aEndIdx == rPos.nNode;
+ const bool bCorrEnd = aEndIdx == rPos.nNode;
// es wird kein Text an den TextNode angehaengt, also splitte ihn
if( rNodes.IsDocNodes() )
{
- SwDoc* pInsDoc = pDestNd->GetDoc();
- BOOL bIsUndo = pInsDoc->DoesUndo();
- pInsDoc->DoUndo( FALSE );
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ const bool bIsUndo = pInsDoc->DoesUndo();
+ pInsDoc->DoUndo( false );
pInsDoc->SplitNode( rPos, false );
pInsDoc->DoUndo( bIsUndo );
}
else
+ {
pDestNd->SplitCntntNode( rPos );
+ }
pDestNd = rPos.nNode.GetNode().GetTxtNode();
- if( bCorrEnde )
+ if ( bCorrEnd )
+ {
aEndIdx--;
+ }
}
}
// am Ende steht noch ein leerer Text Node herum.
bSplitDestNd = TRUE;
}
- pSrcNd = (*this)[ aEndIdx ]->GetTxtNode();
- if( pSrcNd )
+ SwTxtNode* const pEndSrcNd = (*this)[ aEndIdx ]->GetTxtNode();
+ if ( pEndSrcNd )
{
-// if( pEnd->nContent.GetIndex() ? TRUE : aEndIdx != pStt->nNode )
{
// am Bereichsende entsteht ein neuer TextNode
if( !bSplitDestNd )
{
if( rPos.nNode < rNodes.GetEndOfContent().GetIndex() )
+ {
rPos.nNode++;
+ }
- pDestNd = rNodes.MakeTxtNode( rPos.nNode, pSrcNd->GetTxtColl() );
+ pDestNd =
+ rNodes.MakeTxtNode( rPos.nNode, pEndSrcNd->GetTxtColl() );
rPos.nNode--;
rPos.nContent.Assign( pDestNd, 0 );
}
else
+ {
pDestNd = rNodes[ rPos.nNode ]->GetTxtNode();
+ }
if( pDestNd && pEnd->nContent.GetIndex() )
{
// verschiebe jetzt noch den Inhalt in den neuen Node
- SwIndex aIdx( pSrcNd, 0 );
- pSrcNd->Cut( pDestNd, rPos.nContent, aIdx,
+ SwIndex aIdx( pEndSrcNd, 0 );
+ pEndSrcNd->CutText( pDestNd, rPos.nContent, aIdx,
pEnd->nContent.GetIndex());
}
if( bCopyCollFmt )
{
- SwDoc* pInsDoc = pDestNd->GetDoc();
- BOOL bIsUndo = pInsDoc->DoesUndo();
- pInsDoc->DoUndo( FALSE );
- pSrcNd->CopyCollFmt( *pDestNd );
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ const bool bIsUndo = pInsDoc->DoesUndo();
+ pInsDoc->DoUndo( false );
+ pEndSrcNd->CopyCollFmt( *pDestNd );
pInsDoc->DoUndo( bIsUndo );
}
}
}
else
{
- if( bSttTxtNd && aEndIdx.GetNode().IsCntntNode() )
+ if ( pSrcNd && aEndIdx.GetNode().IsCntntNode() )
+ {
aEndIdx++;
-//!NOSPLIT
+ }
if( !bSplitDestNd )
{
rPos.nNode++;
rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), 0 );
}
-//!NOSPLIT
}
if( aEndIdx != aSttIdx )
{
// verschiebe jetzt die Nodes in das NodesArary
- SwNodeIndex aPrvIdx( rPos.nNode, -1 );
- ULONG nSttDiff = aSttIdx.GetIndex() - pStt->nNode.GetIndex();
+ const ULONG nSttDiff = aSttIdx.GetIndex() - pStt->nNode.GetIndex();
SwNodeRange aRg( aSttIdx, aEndIdx );
_MoveNodes( aRg, rNodes, rPos.nNode );
// falls ins gleiche Nodes-Array verschoben wurde, stehen die
// Indizies jetzt auch an der neuen Position !!!!
// (also alles wieder umsetzen)
if( &rNodes == this )
+ {
pStt->nNode = aRg.aEnd.GetIndex() - nSttDiff;
+ }
}
// falls der Start-Node verschoben wurde, in dem der Cursor stand, so
// muss der Content im akt. Content angemeldet werden !!!
- if( &pStt->nNode.GetNode() == &GetEndOfContent() &&
- !GoPrevious( &pStt->nNode ))
+ if ( &pStt->nNode.GetNode() == &GetEndOfContent() )
{
- ASSERT( FALSE, "Move() - kein ContentNode mehr vorhanden" );
+ const bool bSuccess = GoPrevious( &pStt->nNode );
+ ASSERT( bSuccess, "Move() - no ContentNode here" );
+ (void) bSuccess;
}
pStt->nContent.Assign( (*this)[ pStt->nNode ]->GetCntntNode(),
pStt->nContent.GetIndex() );
@@ -1983,7 +2012,8 @@ void SwNodes::Move( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes,
// wird aufgehoben !
*pEnd = *pStt;
rPam.DeleteMark();
- GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( 0, rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) );
+ GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( 0,
+ rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) );
}
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 33cd325c669a..1a174d9d54de 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1414,7 +1414,10 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
if( pSrcDoc != pDoc ||
pCpyPam->Start()->nNode > rInsPos ||
rInsPos >= pCpyPam->End()->nNode )
- pSrcDoc->Copy( *pCpyPam, *pPam->GetPoint(), false );
+ {
+ pSrcDoc->CopyRange( *pCpyPam, *pPam->GetPoint(),
+ false );
+ }
delete pCpyPam;
}
if( pCpyRg && pSrcDoc == pDoc &&
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 3867d0a4a891..0ed60f355085 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -42,7 +42,6 @@
#include <fmtinfmt.hxx>
#include <txtatr.hxx>
#include <txtinet.hxx>
-#include <fmthbsh.hxx>
#include <editsh.hxx>
#include <doc.hxx>
#include <pam.hxx>
@@ -125,7 +124,9 @@ void SwAutoCorrDoc::DeleteSel( SwPaM& rDelPam )
pDoc->DeleteAndJoin( rDelPam );
}
else
- pDoc->Delete( rDelPam );
+ {
+ pDoc->DeleteRange( rDelPam );
+ }
}
BOOL SwAutoCorrDoc::Delete( xub_StrLen nStt, xub_StrLen nEnd )
@@ -143,7 +144,7 @@ BOOL SwAutoCorrDoc::Delete( xub_StrLen nStt, xub_StrLen nEnd )
BOOL SwAutoCorrDoc::Insert( xub_StrLen nPos, const String& rTxt )
{
SwPaM aPam( rCrsr.GetPoint()->nNode.GetNode(), nPos );
- rEditSh.GetDoc()->Insert( aPam, rTxt, true );
+ rEditSh.GetDoc()->InsertString( aPam, rTxt );
if( !bUndoIdInitialized )
{
bUndoIdInitialized = true;
@@ -163,23 +164,27 @@ BOOL SwAutoCorrDoc::Replace( xub_StrLen nPos, const String& rTxt )
pPam->GetPoint()->nContent = nPos;
}
- BOOL bChg = TRUE;
- SwTxtNode* pNd = pPam->GetNode()->GetTxtNode();
- if( pNd )
+ SwTxtNode * const pNd = pPam->GetNode()->GetTxtNode();
+ if ( !pNd )
{
- // TextAttribute ohne Ende duerfen nie ersetzt werden!
- sal_Unicode cChr;
- for( xub_StrLen n = 0, nLen = rTxt.Len(); n < nLen; ++n )
- if( ( CH_TXTATR_BREAKWORD == (cChr = pNd->GetTxt().
- GetChar( n + nPos )) || CH_TXTATR_INWORD == cChr ) &&
- pNd->GetTxtAttr( n + nPos ) )
- {
- bChg = FALSE;
- break;
- }
+ return FALSE;
+ }
+
+ // text attributes with dummy characters must not be replaced!
+ bool bDoReplace = true;
+ xub_StrLen const nLen = rTxt.Len();
+ for ( xub_StrLen n = 0; n < nLen; ++n )
+ {
+ sal_Unicode const Char = pNd->GetTxt().GetChar( n + nPos );
+ if ( ( CH_TXTATR_BREAKWORD == Char || CH_TXTATR_INWORD == Char )
+ && pNd->GetTxtAttrForCharAt( n + nPos ) )
+ {
+ bDoReplace = false;
+ break;
+ }
}
- if( bChg )
+ if ( bDoReplace )
{
SwDoc* pDoc = rEditSh.GetDoc();
@@ -190,7 +195,9 @@ BOOL SwAutoCorrDoc::Replace( xub_StrLen nPos, const String& rTxt )
if( pDoc->IsAutoFmtRedline() )
{
if( nPos == pNd->GetTxt().Len() ) // am Ende erfolgt ein Insert
- pDoc->Insert( *pPam, rTxt, true );
+ {
+ pDoc->InsertString( *pPam, rTxt );
+ }
else
{
_PaMIntoCrsrShellRing aTmp( rEditSh, rCrsr, *pPam );
@@ -198,7 +205,7 @@ BOOL SwAutoCorrDoc::Replace( xub_StrLen nPos, const String& rTxt )
pPam->SetMark();
pPam->GetPoint()->nContent = Min( pNd->GetTxt().Len(),
xub_StrLen( nPos + rTxt.Len() ));
- pDoc->Replace( *pPam, rTxt, FALSE );
+ pDoc->ReplaceRange( *pPam, rTxt, false );
pPam->Exchange();
pPam->DeleteMark();
}
@@ -333,7 +340,7 @@ BOOL SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPos,
'.' != pFnd->GetLong().GetChar( pFnd->GetLong().Len() - 1 ) )
{
// replace the selection
- pDoc->Replace( aPam, pFnd->GetLong(), false);
+ pDoc->ReplaceRange( aPam, pFnd->GetLong(), false);
bRet = TRUE;
}
}
@@ -374,7 +381,7 @@ BOOL SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPos,
SwDontExpandItem aExpItem;
aExpItem.SaveDontExpandItems( *aPam.GetPoint() );
- pAutoDoc->Copy( aCpyPam, *aPam.GetPoint(), false );
+ pAutoDoc->CopyRange( aCpyPam, *aPam.GetPoint(), false );
aExpItem.RestoreDontExpandItems( *aPam.GetPoint() );
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 164011a48a8f..7bacee8fbde4 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -44,9 +44,7 @@
#include <svx/lrspitem.hxx>
#include <svx/brkitem.hxx>
#include <svx/adjitem.hxx>
-#ifndef _SVX_TSTPITEM_HXX //autogen
#include <svx/tstpitem.hxx>
-#endif
#include <svx/fontitem.hxx>
#include <svx/langitem.hxx>
#include <svx/cscoitem.hxx>
@@ -74,7 +72,6 @@
#include <acorrect.hxx>
#include <shellres.hxx>
#include <section.hxx>
-#include <fmthbsh.hxx>
#include <frmatr.hxx>
#include <charatr.hxx>
#include <mdiexp.hxx>
@@ -645,7 +642,7 @@ BOOL SwAutoFormat::DoUnderline()
aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
aBox.SetDistance( 42 ); // ~0,75 mm
aSet.Put(aBox);
- pDoc->Insert( aDelPam, aSet, 0 );
+ pDoc->InsertItemSet( aDelPam, aSet, 0 );
aDelPam.DeleteMark();
}
@@ -1300,7 +1297,9 @@ void SwAutoFormat::DelMoreLinesBlanks( BOOL bWithLineBreaks )
BOOL bHasBlnks = HasSelBlanks( *pNxt );
DeleteSel( *pNxt );
if( !bHasBlnks )
- pDoc->Insert( *pNxt, ' ' );
+ {
+ pDoc->InsertString( *pNxt, sal_Unicode(' ') );
+ }
}
if( pNxt == &aDelPam )
@@ -1357,7 +1356,9 @@ void SwAutoFormat::BuildIndent()
IsBlanksInString( *pNxtNd ) ||
IsSentenceAtEnd( *pNxtNd );
if( DeleteAktNxtPara( pNxtNd->GetTxt() ))
- pDoc->Insert( aDelPam, ' ' );
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
if( bBreak )
break;
pNxtNd = GetNextNode();
@@ -1396,7 +1397,9 @@ void SwAutoFormat::BuildTextIndent()
bBreak = !IsFastFullLine( *pNxtNd ) || IsBlanksInString( *pNxtNd ) ||
IsSentenceAtEnd( *pNxtNd );
if( DeleteAktNxtPara( pNxtNd->GetTxt() ) )
- pDoc->Insert( aDelPam, ' ' );
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
if( bBreak )
break;
pNxtNd = GetNextNode();
@@ -1430,7 +1433,9 @@ void SwAutoFormat::BuildText()
bBreak = !IsFastFullLine( *pNxtNd ) || IsBlanksInString( *pNxtNd ) ||
IsSentenceAtEnd( *pNxtNd );
if( DeleteAktNxtPara( pNxtNd->GetTxt() ) )
- pDoc->Insert( aDelPam, ' ' );
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
if( bBreak )
break;
const SwTxtNode* pCurrNode = pNxtNd;
@@ -1705,7 +1710,7 @@ void SwAutoFormat::BuildEnum( USHORT nLvl, USHORT nDigitLevel )
String sChgStr( '\t' );
if( bChgBullet )
sChgStr.Insert( aFlags.cBullet, 0 );
- pDoc->Insert( aDelPam, sChgStr, true );
+ pDoc->InsertString( aDelPam, sChgStr );
SfxItemSet aSet( pDoc->GetAttrPool(), aTxtNodeSetRange );
if( bChgBullet )
@@ -1745,7 +1750,9 @@ void SwAutoFormat::BuildEnum( USHORT nLvl, USHORT nDigitLevel )
bBreak = !IsFastFullLine( *pNxtNd ) || IsBlanksInString( *pNxtNd ) ||
IsSentenceAtEnd( *pNxtNd );
if( DeleteAktNxtPara( pNxtNd->GetTxt() ) )
- pDoc->Insert( aDelPam, ' ' );
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
if( bBreak )
break;
const SwTxtNode* pCurrNode = pNxtNd;
@@ -1813,7 +1820,9 @@ void SwAutoFormat::BuildNegIndent( SwTwips nSpaces )
aDelPam.GetMark()->nContent = nSpaceStt;
DeleteSel( aDelPam );
if( bInsTab )
- pDoc->Insert( aDelPam, '\t' );
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode('\t') );
+ }
}
}
@@ -1831,7 +1840,9 @@ void SwAutoFormat::BuildNegIndent( SwTwips nSpaces )
IsBlanksInString( *pNxtNd ) ||
IsSentenceAtEnd( *pNxtNd );
if( DeleteAktNxtPara( pNxtNd->GetTxt() ) )
- pDoc->Insert( aDelPam, ' ' );
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
if( bBreak )
break;
pNxtNd = GetNextNode();
@@ -1942,7 +1953,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
sReplace.Erase( 1 );
bSetHardBlank = TRUE;
}
- pDoc->Replace( aDelPam, sReplace, FALSE );
+ pDoc->ReplaceRange( aDelPam, sReplace, false );
if( aFlags.bWithRedlining )
{
@@ -1957,7 +1968,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
aDelPam.DeleteMark();
if( bSetHardBlank )
{
- pDoc->Insert( aDelPam, CHAR_HARDBLANK );
+ pDoc->InsertString( aDelPam, CHAR_HARDBLANK );
++nPos;
}
}
@@ -1994,7 +2005,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
aDelPam.SetMark();
aDelPam.GetPoint()->nContent = nPos+1;
- pDoc->Replace( aDelPam, sReplace, FALSE );
+ pDoc->ReplaceRange( aDelPam, sReplace, false );
if( aFlags.bWithRedlining )
{
@@ -2012,7 +2023,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
if( bSetHardBlank )
{
aDelPam.GetPoint()->nContent = nPos;
- pDoc->Insert( aDelPam, CHAR_HARDBLANK );
+ pDoc->InsertString( aDelPam, CHAR_HARDBLANK );
aDelPam.GetPoint()->nContent = ++nPos;
}
}
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index bcdea59eaa16..4ec1934f0e87 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -141,7 +141,9 @@ void SwEditShell::SetAttr( const SfxPoolItem& rHint, USHORT nFlags )
FOREACHPAM_START(this)
if( PCURCRSR->HasMark() && ( bIsTblMode ||
*PCURCRSR->GetPoint() != *PCURCRSR->GetMark() ))
- GetDoc()->Insert(*PCURCRSR, rHint, nFlags );
+ {
+ GetDoc()->InsertPoolItem(*PCURCRSR, rHint, nFlags );
+ }
FOREACHPAM_END()
GetDoc()->EndUndo(UNDO_INSATTR, NULL);
@@ -150,7 +152,7 @@ void SwEditShell::SetAttr( const SfxPoolItem& rHint, USHORT nFlags )
{
if( !HasSelection() )
UpdateAttr();
- GetDoc()->Insert( *pCrsr, rHint, nFlags );
+ GetDoc()->InsertPoolItem( *pCrsr, rHint, nFlags );
}
EndAllAction();
}
@@ -169,7 +171,9 @@ void SwEditShell::SetAttr( const SfxItemSet& rSet, USHORT nFlags )
FOREACHPAM_START(this)
if( PCURCRSR->HasMark() && ( bIsTblMode ||
*PCURCRSR->GetPoint() != *PCURCRSR->GetMark() ))
- GetDoc()->Insert(*PCURCRSR, rSet, nFlags );
+ {
+ GetDoc()->InsertItemSet(*PCURCRSR, rSet, nFlags );
+ }
FOREACHPAM_END()
GetDoc()->EndUndo(UNDO_INSATTR, NULL);
@@ -178,7 +182,7 @@ void SwEditShell::SetAttr( const SfxItemSet& rSet, USHORT nFlags )
{
if( !HasSelection() )
UpdateAttr();
- GetDoc()->Insert( *pCrsr, rSet, nFlags );
+ GetDoc()->InsertItemSet( *pCrsr, rSet, nFlags );
}
EndAllAction();
}
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 2bf30449f33b..5ca8e4f2c3cb 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -452,17 +452,21 @@ BOOL lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos,
}
// and fields
- const SwTxtAttr* pTFld;
- if( CH_TXTATR_BREAKWORD == rTxt.GetChar( nPos ) &&
- 0 != ( pTFld = rTNd.GetTxtAttr( nPos ) ) )
+ if ( CH_TXTATR_BREAKWORD == rTxt.GetChar( nPos ) )
{
- bRet = TRUE; // all other then fields can be
- // defined as weak-script ?
- const SwField* pFld;
- if( RES_TXTATR_FIELD == pTFld->Which() &&
- 0 != (pFld = pTFld->GetFld().GetFld() ) )
+ const SwTxtAttr* const pAttr = rTNd.GetTxtAttrForCharAt( nPos );
+ if (pAttr)
{
- sExp += pFld->Expand();
+ bRet = TRUE; // all other than fields can be
+ // defined as weak-script ?
+ if ( RES_TXTATR_FIELD == pAttr->Which() )
+ {
+ const SwField* const pFld = pAttr->GetFld().GetFld();
+ if (pFld)
+ {
+ sExp += pFld->Expand();
+ }
+ }
}
}
@@ -474,14 +478,14 @@ BOOL lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos,
{
USHORT nScript;
for( n = 0; n < nEnd; n = (xub_StrLen)
- pBreakIt->xBreak->endOfScript( sExp, n, nScript ))
+ pBreakIt->GetBreakIter()->endOfScript( sExp, n, nScript ))
{
- nScript = pBreakIt->xBreak->getScriptType( sExp, n );
+ nScript = pBreakIt->GetBreakIter()->getScriptType( sExp, n );
rScrpt |= lcl_SetScriptFlags( nScript );
}
}
else
- rScrpt |= lcl_SetScriptFlags( pBreakIt->xBreak->
+ rScrpt |= lcl_SetScriptFlags( pBreakIt->GetBreakIter()->
getScriptType( sExp, nEnd-1 ));
}
@@ -493,7 +497,7 @@ BOOL lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos,
USHORT SwEditShell::GetScriptType() const
{
USHORT nRet = 0;
- if( pBreakIt->xBreak.is() )
+ //if( pBreakIt->GetBreakIter().is() )
{
FOREACHPAM_START(this)
@@ -525,7 +529,7 @@ USHORT SwEditShell::GetScriptType() const
{
nScript = pScriptInfo ?
pScriptInfo->ScriptType( nPos ) :
- pBreakIt->xBreak->getScriptType( pTNd->GetTxt(), nPos );
+ pBreakIt->GetBreakIter()->getScriptType( pTNd->GetTxt(), nPos );
}
else
nScript = GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() );
@@ -534,7 +538,7 @@ USHORT SwEditShell::GetScriptType() const
nRet |= lcl_SetScriptFlags( nScript );
}
}
- else
+ else if ( pBreakIt->GetBreakIter().is() )
{
ULONG nEndIdx = pEnd->nNode.GetIndex();
SwNodeIndex aIdx( pStt->nNode );
@@ -563,7 +567,7 @@ USHORT SwEditShell::GetScriptType() const
{
nScript = pScriptInfo ?
pScriptInfo->ScriptType( nChg ) :
- pBreakIt->xBreak->getScriptType(
+ pBreakIt->GetBreakIter()->getScriptType(
rTxt, nChg );
if( !lcl_IsNoEndTxtAttrAtPos( *pTNd, nChg, nRet, TRUE,
@@ -578,7 +582,7 @@ USHORT SwEditShell::GetScriptType() const
nChg = pScriptInfo ?
pScriptInfo->NextScriptChg( nChg ) :
- (xub_StrLen)pBreakIt->xBreak->endOfScript(
+ (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript(
rTxt, nChg, nScript );
nFldPos = rTxt.Search(
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 384aa414895a..b2a090be6fdc 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -249,7 +249,8 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
bFirstMove = FALSE;
}
- if( !GetDoc()->Copy( *PCURCRSR, *pPos, false ))
+ const bool bSuccess( GetDoc()->CopyRange( *PCURCRSR, *pPos, false ) );
+ if (!bSuccess)
continue;
SwPaM aInsertPaM(*pPos, SwPosition(aSttNdIdx));
@@ -319,7 +320,8 @@ BOOL SwEditShell::Replace( const String& rNewStr, BOOL bRegExpRplc )
FOREACHPAM_START(this)
if( PCURCRSR->HasMark() && *PCURCRSR->GetMark() != *PCURCRSR->GetPoint() )
{
- bRet = GetDoc()->Replace( *PCURCRSR, rNewStr, bRegExpRplc ) || bRet;
+ bRet = GetDoc()->ReplaceRange( *PCURCRSR, rNewStr, bRegExpRplc )
+ || bRet;
SaveTblBoxCntnt( PCURCRSR->GetPoint() );
}
FOREACHPAM_END()
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 128da7d38f59..c112f257d77a 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -232,8 +232,8 @@ void SwEditShell::FieldToText( SwFieldType* pType )
String aEntry( pFmtFld->GetFld()->Expand() );
pPaM->SetMark();
pPaM->Move( fnMoveForward );
- GetDoc()->Delete( *pPaM );
- GetDoc()->Insert( *pPaM, aEntry, true );
+ GetDoc()->DeleteRange( *pPaM );
+ GetDoc()->InsertString( *pPaM, aEntry );
}
else if( bDDEFld )
{
@@ -258,17 +258,20 @@ void SwEditShell::FieldToText( SwFieldType* pType )
|* Quelle: vgl. SwEditShell::Insert( String )
|*
*************************************************************************/
-void SwEditShell::Insert(SwField& rFld)
+void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints)
{
SET_CURR_SHELL( this );
StartAllAction();
SwFmtFld aFld( rFld );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ : nsSetAttrMode::SETATTR_DEFAULT;
+
FOREACHPAM_START(this) // fuer jeden PaM
- if( !GetDoc()->Insert( *PCURCRSR, aFld, 0 ) )
- {
- ASSERT( FALSE, "Doc->Insert(Field) failed")
- }
+ bool bSuccess(GetDoc()->InsertPoolItem(*PCURCRSR, aFld, nInsertFlags));
+ ASSERT( bSuccess, "Doc->Insert(Field) failed");
+ (void) bSuccess;
FOREACHPAM_END() // fuer jeden PaM
EndAllAction();
@@ -285,11 +288,11 @@ void SwEditShell::Insert(SwField& rFld)
inline SwTxtFld *GetDocTxtFld( const SwPosition* pPos )
{
- SwTxtNode *pNode = pPos->nNode.GetNode().GetTxtNode();
- if( pNode )
- return pNode->GetTxtFld( pPos->nContent );
- else
- return 0;
+ SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode();
+ return (pNode)
+ ? static_cast<SwTxtFld*>( pNode->GetTxtAttrForCharAt(
+ pPos->nContent.GetIndex(), RES_TXTATR_FIELD ))
+ : 0;
}
SwField* SwEditShell::GetCurFld() const
diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx
index 27a7a321d257..84c43f4d830a 100644
--- a/sw/source/core/edit/edglbldc.cxx
+++ b/sw/source/core/edit/edglbldc.cxx
@@ -343,7 +343,10 @@ BOOL SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr ,
else
aInsPos = pMyDoc->GetNodes().GetEndOfContent();
- BOOL bRet = pMyDoc->Move( aRg, aInsPos, IDocumentContentOperations::DOC_MOVEALLFLYS );
+ bool bRet = pMyDoc->MoveNodeRange( aRg, aInsPos,
+ static_cast<IDocumentContentOperations::SwMoveFlags>(
+ IDocumentContentOperations::DOC_MOVEALLFLYS
+ | IDocumentContentOperations::DOC_CREATEUNDOOBJ ));
EndAllAction();
return bRet;
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index b408a1c33c81..64ed3068d79c 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -168,7 +168,7 @@ USHORT SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock,
aStt = pGDoc->GetNodes().GetEndOfExtras();
pCntntNd = pGDoc->GetNodes().GoNext( &aStt );
SwPosition aInsPos( aStt, SwIndex( pCntntNd ));
- pMyDoc->Copy( aCpyPam, aInsPos, false );
+ pMyDoc->CopyRange( aCpyPam, aInsPos, false );
nRet = rBlock.PutDoc();
}
@@ -250,13 +250,16 @@ BOOL SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
{
PCURCRSR->SetMark();
PCURCRSR->Move( fnMoveForward, fnGoCntnt );
- bRet = GetDoc()->Copy( *PCURCRSR, aPos, false ) || bRet;
+ bRet = GetDoc()->CopyRange( *PCURCRSR, aPos, false )
+ || bRet;
PCURCRSR->Exchange();
PCURCRSR->DeleteMark();
}
}
else
- bRet = GetDoc()->Copy( *PCURCRSR, aPos, false ) || bRet;
+ {
+ bRet = GetDoc()->CopyRange( *PCURCRSR, aPos, false ) || bRet;
+ }
FOREACHPAM_END()
}
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 4553038f3abb..4d7cbc07e4ad 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -86,10 +86,9 @@ void SwEditShell::Insert( sal_Unicode c, BOOL bOnlyCurrCrsr )
StartAllAction();
FOREACHPAM_START(this)
- if( !GetDoc()->Insert(*PCURCRSR, c) )
- {
- ASSERT( FALSE, "Doc->Insert(c) failed." )
- }
+ const bool bSuccess = GetDoc()->InsertString(*PCURCRSR, c);
+ ASSERT( bSuccess, "Doc->Insert() failed." );
+ (void) bSuccess;
SaveTblBoxCntnt( PCURCRSR->GetPoint() );
if( bOnlyCurrCrsr )
@@ -106,17 +105,24 @@ void SwEditShell::Insert( sal_Unicode c, BOOL bOnlyCurrCrsr )
******************************************************************************/
-void SwEditShell::Insert(const String &rStr)
+void SwEditShell::Insert2(const String &rStr, const bool bForceExpandHints )
{
StartAllAction();
{
+ const enum IDocumentContentOperations::InsertFlags nInsertFlags =
+ (bForceExpandHints)
+ ? static_cast<IDocumentContentOperations::InsertFlags>(
+ IDocumentContentOperations::INS_FORCEHINTEXPAND |
+ IDocumentContentOperations::INS_EMPTYEXPAND)
+ : IDocumentContentOperations::INS_EMPTYEXPAND;
+
SwPaM *_pStartCrsr = getShellCrsr( true ), *__pStartCrsr = _pStartCrsr;
do {
//OPT: GetSystemCharSet
- if( !GetDoc()->Insert( *_pStartCrsr, rStr, true ) )
- {
- ASSERT( FALSE, "Doc->Insert(Str) failed." )
- }
+ const bool bSuccess =
+ GetDoc()->InsertString(*_pStartCrsr, rStr, nInsertFlags);
+ ASSERT( bSuccess, "Doc->Insert() failed." );
+ (void) bSuccess;
SaveTblBoxCntnt( _pStartCrsr->GetPoint() );
@@ -778,7 +784,7 @@ BOOL SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, BOOL
if( bInsTxt )
{
- Insert( rStr );
+ Insert2( rStr );
SetMark();
ExtendSelection( FALSE, rStr.Len() );
}
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index f444f293f6c5..5a455bb295f7 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -49,7 +49,6 @@
#include <svx/langitem.hxx>
#include <svx/SpellPortions.hxx>
#include <svx/scripttypeitem.hxx>
-#include <fmthbsh.hxx>
#include <charatr.hxx>
#include <editsh.hxx>
#include <doc.hxx>
@@ -70,6 +69,8 @@
#include <redline.hxx> // SwRedline
#include <docary.hxx> // SwRedlineTbl
#include <docsh.hxx>
+#include <txatbase.hxx>
+
using namespace ::svx;
using namespace ::com::sun::star;
@@ -682,7 +683,7 @@ void SwHyphIter::InsertSoftHyph( const xub_StrLen nHyphPos )
DelSoftHyph( *pCrsr );
pSttPos->nContent += nHyphPos;
SwPaM aRg( *pSttPos );
- pDoc->Insert( aRg, CHAR_SOFTHYPHEN );
+ pDoc->InsertString( aRg, CHAR_SOFTHYPHEN );
// Durch das Einfuegen des SoftHyphs ist ein Zeichen hinzugekommen
//JP 18.07.95: warum, ist doch ein SwIndex, dieser wird doch mitverschoben !!
// pSttPos->nContent++;
@@ -1342,7 +1343,7 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
// ... and apply language if necessary
if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId), nLangWhichId );
- pDoc->Insert(*pCrsr, aCurrentNewPortion->sText, true);
+ pDoc->InsertString(*pCrsr, aCurrentNewPortion->sText);
}
else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
{
@@ -1388,7 +1389,7 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
if(rLang.GetLanguage() != aCurrentNewPortion->eLanguage)
SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
//insert the new string
- pDoc->Insert(*pCrsr, aCurrentNewPortion->sText, true);
+ pDoc->InsertString(*pCrsr, aCurrentNewPortion->sText);
//set the cursor to the end of the inserted string
*pCrsr->Start() = *pCrsr->End();
@@ -1819,20 +1820,18 @@ void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > xAlt,
xub_Unicode cChar = pTxtNode->GetTxt().GetChar( pCrsr->GetMark()->nContent.GetIndex() );
if( CH_TXTATR_BREAKWORD == cChar || CH_TXTATR_INWORD == cChar)
{
- const SwTxtAttr* pTxtAttr = pTxtNode->GetTxtAttr(
- pCrsr->GetMark()->nContent.GetIndex(), RES_TXTATR_FIELD );
- bField = 0 != pTxtAttr;
- if(!bField)
- {
- const SwTxtAttr* pTmpTxtAttr = pTxtNode->GetTxtAttr(
- pCrsr->GetMark()->nContent.GetIndex(), RES_TXTATR_FTN );
- bField = 0 != pTmpTxtAttr;
- }
- if(!bField)
+ const SwTxtAttr* pTxtAttr = pTxtNode->GetTxtAttrForCharAt(
+ pCrsr->GetMark()->nContent.GetIndex() );
+ const USHORT nWhich = pTxtAttr
+ ? pTxtAttr->Which()
+ : static_cast<USHORT>(RES_TXTATR_END);
+ switch (nWhich)
{
- const SwTxtAttr* pTmpTxtAttr = pTxtNode->GetTxtAttr(
- pCrsr->GetMark()->nContent.GetIndex(), RES_TXTATR_FLYCNT );
- bField = 0 != pTmpTxtAttr;
+ case RES_TXTATR_FIELD:
+ case RES_TXTATR_FTN:
+ case RES_TXTATR_FLYCNT:
+ bField = true;
+ break;
}
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index b25804eadfc4..7dd2000ce9a6 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -825,9 +825,9 @@ USHORT SwEditShell::GetNodeNumStart() const
-----------------------------------------------------------------------*/
// --> OD 2008-03-18 #refactorlists#
-const SwNumRule * SwEditShell::SearchNumRule( BOOL bForward,
- BOOL bNum,
- BOOL bOutline,
+const SwNumRule * SwEditShell::SearchNumRule( const bool bForward,
+ const bool bNum,
+ const bool bOutline,
int nNonEmptyAllowed,
String& sListId )
{
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index bf6565d352fd..e630c3ff5f0a 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -56,8 +56,8 @@ const SwSection* SwEditShell::InsertSection( const SwSection& rNew,
GetDoc()->StartUndo( UNDO_INSSECTION, NULL );
FOREACHPAM_START(this)
- const SwSection* pNew = GetDoc()->Insert( *PCURCRSR,
- rNew, pAttr );
+ const SwSection* const pNew =
+ GetDoc()->InsertSwSection( *PCURCRSR, rNew, pAttr );
if( !pRet )
pRet = pNew;
FOREACHPAM_END()
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 01c9b6f6cb76..0888693eaedc 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -82,10 +82,13 @@ void SwEditShell::Insert(const SwTOXMark& rMark)
if( bInsAtPos )
{
SwPaM aTmp( *pStt );
- GetDoc()->Insert( aTmp, rMark, 0 );
+ GetDoc()->InsertPoolItem( aTmp, rMark, 0 );
}
else if( *pEnd != *pStt )
- GetDoc()->Insert( *PCURCRSR, rMark, nsSetAttrMode::SETATTR_DONTEXPAND );
+ {
+ GetDoc()->InsertPoolItem( *PCURCRSR, rMark,
+ nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
FOREACHPAM_END()
EndAllAction();
@@ -98,7 +101,7 @@ void SwEditShell::DeleteTOXMark( SwTOXMark* pMark )
SET_CURR_SHELL( this );
StartAllAction();
- pDoc->Delete( pMark );
+ pDoc->DeleteTOXMark( pMark );
EndAllAction();
}
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 029759a6c056..6a6ffb9d3fbd 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -159,13 +159,13 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const
// beginnt an erster Position ein "RechenFeld", dann erfrage den Wert
// von diesem
- sal_Unicode cChr;
- if( nSttPos < rTxt.Len() &&
- ( CH_TXTATR_BREAKWORD == ( cChr = rTxt.GetChar(nSttPos)) ||
- CH_TXTATR_INWORD == cChr ))
+ sal_Unicode const Char = rTxt.GetChar(nSttPos);
+ if ( nSttPos < rTxt.Len() &&
+ ( CH_TXTATR_BREAKWORD == Char || CH_TXTATR_INWORD == Char ) )
{
SwIndex aIdx( pTxtNd, nSttPos );
- SwTxtFld* pTxtFld = pTxtNd->GetTxtFld( aIdx );
+ SwTxtFld * const pTxtFld = static_cast<SwTxtFld*>(
+ pTxtNd->GetTxtAttrForCharAt(aIdx.GetIndex(), RES_TXTATR_FIELD));
if( !pTxtFld )
break;
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 141ef1b080de..8fd7124a6c91 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -131,8 +131,8 @@ void SwDDETable::ChangeContent()
SwTxtNode* pTxtNode = aNdIdx.GetNode().GetTxtNode();
ASSERT( pTxtNode, "Kein Node" );
SwIndex aCntIdx( pTxtNode, 0 );
- pTxtNode->Erase( aCntIdx );
- pTxtNode->Insert( aLine.GetToken( i, '\t' ), aCntIdx );
+ pTxtNode->EraseText( aCntIdx );
+ pTxtNode->InsertText( aLine.GetToken( i, '\t' ), aCntIdx );
SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)pBox->GetFrmFmt();
pBoxFmt->LockModify();
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index cdb73706b3c2..6bb8ff4902ea 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -66,6 +66,7 @@
#endif
#include <svtools/urihelper.hxx>
#include <svtools/useroptions.hxx>
+#include <svtools/syslocale.hxx>
#include <tools/time.hxx>
#include <tools/datetime.hxx>
@@ -931,10 +932,11 @@ SwFieldType* SwDocInfoFieldType::Copy() const
}
void lcl_GetLocalDataWrapper( ULONG nLang,
- LocaleDataWrapper **ppAppLocalData,
- LocaleDataWrapper **ppLocalData )
+ const LocaleDataWrapper **ppAppLocalData,
+ const LocaleDataWrapper **ppLocalData )
{
- *ppAppLocalData = &GetAppLocaleData();
+ SvtSysLocale aLocale;
+ *ppAppLocalData = &aLocale.GetLocaleData();
*ppLocalData = *ppAppLocalData;
if( nLang != SvxLocaleToLanguage( (*ppLocalData)->getLocale() ) )
*ppLocalData = new LocaleDataWrapper(
@@ -949,7 +951,7 @@ String SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat,
sal_uInt16 nLang, const String& rName ) const
{
String aStr;
- LocaleDataWrapper *pAppLocalData = 0, *pLocalData = 0;
+ const LocaleDataWrapper *pAppLocalData = 0, *pLocalData = 0;
SwDocShell *pDocShell(GetDoc()->GetDocShell());
DBG_ASSERT(pDocShell, "no SwDocShell");
if (!pDocShell) { return aStr; }
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 3de792b4f0ac..a06f595293aa 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -611,7 +611,7 @@ SwFieldType* SwValueField::ChgTyp( SwFieldType* pNewType )
sal_uInt32 SwValueField::GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt)
{
const SvNumberformat* pEntry = pFormatter->GetEntry(nFmt);
- USHORT nLng = SvxLocaleToLanguage( GetAppLocaleData().getLocale() );
+ USHORT nLng = SvxLocaleToLanguage( SvtSysLocale().GetLocaleData().getLocale() );
if (pEntry && nLng != pEntry->GetLanguage())
{
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index dda7cec0e439..596a390cd2ae 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -64,8 +64,9 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLa
if( !pTxtFrm->IsFollow() )
{
pTxtFrm = ((SwTxtFrm*)pTxtFrm)->GetFrmAtPos( rPos );
- SwPageFrm *pPage = pTxtFrm ? pTxtFrm->FindPageFrm() : 0;
- if( pPage )
+ SwPageFrm *pPage = pTxtFrm ? pTxtFrm->FindPageFrm() : 0;
+ // #i103490#
+ if ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() )
{
SwLayoutInfo aInfo;
pTxtFrm->GetCharRect( aInfo.mPosition, rPos, 0 );
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index e9e8644c5eb3..372cf878f842 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -331,8 +331,8 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
case REF_ONLYCAPTION:
{
- const SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttr( nStt,
- RES_TXTATR_FIELD );
+ const SwTxtAttr* const pTxtAttr =
+ pTxtNd->GetTxtAttrForCharAt(nStt, RES_TXTATR_FIELD);
if( pTxtAttr )
nStt = SwGetExpField::GetReferenceTextPos(
pTxtAttr->GetFld(), *pDoc );
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 07c8a0911080..ccd2d86e4531 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -34,13 +34,7 @@
#include <hintids.hxx>
-#ifdef WIN
-#define NEEDED_BY_FESHVIEW
-#endif
-
-#ifndef _GRAPH_HXX
#include <vcl/graph.hxx>
-#endif
#include <sot/formats.hxx>
#include <sot/storage.hxx>
#include <svtools/pathoptions.hxx>
@@ -58,9 +52,7 @@
#include <svx/svdogrp.hxx>
#include <svx/xoutbmp.hxx>
#include <svx/svdoole2.hxx>
-#ifndef _FM_FMMODEL_HXX
#include <svx/fmmodel.hxx>
-#endif
#include <svx/unomodel.hxx>
// --> OD 2005-08-03 #i50824#
#include <svx/svditer.hxx>
@@ -93,9 +85,7 @@
#include <dview.hxx>
#include <dcontact.hxx>
#include <dflyobj.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <pagedesc.hxx>
#include <mvsave.hxx>
#include <vcl/virdev.hxx>
@@ -145,7 +135,7 @@ BOOL SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt )
// benutzen.
if( pNewClpTxt )
{
- pTxtNd->Insert( *pNewClpTxt, SwIndex( pTxtNd ) );
+ pTxtNd->InsertText( *pNewClpTxt, SwIndex( pTxtNd ) );
return TRUE; // das wars.
}
@@ -198,7 +188,7 @@ BOOL SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt )
if( pTxtFly )
{
((SwFmtFlyCnt&)pTxtFly->GetFlyCnt()).SetFlyFmt( 0 );
- pTxtNd->Erase( rIdx, 1 );
+ pTxtNd->EraseText( rIdx, 1 );
}
}
bRet = TRUE;
@@ -840,7 +830,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames )
{
SwNodeIndex aIndexBefore(rInsPos.nNode);
aIndexBefore--;
- pClpDoc->Copy( rCopy, rInsPos, false );
+ pClpDoc->CopyRange( rCopy, rInsPos, false );
{
aIndexBefore++;
SwPaM aPaM(SwPosition(aIndexBefore, 0),
@@ -1069,7 +1059,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames )
aIndexBefore--;
- pClpDoc->Copy( aCpyPam, rInsPos, false );
+ pClpDoc->CopyRange( aCpyPam, rInsPos, false );
{
aIndexBefore++;
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index d7ee250cf216..e8e91ae37621 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -127,7 +127,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc )
else
{
SwPaM aPaM( *((SwCntntFrm*)pFlow)->GetNode() );
- GetDoc()->Insert( aPaM, aNew, 0 );
+ GetDoc()->InsertPoolItem( aPaM, aNew, 0 );
}
EndAllActionAndCall();
}
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 6d7059b3cf0e..d465abc4403e 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -34,7 +34,6 @@
#include "hintids.hxx"
#ifdef WIN
-#define NEEDED_BY_FESHVIEW
#define _FESHVIEW_ONLY_INLINE_NEEDED
#endif
@@ -1874,7 +1873,8 @@ BOOL SwFEShell::ImpEndCreate()
{
ASSERT( aAnch.GetAnchorId() == FLY_IN_CNTNT, "wrong AnchorType" );
SwTxtNode *pNd = aAnch.GetCntntAnchor()->nNode.GetNode().GetTxtNode();
- pNd->InsertItem( SwFmtFlyCnt( pFmt ),
+ SwFmtFlyCnt aFmt( pFmt );
+ pNd->InsertItem(aFmt,
aAnch.GetCntntAnchor()->nContent.GetIndex(), 0 );
SwFmtVertOrient aVertical( pFmt->GetVertOrient() );
aVertical.SetVertOrient( text::VertOrientation::LINE_CENTER );
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 13e6a5e732b3..d82b1de4cfdb 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -411,7 +411,9 @@ void lcl_SetAPageOffset( USHORT nOffset, SwPageFrm* pPage, SwFEShell* pThis )
if ( pFrm->IsInTab() )
pThis->GetDoc()->SetAttr( aDesc, *pFrm->FindTabFrm()->GetFmt() );
else
- pThis->GetDoc()->Insert( *pThis->GetCrsr(), aDesc, 0 );
+ {
+ pThis->GetDoc()->InsertPoolItem( *pThis->GetCrsr(), aDesc, 0 );
+ }
pThis->EndAllAction();
}
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index ba550304e04a..f971be8d79e4 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -1462,7 +1462,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
if( pUndo )
pUndo->MoveBoxCntnt( pDoc, aRg, rInsPosNd );
else
- pDoc->Move( aRg, rInsPosNd, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ {
+ pDoc->MoveNodeRange( aRg, rInsPosNd,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
+ }
// wo steht jetzt aInsPos ??
if( bCalcWidth )
diff --git a/sw/source/core/inc/GetMetricVal.hxx b/sw/source/core/inc/GetMetricVal.hxx
index 5d16d43fb1f9..9db99426dc03 100644
--- a/sw/source/core/inc/GetMetricVal.hxx
+++ b/sw/source/core/inc/GetMetricVal.hxx
@@ -39,7 +39,7 @@
inline USHORT GetMetricVal( int n )
{
#ifdef USE_MEASUREMENT
- USHORT nVal = MEASURE_METRIC == GetAppLocaleData().getMeasurementSystemEnum()
+ USHORT nVal = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
? 567 // 1 cm
: 770; // 1/2 Inch
#else
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index e1344138babf..18f8860ecab9 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -32,6 +32,8 @@
#define _BOOKMRK_HXX
#include <IMark.hxx>
+#include <sfx2/Metadatable.hxx>
+
#include <boost/scoped_ptr.hpp>
#include <boost/noncopyable.hpp>
@@ -144,6 +146,7 @@ namespace sw { namespace mark
class Bookmark
: virtual public IBookmark
, public DdeBookmark
+ , public ::sfx2::Metadatable
{
public:
Bookmark(const SwPaM& rPaM,
@@ -160,6 +163,15 @@ namespace sw { namespace mark
{ m_sShortName = rShortName; }
virtual void SetKeyCode(const KeyCode& rCode)
{ m_aCode = rCode; }
+
+ // ::sfx2::Metadatable
+ virtual ::sfx2::IXmlIdRegistry& GetRegistry();
+ virtual bool IsInClipboard() const;
+ virtual bool IsInUndo() const;
+ virtual bool IsInContent() const;
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
+
private:
KeyCode m_aCode;
::rtl::OUString m_sShortName;
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 992ed583ed9d..ed172b310a01 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -518,21 +518,26 @@ inline BOOL SwBorderAttrs::IsLine() const
OD 2004-03-10 #i28701#
Values only provided for flow frames (table, section or text frames)
Note: line spacing value is only determined for text frames
+ OD 2009-08-28 #i102458#
+ Add output parameter <obIsLineSpacingProportional>
- @param _rFrm
+ @param rFrm
input parameter - frame, for which the spacing values are determined.
- @param _roPrevLowerSpacing
+ @param onPrevLowerSpacing
output parameter - lower spacing of the frame in SwTwips
- @param _roPrevLineSpacing
+ @param onPrevLineSpacing
output parameter - line spacing of the frame in SwTwips
+ @param obIsLineSpacingProportional
+
@author OD
*/
-void GetSpacingValuesOfFrm( const SwFrm& _rFrm,
- SwTwips& _roLowerSpacing,
- SwTwips& _roLineSpacing );
+void GetSpacingValuesOfFrm( const SwFrm& rFrm,
+ SwTwips& onLowerSpacing,
+ SwTwips& onLineSpacing,
+ bool& obIsLineSpacingProportional );
/** method to get the content of the table cell
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index b8704dac0166..6cbdd743761d 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -39,6 +39,10 @@
#include <IDocumentMarkAccess.hxx>
#include <vector>
+namespace sfx2 {
+ class MetadatableUndo;
+}
+
class SvNumberFormatter;
class SvULongs;
class SwDoc;
@@ -80,6 +84,7 @@ namespace sw { namespace mark
ULONG m_nNode2;
xub_StrLen m_nCntnt1;
xub_StrLen m_nCntnt2;
+ ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo;
};
}}
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index c36d5d9d4192..7cb8c80b305d 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -141,6 +141,7 @@ class SwFont
Color aOverColor; // color of the overlining
BYTE nToxCnt; // Zaehlt die Schachtelungstiefe der Tox
BYTE nRefCnt; // Zaehlt die Schachtelungstiefe der Refs
+ BYTE m_nMetaCount; // count META/METAFIELD
BYTE nActual; // actual font (Latin, CJK or CTL)
// Schalter fuer die Font-Extensions
@@ -245,6 +246,9 @@ public:
inline BYTE &GetRef() { return nRefCnt; }
inline BYTE GetRef() const { return nRefCnt; }
inline BOOL IsRef() const { return ( 0 != nRefCnt ); }
+ inline BYTE &GetMeta() { return m_nMetaCount; }
+ inline BYTE GetMeta() const { return m_nMetaCount; }
+ inline bool IsMeta() const { return (0 != m_nMetaCount); }
inline void SetURL( const BOOL bURL );
inline BOOL IsURL() const { return bURL; }
inline void SetGreyWave( const BOOL bNew );
diff --git a/sw/source/core/inc/txttypes.hxx b/sw/source/core/inc/txttypes.hxx
index 7ab8779c6696..d8818100c956 100644
--- a/sw/source/core/inc/txttypes.hxx
+++ b/sw/source/core/inc/txttypes.hxx
@@ -64,6 +64,7 @@
#define POR_ISOTOX 0x808a
#define POR_REF 0x808b
#define POR_ISOREF 0x808c
+#define POR_META 0x808d
#define POR_EXP 0xc080
#define POR_BLANK 0xc081
diff --git a/sw/source/core/inc/unometa.hxx b/sw/source/core/inc/unometa.hxx
new file mode 100755
index 000000000000..1dc1985f7dfe
--- /dev/null
+++ b/sw/source/core/inc/unometa.hxx
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: unometa.hxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_UNOMETA_HXX
+#define SW_UNOMETA_HXX
+
+#include "calbck.hxx"
+
+#include <sfx2/Metadatable.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase5.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+
+#include <deque>
+
+
+typedef ::std::deque<
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > >
+ TextRangeList_t;
+
+class SwXTextRange;
+class SwPaM;
+class SwTxtMeta;
+namespace sw {
+ class Meta;
+ class MetaField;
+}
+
+typedef
+::cppu::ImplInheritanceHelper5
+< ::sfx2::MetadatableMixin
+, ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::text::XTextContent
+, ::com::sun::star::text::XText
+, ::com::sun::star::container::XEnumerationAccess
+> SwXMetaBaseClass;
+
+class SwXMeta
+ : public SwXMetaBaseClass
+ , public SwClient
+ , private ::boost::noncopyable
+{
+private:
+ struct Impl;
+ ::std::auto_ptr<Impl> m_pImpl;
+
+protected:
+ virtual ~SwXMeta();
+
+public:
+ SwXMeta(SwDoc *const pDoc,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText> const&
+ xParentText,
+ TextRangeList_t * const pPortions, SwTxtMeta * const pHint);
+ SwXMeta(SwDoc *const pDoc);
+
+ TYPEINFO();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& Identifier )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getStart()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString(const rtl::OUString& rString)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XSimpleText
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > SAL_CALL
+ createTextCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > SAL_CALL
+ createTextCursorByRange(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextPosition)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertString(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xRange,
+ const rtl::OUString& aString, sal_Bool bAbsorb)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertControlCharacter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xRange,
+ sal_Int16 nControlCharacter, sal_Bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XText
+ virtual void SAL_CALL insertTextContent(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xRange,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > & xContent,
+ sal_Bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTextContent(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > & xContent)
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createEnumeration()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // MetadatableMixin
+ virtual ::sfx2::Metadatable * GetCoreObject();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModel();
+
+ // SwClient
+ virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew );
+
+ /// init params with position of the attribute content (w/out CH_TXTATR)
+ bool SetContentRange(
+ SwTxtNode *& rpNode, xub_StrLen & rStart, xub_StrLen & rEnd) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ GetParentText() const;
+
+ bool CheckForOwnMemberMeta(const SwXTextRange* const pRange,
+ const SwPaM* const pPam, bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual void SAL_CALL AttachImpl(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange,
+ const USHORT nWhich)
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+private:
+ inline const ::sw::Meta * GetMeta() const;
+
+};
+
+
+typedef
+::cppu::ImplInheritanceHelper2
+< SwXMeta
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::text::XTextField
+> SwXMetaFieldBaseClass;
+
+class SwXMetaField
+ : public SwXMetaFieldBaseClass
+{
+private:
+ virtual ~SwXMetaField();
+
+private:
+ inline const ::sw::MetaField * GetMetaField() const;
+
+public:
+ SwXMetaField(SwDoc *const pDoc,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText> const&
+ xParentText,
+ TextRangeList_t * const pPortions, SwTxtMeta * const pHint);
+ SwXMetaField(SwDoc *const pDoc);
+
+ // 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);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ 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 >& xListener)
+ 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 >& xListener)
+ 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 >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTextField
+ virtual rtl::OUString SAL_CALL getPresentation(sal_Bool bShowCommand)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+/// get prefix/suffix from the RDF repository. @throws RuntimeException
+void getPrefixAndSuffix(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel>& xModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable>& xMetaField,
+ ::rtl::OUString *const o_pPrefix, ::rtl::OUString *const o_pSuffix);
+
+#endif // SW_UNOMETA_HXX
+
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index b829d201ce03..108dadf23ec8 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1514,7 +1514,12 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs,
// values of found previous frame and use these values.
SwTwips nPrevLowerSpace = 0;
SwTwips nPrevLineSpacing = 0;
- GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing );
+ // --> OD 2009-08-28 #i102458#
+ bool bPrevLineSpacingPorportional = false;
+ GetSpacingValuesOfFrm( (*pPrevFrm),
+ nPrevLowerSpace, nPrevLineSpacing,
+ bPrevLineSpacingPorportional );
+ // <--
if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) )
{
nUpper = nPrevLowerSpace + pAttrs->GetULSpace().GetUpper();
@@ -1539,7 +1544,22 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs,
// building its maximum.
if ( pOwn->IsTxtFrm() )
{
- nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true );
+ // --> OD 2009-08-28 #i102458#
+ // Correction:
+ // A proportional line spacing of the previous text frame
+ // is added up to a own leading line spacing.
+ // Otherwise, the maximum of the leading line spacing
+ // of the previous text frame and the own leading line
+ // spacing is built.
+ if ( bPrevLineSpacingPorportional )
+ {
+ nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true );
+ }
+ else
+ {
+ nAdd = Max( nAdd, static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ) );
+ }
+ // <--
}
nUpper += nAdd;
}
@@ -1571,7 +1591,22 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs,
SwTwips nAdd = nPrevLineSpacing;
if ( pOwn->IsTxtFrm() )
{
- nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true );
+ // --> OD 2009-08-28 #i102458#
+ // Correction:
+ // A proportional line spacing of the previous text frame
+ // is added up to a own leading line spacing.
+ // Otherwise, the maximum of the leading line spacing
+ // of the previous text frame and the own leading line
+ // spacing is built.
+ if ( bPrevLineSpacingPorportional )
+ {
+ nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true );
+ }
+ else
+ {
+ nAdd = Max( nAdd, static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ) );
+ }
+ // <--
}
nUpper += nAdd;
}
@@ -1675,7 +1710,10 @@ SwTwips SwFlowFrm::_GetUpperSpaceAmountConsideredForPrevFrm() const
{
SwTwips nPrevLowerSpace = 0;
SwTwips nPrevLineSpacing = 0;
- GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing );
+ // --> OD 2009-08-28 #i102458#
+ bool bDummy = false;
+ GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing, bDummy );
+ // <--
if ( nPrevLowerSpace > 0 || nPrevLineSpacing > 0 )
{
const IDocumentSettingAccess* pIDSA = rThis.GetUpper()->GetFmt()->getIDocumentSettingAccess();
@@ -2697,8 +2735,3 @@ const SwFlowFrm *SwFlowFrm::CastFlowFrm( const SwFrm *pFrm )
return (SwSectionFrm*)pFrm;
return 0;
}
-
-
-
-
-
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 0c1821aed60c..f7fa2a0a8e80 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3655,30 +3655,37 @@ const SwRect SwPageFrm::PrtWithoutHeaderAndFooter() const
/** method to determine the spacing values of a frame
OD 2004-03-10 #i28701#
+ OD 2009-08-28 #i102458#
+ Add output parameter <obIsLineSpacingProportional>
@author OD
*/
-void GetSpacingValuesOfFrm( const SwFrm& _rFrm,
- SwTwips& _roLowerSpacing,
- SwTwips& _roLineSpacing )
+void GetSpacingValuesOfFrm( const SwFrm& rFrm,
+ SwTwips& onLowerSpacing,
+ SwTwips& onLineSpacing,
+ bool& obIsLineSpacingProportional )
{
- if ( !_rFrm.IsFlowFrm() )
+ if ( !rFrm.IsFlowFrm() )
{
- _roLowerSpacing = 0L;
- _roLineSpacing = 0L;
+ onLowerSpacing = 0;
+ onLineSpacing = 0;
}
else
{
- const SvxULSpaceItem& rULSpace = _rFrm.GetAttrSet()->GetULSpace();
- _roLowerSpacing = rULSpace.GetLower();
+ const SvxULSpaceItem& rULSpace = rFrm.GetAttrSet()->GetULSpace();
+ onLowerSpacing = rULSpace.GetLower();
- _roLineSpacing = 0;
- if ( _rFrm.IsTxtFrm() )
+ onLineSpacing = 0;
+ obIsLineSpacingProportional = false;
+ if ( rFrm.IsTxtFrm() )
{
- _roLineSpacing = static_cast<const SwTxtFrm&>(_rFrm).GetLineSpace();
+ onLineSpacing = static_cast<const SwTxtFrm&>(rFrm).GetLineSpace();
+ obIsLineSpacingProportional =
+ onLineSpacing != 0 &&
+ static_cast<const SwTxtFrm&>(rFrm).GetLineSpace( true ) == 0;
}
- ASSERT( _roLowerSpacing >= 0 && _roLineSpacing >= 0,
+ ASSERT( onLowerSpacing >= 0 && onLineSpacing >= 0,
"<GetSpacingValuesOfFrm(..)> - spacing values aren't positive!" );
}
}
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 9cbf7ace6ea7..fb365e4a5116 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -3031,7 +3031,8 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) :
if ( !bInValid )
{
pRoot->ResetIdleFormat();
- pImp->GetShell()->GetDoc()->GetDocShell()->Broadcast( SfxEventHint( SW_EVENT_LAYOUT_FINISHED ) );
+ SfxObjectShell* pDocShell = pImp->GetShell()->GetDoc()->GetDocShell();
+ pDocShell->Broadcast( SfxEventHint( SW_EVENT_LAYOUT_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_LAYOUT_FINISHED), pDocShell ) );
}
}
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 70738152e1bd..56995fcfcb26 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -727,7 +727,8 @@ void lcl_ApplyWorkaroundForB6375613( SwFrm* p_pFirstFrmOnNewPage )
SwDoc* pDoc( pFirstTextFrmOnNewPage->GetTxtNode()->GetDoc() );
IDocumentContentOperations* pIDCO = pFirstTextFrmOnNewPage->GetTxtNode()->getIDocumentContentOperations();
const SwPaM aTmpPaM( *(pFirstTextFrmOnNewPage->GetTxtNode()) );
- pIDCO->Insert( aTmpPaM, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0 );
+ pIDCO->InsertPoolItem( aTmpPaM,
+ SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0 );
pFirstTextFrmOnNewPage->GetTxtNode()->UnlockModify();
uno::Reference< document::XDocumentInfoSupplier > xDoc(
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 6a9c6585e296..1c8a224a7143 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -641,6 +641,6 @@ void SwXMLTextBlocks::MakeBlockText( const String& rText )
}
SwIndex aIdx( pTxtNode );
String sTemp(rText.GetToken( 0, '\015', nPos ) );
- pTxtNode->Insert( sTemp, aIdx );
+ pTxtNode->InsertText( sTemp, aIdx );
} while ( STRING_NOTFOUND != nPos );
}
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index e1c10ab74a09..62634d31d744 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -909,7 +909,10 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
if( pUndo )
pUndo->MoveBoxCntnt( pDoc, aRg, rInsPosNd );
else
- pDoc->Move( aRg, rInsPosNd, IDocumentContentOperations::DOC_NO_DELFRMS );
+ {
+ pDoc->MoveNodeRange( aRg, rInsPosNd,
+ IDocumentContentOperations::DOC_NO_DELFRMS );
+ }
}
}
// Only the cell of the first selected column will stay alive
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 715fa0eed2a6..070e8eb625f9 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2177,8 +2177,10 @@ void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol,
pDoc->DeleteRedline(aTemp, true, USHRT_MAX);
}
- pTNd->Erase( aIdx, n, INS_EMPTYEXPAND );
- pTNd->Insert( rTxt, aIdx, INS_EMPTYEXPAND );
+ pTNd->EraseText( aIdx, n,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
+ pTNd->InsertText( rTxt, aIdx,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
if( pDoc->IsRedlineOn() )
{
@@ -2222,8 +2224,10 @@ void ChgNumToText( SwTableBox& rBox, ULONG nFmt )
// zuruecksetzen, damit sie wieder aufgespannt werden
pTNd->DontExpandFmt( aIdx, FALSE, FALSE );
aIdx = 0;
- pTNd->Erase( aIdx, STRING_LEN, INS_EMPTYEXPAND );
- pTNd->Insert( sTmp, aIdx, INS_EMPTYEXPAND );
+ pTNd->EraseText( aIdx, STRING_LEN,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
+ pTNd->InsertText( sTmp, aIdx,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
}
}
diff --git a/sw/source/core/text/atrhndl.hxx b/sw/source/core/text/atrhndl.hxx
index 42e2a4a80463..3e24ba0a49e1 100644
--- a/sw/source/core/text/atrhndl.hxx
+++ b/sw/source/core/text/atrhndl.hxx
@@ -32,7 +32,7 @@
#define _ATRHNDL_HXX
#define INITIAL_NUM_ATTR 3
-#define NUM_ATTRIBUTE_STACKS 39
+#define NUM_ATTRIBUTE_STACKS 40
#include <txatbase.hxx>
#include <swfntcch.hxx>
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index bd9a0b1418d3..a6ed9f42255b 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -128,16 +128,16 @@ const BYTE StackPos[ static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
35, // RES_CHRATR_OVERLINE, // 38
0, // RES_CHRATR_DUMMY1, // 39
0, // RES_CHRATR_DUMMY2, // 40
- 0, // RES_TXTATR_AUTOFMT, // 41
- 0, // RES_TXTATR_INETFMT // 42
- 36, // RES_TXTATR_REFMARK, // 43
- 37, // RES_TXTATR_TOXMARK, // 44
- 0, // RES_TXTATR_CHARFMT, // 45
- 0, // RES_TXTATR_DUMMY5 // 46
- 38, // RES_TXTATR_CJK_RUBY, // 47
- 0, // RES_TXTATR_UNKNOWN_CONTAINER, // 48
- 0, // RES_TXTATR_DUMMY6, // 49
- 0 // RES_TXTATR_DUMMY7, // 50
+ 36, // RES_TXTATR_REFMARK, // 41
+ 37, // RES_TXTATR_TOXMARK, // 42
+ 38, // RES_TXTATR_META, // 43
+ 38, // RES_TXTATR_METAFIELD, // 44
+ 0, // RES_TXTATR_AUTOFMT, // 45
+ 0, // RES_TXTATR_INETFMT // 46
+ 0, // RES_TXTATR_CHARFMT, // 47
+ 39, // RES_TXTATR_CJK_RUBY, // 48
+ 0, // RES_TXTATR_UNKNOWN_CONTAINER, // 49
+ 0, // RES_TXTATR_DUMMY5 // 50
};
/*************************************************************************
@@ -650,6 +650,10 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const USHORT nAttr )
rFnt.GetRef()--;
else if ( RES_TXTATR_TOXMARK == nAttr )
rFnt.GetTox()--;
+ else if ( (RES_TXTATR_META == nAttr) || (RES_TXTATR_METAFIELD == nAttr) )
+ {
+ rFnt.GetMeta()--;
+ }
else if ( RES_TXTATR_CJK_RUBY == nAttr )
{
// ruby stack has no more attributes
@@ -928,6 +932,13 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu
else
rFnt.GetTox()--;
break;
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ if ( bPush )
+ rFnt.GetMeta()++;
+ else
+ rFnt.GetMeta()--;
+ break;
}
}
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 5a0a600370aa..a5eba7301052 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -243,7 +243,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
nBreakStart = nCutPos;
}
- else if( pBreakIt->xBreak.is() )
+ else if( pBreakIt->GetBreakIter().is() )
{
// New: We should have a look into the last portion, if it was a
// field portion. For this, we expand the text of the field portion
@@ -366,7 +366,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
// determines first possible line break from nRightPos to
// start index of current line
- LineBreakResults aResult = pBreakIt->xBreak->getLineBreak(
+ LineBreakResults aResult = pBreakIt->GetBreakIter()->getLineBreak(
rInf.GetTxt(), nCutPos, aLocale,
rInf.GetLineStart(), aHyphOpt, aUserOpt );
@@ -534,7 +534,7 @@ sal_Bool SwTxtGuess::AlternativeSpelling( const SwTxtFormatInfo &rInf,
xub_StrLen nWordLen;
Boundary aBound =
- pBreakIt->xBreak->getWordBoundary( rInf.GetTxt(), nPos,
+ pBreakIt->GetBreakIter()->getWordBoundary( rInf.GetTxt(), nPos,
pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ),
WordType::DICTIONARY_WORD, sal_True );
nBreakStart = (xub_StrLen)aBound.startPos;
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 46e74abe1da3..fea63bf2dca0 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1277,7 +1277,8 @@ void SwTxtPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
case POR_URL:
case POR_HIDDEN:
case POR_TOX:
- case POR_REF :
+ case POR_REF:
+ case POR_META:
case POR_CONTROLCHAR:
if ( !GetOpt().IsPagePreview() &&
!GetOpt().IsReadonly() &&
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 82d88875090d..bd51317f77fe 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -45,7 +45,6 @@
#include <fmtflcnt.hxx>
#include <fmtcntnt.hxx>
#include <fmtftn.hxx>
-#include <fmthbsh.hxx>
#include <frmatr.hxx>
#include <frmfmt.hxx>
#include <fmtfld.hxx>
@@ -126,19 +125,7 @@ SwAttrIter::~SwAttrIter()
SwTxtAttr *SwAttrIter::GetAttr( const xub_StrLen nPosition ) const
{
- if ( pHints )
- {
- for ( USHORT i = 0; i < pHints->Count(); ++i )
- {
- SwTxtAttr *pPos = pHints->GetTextHint(i);
- xub_StrLen nStart = *pPos->GetStart();
- if( nPosition < nStart )
- return 0;
- if( nPosition == nStart && !pPos->GetEnd() )
- return pPos;
- }
- }
- return 0;
+ return (m_pTxtNode) ? m_pTxtNode->GetTxtAttrForCharAt(nPosition) : 0;
}
/*************************************************************************
@@ -400,10 +387,10 @@ sal_Bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const XubString &rT
xub_StrLen nStop = nIdx;
sal_Bool bClear;
LanguageType eLang = pFnt->GetLanguage();
- if( pBreakIt->xBreak.is() )
+ if( pBreakIt->GetBreakIter().is() )
{
bClear = CH_BLANK == rTxt.GetChar( nStop );
- Boundary aBndry( pBreakIt->xBreak->getWordBoundary( rTxt, nIdx,
+ Boundary aBndry( pBreakIt->GetBreakIter()->getWordBoundary( rTxt, nIdx,
pBreakIt->GetLocale( eLang ),
WordType::DICTIONARY_WORD, TRUE ) );
nStop = (xub_StrLen)aBndry.endPos;
@@ -870,7 +857,7 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd )
if ( nStt == nEnd )
{
- if ( !pBreakIt->xBreak.is() )
+ if ( !pBreakIt->GetBreakIter().is() )
return 100;
SwScriptInfo aScriptInfo;
@@ -878,7 +865,7 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd )
aIter.SeekAndChgAttrIter( nStt, pOut );
Boundary aBound =
- pBreakIt->xBreak->getWordBoundary( GetTxt(), nStt,
+ pBreakIt->GetBreakIter()->getWordBoundary( GetTxt(), nStt,
pBreakIt->GetLocale( aIter.GetFnt()->GetLanguage() ),
WordType::DICTIONARY_WORD, sal_True );
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 6436fe23fc20..cf6603d8a4d7 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -157,8 +157,10 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
GetInfo().SetFont( GetFnt() );
const SwTxtNode *pNode = pFrm->GetTxtNode();
- const SvxLRSpaceItem &rSpace =
- pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace();
+ const SvxLRSpaceItem &rSpace = pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace();
+ // --> OD 2009-09-02 #i95907#
+ const bool bListLevelIndentsApplicable = pFrm->GetTxtNode()->AreListLevelIndentsApplicable();
+ // <--
//
// Carefully adjust the text formatting ranges.
@@ -181,8 +183,13 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
pFrm->Prt().Left() +
nLMWithNum -
pNode->GetLeftMarginWithNum( sal_False ) -
- rSpace.GetLeft() +
- rSpace.GetTxtLeft();
+ // --> OD 2009-09-02 #i95907#
+// rSpace.GetLeft() +
+// rSpace.GetTxtLeft();
+ ( bListLevelIndentsApplicable
+ ? 0
+ : ( rSpace.GetLeft() - rSpace.GetTxtLeft() ) );
+ // <--
}
else
{
@@ -193,8 +200,13 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
pFrm->Prt().Left() +
nLMWithNum -
pNode->GetLeftMarginWithNum( sal_False ) -
- rSpace.GetLeft() +
- rSpace.GetTxtLeft();
+ // --> OD 2009-09-02 #i95907#
+// rSpace.GetLeft() +
+// rSpace.GetTxtLeft();
+ ( bListLevelIndentsApplicable
+ ? 0
+ : ( rSpace.GetLeft() - rSpace.GetTxtLeft() ) );
+ // <--
}
else
{
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 2f01085b89f9..cb54872d19e2 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -107,6 +107,7 @@ void SwTxtFormatter::CtorInitTxtFormatter( SwTxtFrm *pNewFrm, SwTxtFormatInfo *p
nCntMidHyph = 0;
nLeftScanIdx = STRING_LEN;
nRightScanIdx = 0;
+ m_nHintEndIndex = 0;
if( nStart > GetInfo().GetTxt().Len() )
{
@@ -313,7 +314,14 @@ SwLinePortion *SwTxtFormatter::UnderFlow( SwTxtFormatInfo &rInf )
}
}
pPor->Truncate();
- delete rInf.GetRest();
+ SwLinePortion *const pRest( rInf.GetRest() );
+ if (pRest && pRest->InFldGrp() &&
+ static_cast<SwFldPortion*>(pRest)->IsNoLength())
+ {
+ // HACK: decrement again, so we pick up the suffix in next line!
+ --m_nHintEndIndex;
+ }
+ delete pRest;
rInf.SetRest(0);
return pPor;
}
@@ -820,6 +828,34 @@ void SwTxtFormatter::CalcAscent( SwTxtFormatInfo &rInf, SwLinePortion *pPor )
}
/*************************************************************************
+ * class SwMetaPortion
+ *************************************************************************/
+
+class SwMetaPortion : public SwTxtPortion
+{
+public:
+ inline SwMetaPortion() { SetWhichPor( POR_META ); }
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+// OUTPUT_OPERATOR
+};
+
+//CLASSIO( SwMetaPortion )
+
+/*************************************************************************
+ * virtual SwMetaPortion::Paint()
+ *************************************************************************/
+
+void SwMetaPortion::Paint( const SwTxtPaintInfo &rInf ) const
+{
+ if ( Width() )
+ {
+ rInf.DrawViewOpt( *this, POR_META );
+ SwTxtPortion::Paint( rInf );
+ }
+}
+
+
+/*************************************************************************
* SwTxtFormatter::WhichTxtPor()
*************************************************************************/
@@ -832,6 +868,10 @@ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const
{
if( GetFnt()->IsRef() )
pPor = new SwRefPortion;
+ else if (GetFnt()->IsMeta())
+ {
+ pPor = new SwMetaPortion;
+ }
else
{
// Erst zum Schluss !
@@ -1068,6 +1108,12 @@ SwLinePortion *SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf)
pPor = NewTabPortion( rInf, true );
}
+ // 11) suffix of meta-field
+ if (!pPor)
+ {
+ pPor = TryNewNoLengthPortion(rInf);
+ }
+
return pPor;
}
diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx
index f1bb7e05c099..7eaaeb396d3d 100644
--- a/sw/source/core/text/itrform2.hxx
+++ b/sw/source/core/text/itrform2.hxx
@@ -60,6 +60,7 @@ class SwTxtFormatter : public SwTxtPainter
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
+ USHORT m_nHintEndIndex; // HACK for TryNewNoLengthPortion
SwLinePortion *NewPortion( SwTxtFormatInfo &rInf );
SwTxtPortion *NewTxtPortion( SwTxtFormatInfo &rInf );
SwLinePortion *NewExtraPortion( SwTxtFormatInfo &rInf );
@@ -75,6 +76,7 @@ class SwTxtFormatter : public SwTxtPainter
SwTxtAttr *pHt ) const;
SwLinePortion *WhichFirstPortion( SwTxtFormatInfo &rInf );
SwTxtPortion *WhichTxtPor( SwTxtFormatInfo &rInf ) const;
+ SwExpandPortion * TryNewNoLengthPortion( SwTxtFormatInfo & rInfo );
// Das Herzstueck der Formatierung
void BuildPortions( SwTxtFormatInfo &rInf );
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 965de6545fe2..7cfb941545a8 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -48,7 +48,6 @@
#include <fmtftn.hxx>
#include <fmtfld.hxx>
#include <fldbas.hxx> // SwField
-#include <fmthbsh.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
#include <pagedesc.hxx> // SwPageDesc
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 0a8597800aed..932eb1c72b6f 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -85,6 +85,7 @@ SwFldPortion *SwFldPortion::Clone( const XubString &rExpand ) const
pNewFnt = new SwFont( *pFnt );
SwFldPortion* pClone = new SwFldPortion( rExpand, pNewFnt );
pClone->SetNextOffset( nNextOffset );
+ pClone->m_bNoLength = this->m_bNoLength;
return pClone;
}
@@ -99,6 +100,7 @@ void SwFldPortion::TakeNextOffset( const SwFldPortion* pFld )
SwFldPortion::SwFldPortion( const XubString &rExpand, SwFont *pFont, sal_Bool bPlaceHold )
: aExpand(rExpand), pFnt(pFont), nNextOffset(0), nNextScriptChg(STRING_LEN), nViewWidth(0),
bFollow( sal_False ), bHasFollow( sal_False ), bPlaceHolder( bPlaceHold )
+ , m_bNoLength( sal_False )
{
SetWhichPor( POR_FLD );
}
@@ -114,6 +116,7 @@ SwFldPortion::SwFldPortion( const SwFldPortion& rFld )
bCenter( rFld.IsCenter() ),
bHasFollow( rFld.HasFollow() ),
bPlaceHolder( rFld.bPlaceHolder )
+ , m_bNoLength( rFld.m_bNoLength )
{
if ( rFld.HasFont() )
pFnt = new SwFont( *rFld.GetFont() );
@@ -215,25 +218,25 @@ SwFldSlot::~SwFldSlot()
void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf )
{
String aTxt;
- if( GetExpTxt( rInf, aTxt ) && aTxt.Len() && pBreakIt->xBreak.is() )
+ if( GetExpTxt( rInf, aTxt ) && aTxt.Len() && pBreakIt->GetBreakIter().is() )
{
BYTE nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual();
USHORT nScript;
{
- nScript = pBreakIt->xBreak->getScriptType( aTxt, 0 );
+ nScript = pBreakIt->GetBreakIter()->getScriptType( aTxt, 0 );
xub_StrLen nChg = 0;
if( i18n::ScriptType::WEAK == nScript )
{
- nChg =(xub_StrLen)pBreakIt->xBreak->endOfScript(aTxt,0,nScript);
+ nChg =(xub_StrLen)pBreakIt->GetBreakIter()->endOfScript(aTxt,0,nScript);
if( nChg < aTxt.Len() )
- nScript = pBreakIt->xBreak->getScriptType( aTxt, nChg );
+ nScript = pBreakIt->GetBreakIter()->getScriptType( aTxt, nChg );
}
//
// nNextScriptChg will be evaluated during SwFldPortion::Format()
//
if ( nChg < aTxt.Len() )
- nNextScriptChg = (xub_StrLen)pBreakIt->xBreak->endOfScript( aTxt, nChg, nScript );
+ nNextScriptChg = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( aTxt, nChg, nScript );
else
nNextScriptChg = aTxt.Len();
@@ -378,7 +381,7 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
// Das Zeichen wird in der ersten Portion gehalten.
// Unbedingt nach Format!
- SetLen( nFollow );
+ SetLen( (m_bNoLength) ? 0 : nFollow );
if( nRest )
{
@@ -1127,12 +1130,12 @@ SwCombinedPortion::SwCombinedPortion( const XubString &rTxt )
aExpand.Erase( 6 );
// Initialization of the scripttype array,
// the arrays of width and position are filled by the format function
- if( pBreakIt->xBreak.is() )
+ if( pBreakIt->GetBreakIter().is() )
{
BYTE nScr = SW_SCRIPTS;
for( USHORT i = 0; i < rTxt.Len(); ++i )
{
- USHORT nScript = pBreakIt->xBreak->getScriptType( rTxt, i );
+ USHORT nScript = pBreakIt->GetBreakIter()->getScriptType( rTxt, i );
switch ( nScript ) {
case i18n::ScriptType::LATIN : nScr = SW_LATIN; break;
case i18n::ScriptType::ASIAN : nScr = SW_CJK; break;
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 1786691ff5bc..331ee8d401c7 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -61,8 +61,12 @@ protected:
sal_Bool bNoPaint : 1; // wird von SwGrfNumPortion benutzt
sal_Bool bReplace : 1; // wird von SwGrfNumPortion benutzt
sal_Bool bPlaceHolder : 1;
+ sal_Bool m_bNoLength : 1; // HACK for meta suffix (no CH_TXTATR)
inline void SetFont( SwFont *pNew ) { pFnt = pNew; }
+ inline bool IsNoLength() const { return m_bNoLength; }
+ inline void SetNoLength() { m_bNoLength = sal_True; }
+
public:
SwFldPortion( const SwFldPortion& rFld );
SwFldPortion( const XubString &rExpand, SwFont *pFnt = 0, sal_Bool bPlaceHolder = sal_False );
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index b4b739528cd7..76eba6b1e77b 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -798,7 +798,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode )
void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
{
- if( !pBreakIt->xBreak.is() )
+ if( !pBreakIt->GetBreakIter().is() )
return;
const String& rTxt = rNode.GetTxt();
@@ -907,13 +907,13 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// we go back in our group until we reach the first character of
// type nScript
while ( nChg > nGrpStart &&
- nScript != pBreakIt->xBreak->getScriptType( rTxt, nChg ) )
+ nScript != pBreakIt->GetBreakIter()->getScriptType( rTxt, nChg ) )
--nChg;
// If we are at the start of a group, we do not trust nScript,
// we better get nScript from the breakiterator:
if ( nChg == nGrpStart )
- nScript = (BYTE)pBreakIt->xBreak->getScriptType( rTxt, nChg );
+ nScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( rTxt, nChg );
//
// INVALID DATA FROM THE SCRIPT INFO ARRAYS HAS TO BE DELETED:
@@ -959,14 +959,14 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// SCRIPT FOR WEAK CHARACTERS AT THE BEGINNING OF A PARAGRAPH
//
- if( WEAK == pBreakIt->xBreak->getScriptType( rTxt, nChg ) )
+ if( WEAK == pBreakIt->GetBreakIter()->getScriptType( rTxt, nChg ) )
{
// If the beginning of the current group is weak, this means that
// all of the characters in this grounp are weak. We have to assign
// the scripts to these characters depending on the fonts which are
// set for these characters to display them.
xub_StrLen nEnd =
- (xub_StrLen)pBreakIt->xBreak->endOfScript( rTxt, nChg, WEAK );
+ (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( rTxt, nChg, WEAK );
if( nEnd > rTxt.Len() )
nEnd = rTxt.Len();
@@ -981,7 +981,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// Get next script type or set to weak in order to exit
BYTE nNextScript = ( nEnd < rTxt.Len() ) ?
- (BYTE)pBreakIt->xBreak->getScriptType( rTxt, nEnd ) :
+ (BYTE)pBreakIt->GetBreakIter()->getScriptType( rTxt, nEnd ) :
(BYTE)WEAK;
if ( nScript != nNextScript )
@@ -1003,7 +1003,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
ASSERT( STRING_LEN != nChg, "65K? Strange length of script section" );
xub_StrLen nSearchStt = nChg;
- nChg = (xub_StrLen)pBreakIt->xBreak->endOfScript( rTxt, nSearchStt, nScript );
+ nChg = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( rTxt, nSearchStt, nScript );
if ( nChg > rTxt.Len() )
nChg = rTxt.Len();
@@ -1011,16 +1011,16 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// --> FME 2008-09-17 #i28203#
// for 'complex' portions, we make sure that a portion does not contain more
// than one script:
- if( pBreakIt->xCTLDetect.is() && i18n::ScriptType::COMPLEX == nScript )
+ if( i18n::ScriptType::COMPLEX == nScript && pBreakIt->GetScriptTypeDetector().is() )
{
- const short nScriptType = pBreakIt->xCTLDetect->getCTLScriptType( rTxt, nSearchStt );
+ const short nScriptType = pBreakIt->GetScriptTypeDetector()->getCTLScriptType( rTxt, nSearchStt );
xub_StrLen nNextCTLScriptStart = nSearchStt;
short nCurrentScriptType = nScriptType;
while( com::sun::star::i18n::CTLScriptType::CTL_UNKNOWN == nCurrentScriptType || nScriptType == nCurrentScriptType )
{
- nNextCTLScriptStart = (xub_StrLen)pBreakIt->xCTLDetect->endOfCTLScriptType( rTxt, nNextCTLScriptStart );
+ nNextCTLScriptStart = (xub_StrLen)pBreakIt->GetScriptTypeDetector()->endOfCTLScriptType( rTxt, nNextCTLScriptStart );
if( nNextCTLScriptStart < rTxt.Len() && nNextCTLScriptStart < nChg )
- nCurrentScriptType = pBreakIt->xCTLDetect->getCTLScriptType( rTxt, nNextCTLScriptStart );
+ nCurrentScriptType = pBreakIt->GetScriptTypeDetector()->getCTLScriptType( rTxt, nNextCTLScriptStart );
else
break;
}
@@ -1031,7 +1031,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// special case for dotted circle since it can be used with complex
// before a mark, so we want it associated with the mark's script
if (nChg < rTxt.Len() && nChg > 0 && (i18n::ScriptType::WEAK ==
- pBreakIt->xBreak->getScriptType(rTxt,nChg - 1)))
+ pBreakIt->GetBreakIter()->getScriptType(rTxt,nChg - 1)))
{
int8_t nType = u_charType(rTxt.GetChar(nChg) );
if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK ||
@@ -1287,7 +1287,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
}
if ( nChg < rTxt.Len() )
- nScript = (BYTE)pBreakIt->xBreak->getScriptType( rTxt, nChg );
+ nScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( rTxt, nChg );
nLastCompression = nChg;
nLastKashida = nChg;
@@ -1566,7 +1566,7 @@ void SwScriptInfo::DeleteHiddenRanges( SwTxtNode& rNode )
nHiddenStart = *(rFirst++);
SwPaM aPam( rNode, nHiddenStart, rNode, nHiddenEnd );
- rNode.getIDocumentContentOperations()->Delete( aPam );
+ rNode.getIDocumentContentOperations()->DeleteRange( aPam );
}
}
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 0776feeeb21d..2124b4156d75 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -34,9 +34,7 @@
#include <hintids.hxx>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
#include <svx/twolinesitem.hxx>
#include <svx/charrotateitem.hxx>
#include <vcl/outdev.hxx>
@@ -194,13 +192,11 @@ SwRotatedPortion::SwRotatedPortion( const SwMultiCreator& rCreate,
if( !pRot )
{
const SwTxtAttr& rAttr = *rCreate.pAttr;
- if( RES_CHRATR_ROTATE == rAttr.Which() )
- pRot = &rAttr.GetCharRotate();
- else
+ const SfxPoolItem *const pItem =
+ CharFmt::GetItem(rAttr, RES_CHRATR_ROTATE);
+ if ( pItem )
{
- const SfxPoolItem* pItem = CharFmt::GetItem( rAttr, RES_CHRATR_ROTATE );
- if ( pItem )
- pRot = (SvxCharRotateItem*)pItem;
+ pRot = static_cast<const SvxCharRotateItem*>(pItem);
}
}
if( pRot )
@@ -319,13 +315,11 @@ SwDoubleLinePortion::SwDoubleLinePortion( const SwMultiCreator& rCreate,
const SwTxtAttr& rAttr = *rCreate.pAttr;
pBracket->nStart = *rAttr.GetStart();
- if( RES_CHRATR_TWO_LINES == rAttr.Which() )
- pTwo = &rAttr.Get2Lines();
- else
+ const SfxPoolItem * const pItem =
+ CharFmt::GetItem( rAttr, RES_CHRATR_TWO_LINES );
+ if ( pItem )
{
- const SfxPoolItem* pItem = CharFmt::GetItem( rAttr, RES_CHRATR_TWO_LINES );
- if ( pItem )
- pTwo = (SvxTwoLinesItem*)pItem;
+ pTwo = static_cast<const SvxTwoLinesItem*>(pItem);
}
}
if( pTwo )
@@ -916,7 +910,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
// for 99% of all cases
XubString aTxt = GetTxtFrm()->GetTxtNode()->GetExpandTxt( rPos, 1 );
- if ( pBreakIt->xBreak.is() && aTxt.Len() )
+ if ( pBreakIt->GetBreakIter().is() && aTxt.Len() )
{
sal_Bool bFldDir = ( i18n::ScriptType::COMPLEX ==
pBreakIt->GetRealScriptOfText( aTxt, 0 ) );
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 17b4e6a5ec41..eec34ffe5b66 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -97,8 +97,8 @@ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr,
// first we get the script type
if ( pSI )
nScript = pSI->ScriptType( nPos );
- else if ( pBreakIt->xBreak.is() )
- nScript = (BYTE)pBreakIt->xBreak->getScriptType( *pStr, nPos );
+ else if ( pBreakIt->GetBreakIter().is() )
+ nScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( *pStr, nPos );
// Note: rInf.GetIdx() can differ from nPos,
// e.g., when rPor is a field portion. nPos referes to the string passed
@@ -198,7 +198,7 @@ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr,
if ( pPor && pPor->IsKernPortion() )
pPor = pPor->GetPortion();
- if ( ! pBreakIt->xBreak.is() || ! pPor || pPor->InFixMargGrp() )
+ if ( ! pBreakIt->GetBreakIter().is() || ! pPor || pPor->InFixMargGrp() )
return nCnt;
// next character is inside a field?
@@ -211,10 +211,10 @@ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr,
pPor->GetExpTxt( rInf, aStr );
((SwTxtSizeInfo &)rInf).SetOnWin( bOldOnWin );
- nNextScript = (BYTE)pBreakIt->xBreak->getScriptType( aStr, 0 );
+ nNextScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( aStr, 0 );
}
else
- nNextScript = (BYTE)pBreakIt->xBreak->getScriptType( rInf.GetTxt(), nPos );
+ nNextScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( rInf.GetTxt(), nPos );
if( ASIAN == nNextScript )
{
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 3962598c9f1c..3ecc266865ed 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -110,7 +110,7 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
if ( pScriptInfo->GetInvalidity() != STRING_LEN )
pScriptInfo->InitScriptInfo( rTxtNode, bRTL );
- if ( pBreakIt->xBreak.is() )
+ if ( pBreakIt->GetBreakIter().is() )
{
pFnt->SetActual( SwScriptInfo::WhichFont( 0, 0, pScriptInfo ) );
@@ -263,7 +263,8 @@ short SwRedlineItr::_Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld )
pSet->ClearItem();
else
{
- SwAttrPool& rPool = (SwAttrPool& )rDoc.GetAttrPool();
+ SwAttrPool& rPool =
+ const_cast<SwDoc&>(rDoc).GetAttrPool();
pSet = new SfxItemSet(rPool, RES_CHRATR_BEGIN, RES_CHRATR_END-1);
}
@@ -279,7 +280,9 @@ short SwRedlineItr::_Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld )
if( ( nWhich < RES_CHRATR_END ) &&
( SFX_ITEM_SET == pSet->GetItemState( nWhich, sal_True, &pItem ) ) )
{
- SwTxtAttr* pAttr = ((SwTxtNode&)rNd).MakeRedlineTxtAttr( *pItem );
+ SwTxtAttr* pAttr = MakeRedlineTxtAttr(
+ const_cast<SwDoc&>(rDoc),
+ *const_cast<SfxPoolItem*>(pItem) );
pAttr->SetPriorityAttr( sal_True );
aHints.C40_INSERT( SwTxtAttr, pAttr, aHints.Count());
rAttrHandler.PushAndChg( *pAttr, rFnt );
@@ -352,7 +355,7 @@ void SwRedlineItr::_Clear( SwFont* pFnt )
rAttrHandler.PopAndChg( *pPos, *pFnt );
else
rAttrHandler.Pop( *pPos );
- delete pPos;
+ SwTxtAttr::Destroy(pPos, const_cast<SwDoc&>(rDoc).GetAttrPool() );
}
if( pFnt )
pFnt->SetNoCol( sal_False );
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index c6b100f1b746..f77a252a1e72 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -152,19 +152,7 @@ SwDropPortion::~SwDropPortion()
sal_Bool SwTxtSizeInfo::_HasHint( const SwTxtNode* pTxtNode, xub_StrLen nPos )
{
- const SwpHints *pHints = pTxtNode->GetpSwpHints();
- if( !pHints )
- return sal_False;
- for ( USHORT i = 0; i < pHints->Count(); ++i )
- {
- const SwTxtAttr *pPos = (*pHints)[i];
- xub_StrLen nStart = *pPos->GetStart();
- if( nPos < nStart )
- return sal_False;
- if( nPos == nStart && !pPos->GetEnd() )
- return sal_True;
- }
- return sal_False;
+ return 0 != pTxtNode->GetTxtAttrForCharAt(nPos);
}
/*************************************************************************
@@ -179,7 +167,7 @@ MSHORT SwTxtNode::GetDropLen( MSHORT nWishLen ) const
if( nWishLen && nWishLen < nEnd )
nEnd = nWishLen;
- if ( ! nWishLen && pBreakIt->xBreak.is() )
+ if ( ! nWishLen && pBreakIt->GetBreakIter().is() )
{
// find first word
const SwAttrSet& rAttrSet = GetSwAttrSet();
@@ -201,7 +189,7 @@ MSHORT SwTxtNode::GetDropLen( MSHORT nWishLen ) const
}
Boundary aBound =
- pBreakIt->xBreak->getWordBoundary( GetTxt(), 0,
+ pBreakIt->GetBreakIter()->getWordBoundary( GetTxt(), 0,
pBreakIt->GetLocale( eLanguage ), WordType::DICTIONARY_WORD, sal_True );
nEnd = (xub_StrLen)aBound.endPos;
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 0e50f7d269e4..cc549ae4ef00 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -63,6 +63,7 @@
#include "docufld.hxx"
#include "pagedesc.hxx" // NewFldPortion, GetNum()
#include <pormulti.hxx> // SwMultiPortion
+#include "fmtmeta.hxx" // lcl_NewMetaPortion
/*************************************************************************
@@ -257,12 +258,65 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
return pRet;
}
+/*************************************************************************
+ * SwTxtFormatter::TryNewNoLengthPortion()
+ *************************************************************************/
+
+SwFldPortion * lcl_NewMetaPortion(SwTxtAttr & rHint, const bool bPrefix)
+{
+ ::sw::Meta *const pMeta(
+ static_cast<SwFmtMeta &>(rHint.GetAttr()).GetMeta() );
+ ::rtl::OUString fix;
+ ::sw::MetaField *const pField( dynamic_cast< ::sw::MetaField * >(pMeta) );
+ OSL_ENSURE(pField, "lcl_NewMetaPortion: no meta field?");
+ if (pField)
+ {
+ pField->GetPrefixAndSuffix((bPrefix) ? &fix : 0, (bPrefix) ? 0 : &fix);
+ }
+ return new SwFldPortion( fix );
+}
+
+/** Try to create a new portion with zero length, for an end of a hint
+ (where there is no CH_TXTATR). Because there may be multiple hint ends at a
+ given index, m_nHintEndIndex is used to keep track of the already created
+ portions. But the portions created here may actually be deleted again,
+ due to UnderFlow. In that case, m_nHintEndIndex must be decremented,
+ so the portion will be created again on the next line.
+ */
+SwExpandPortion *
+SwTxtFormatter::TryNewNoLengthPortion(SwTxtFormatInfo & rInfo)
+{
+ if (pHints)
+ {
+ const xub_StrLen nIdx(rInfo.GetIdx());
+ while (m_nHintEndIndex < pHints->GetEndCount())
+ {
+ SwTxtAttr & rHint( *pHints->GetEnd(m_nHintEndIndex) );
+ xub_StrLen const nEnd( *rHint.GetAnyEnd() );
+ if (nEnd > nIdx)
+ {
+ break;
+ }
+ ++m_nHintEndIndex;
+ if (nEnd == nIdx)
+ {
+ if (RES_TXTATR_METAFIELD == rHint.Which())
+ {
+ SwFldPortion *const pPortion(
+ lcl_NewMetaPortion(rHint, false));
+ pPortion->SetNoLength(); // no CH_TXTATR at hint end!
+ return pPortion;
+ }
+ }
+ }
+ }
+ return 0;
+}
/*************************************************************************
* SwTxtFormatter::NewExtraPortion()
*************************************************************************/
-
SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
{
SwTxtAttr *pHint = GetAttr( rInf.GetIdx() );
@@ -290,16 +344,6 @@ SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
pRet = NewFtnPortion( rInf, pHint );
break;
}
- case RES_TXTATR_SOFTHYPH :
- {
- pRet = new SwSoftHyphPortion;
- break;
- }
- case RES_TXTATR_HARDBLANK :
- {
- pRet = new SwBlankPortion( ((SwTxtHardBlank*)pHint)->GetChar() );
- break;
- }
case RES_TXTATR_FIELD :
{
pRet = NewFldPortion( rInf, pHint );
@@ -315,6 +359,11 @@ SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
pRet = new SwIsoToxPortion;
break;
}
+ case RES_TXTATR_METAFIELD:
+ {
+ pRet = lcl_NewMetaPortion( *pHint, true );
+ break;
+ }
default: ;
}
if( !pRet )
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index f447e380aff9..14944264d39e 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -500,26 +500,10 @@ bool lcl_HideObj( const SwTxtFrm& _rFrm,
_rFrm.GetTxtNode()->GetTxt().GetChar( _nObjAnchorPos );
if ( cAnchorChar == CH_TXTATR_BREAKWORD )
{
- SwpHints* pHints =
- const_cast<SwTxtFrm&>(_rFrm).GetTxtNode()->GetpSwpHints();
- const SwTxtAttr* pHint( 0 );
- if( pHints )
- {
- for ( USHORT i = 0; i < pHints->Count(); ++i )
- {
- SwTxtAttr* pPos = pHints->GetTextHint(i);
- xub_StrLen nStart = *pPos->GetStart();
- if ( _nObjAnchorPos < nStart )
- break;
- if ( _nObjAnchorPos == nStart && !pPos->GetEnd() )
- {
- pHint = pPos;
- break;
- }
- }
- }
- if ( pHint &&
- pHint->Which() == RES_TXTATR_FLYCNT )
+ const SwTxtAttr* const pHint(
+ _rFrm.GetTxtNode()->GetTxtAttrForCharAt(_nObjAnchorPos,
+ RES_TXTATR_FLYCNT) );
+ if ( pHint )
{
const SwFrmFmt* pFrmFmt =
static_cast<const SwTxtFlyCnt*>(pHint)->GetFlyCnt().GetFrmFmt();
diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index d00c29865b0b..81a5c98e1913 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -89,7 +89,7 @@ sal_Bool SwTxtFrm::Hyphenate( SwInterHyphInfo &rHyphInf )
{
ASSERT( ! IsVertical() || ! IsSwapped(),"swapped frame at SwTxtFrm::Hyphenate" );
- if( !pBreakIt->xBreak.is() )
+ if( !pBreakIt->GetBreakIter().is() )
return sal_False;;
// Wir machen den Laden erstmal dicht:
ASSERT( !IsLocked(), "SwTxtFrm::Hyphenate: this is locked" );
@@ -254,7 +254,7 @@ sal_Bool SwTxtFormatter::Hyphenate( SwInterHyphInfo &rHyphInf )
Reference< XHyphenatedWord > xHyphWord;
Boundary aBound =
- pBreakIt->xBreak->getWordBoundary( rInf.GetTxt(), nWrdStart,
+ pBreakIt->GetBreakIter()->getWordBoundary( rInf.GetTxt(), nWrdStart,
pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ), WordType::DICTIONARY_WORD, sal_True );
nWrdStart = static_cast<xub_StrLen>(aBound.startPos);
nLen = static_cast<xub_StrLen>(aBound.endPos - nWrdStart);
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 0a06f88bc371..b51ffb862f3c 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -223,7 +223,7 @@ void SwTOXSortTabBase::FillText( SwTxtNode& rNd, const SwIndex& rInsPos,
GetTxt( sMyTxt, sMyTxtReading );
- rNd.Insert( sMyTxt, rInsPos );
+ rNd.InsertText( sMyTxt, rInsPos );
}
BOOL SwTOXSortTabBase::operator==( const SwTOXSortTabBase& rCmp )
@@ -459,7 +459,7 @@ void SwTOXIndex::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT ) cons
else
GetTxt( sTmp, sTmpReading );
- rNd.Insert( sTmp, rInsPos );
+ rNd.InsertText( sTmp, rInsPos );
}
@@ -582,7 +582,7 @@ void SwTOXContent::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT ) co
{
String sTmp, sTmpReading;
GetTxt( sTmp, sTmpReading );
- rNd.Insert( sTmp, rInsPos );
+ rNd.InsertText( sTmp, rInsPos );
}
}
@@ -684,7 +684,7 @@ void SwTOXPara::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT ) const
String sTmp, sTmpReading;
GetTxt( sTmp, sTmpReading );
sTmp.SearchAndReplaceAll('\t', ' ');
- rNd.Insert( sTmp, rInsPos );
+ rNd.InsertText( sTmp, rInsPos );
}
}
@@ -904,7 +904,7 @@ void SwTOXAuthority::FillText( SwTxtNode& rNd,
}
else
sText = (pField->GetFieldText((ToxAuthorityField) nAuthField));
- rNd.Insert( sText, rInsPos );
+ rNd.InsertText( sText, rInsPos );
}
/* -----------------14.10.99 09:35-------------------
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 2bf117afb251..9c54bc60e239 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -166,6 +166,8 @@ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
{
switch( pNew->Which() )
{
+ case RES_OBJECTDYING:
+ return; // don't do anything, especially not expand!
case RES_TXTATR_FLDCHG:
// "Farbe hat sich geaendert !"
// this, this fuer "nur Painten"
@@ -261,6 +263,7 @@ SwTxtFld::SwTxtFld( SwFmtFld& rAttr, xub_StrLen nStartPos )
, m_pTxtNode( 0 )
{
rAttr.pTxtAttr = this;
+ SetHasDummyChar(true);
}
SwTxtFld::~SwTxtFld( )
diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx
index d738497507a8..fa0a734f79c1 100644
--- a/sw/source/core/txtnode/atrflyin.cxx
+++ b/sw/source/core/txtnode/atrflyin.cxx
@@ -74,6 +74,7 @@ SwTxtFlyCnt::SwTxtFlyCnt( SwFmtFlyCnt& rAttr, xub_StrLen nStartPos )
: SwTxtAttr( rAttr, nStartPos )
{
rAttr.pTxtAttr = this;
+ SetHasDummyChar(true);
}
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index 4b51e94e3404..fd35ccd1477c 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -182,6 +182,7 @@ SwTxtFtn::SwTxtFtn( SwFmtFtn& rAttr, xub_StrLen nStartPos )
, m_nSeqNo( USHRT_MAX )
{
rAttr.pTxtAttr = this;
+ SetHasDummyChar(true);
}
@@ -291,7 +292,7 @@ void SwTxtFtn::SetNumber( const USHORT nNewNum, const XubString* pStr )
}
// Die Fussnoten duplizieren
-void SwTxtFtn::CopyFtn( SwTxtFtn *pDest )
+void SwTxtFtn::CopyFtn( SwTxtFtn *pDest ) const
{
if ( m_pStartNode && pDest->GetStartNode() )
{
diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx
index ea427f8e8877..d545a22d720e 100644
--- a/sw/source/core/txtnode/atrref.cxx
+++ b/sw/source/core/txtnode/atrref.cxx
@@ -91,7 +91,10 @@ SwTxtRefMark::SwTxtRefMark( SwFmtRefMark& rAttr,
m_nEnd = *pEnd;
m_pEnd = & m_nEnd;
}
- SetDontMergeAttr( true );
+ else
+ {
+ SetHasDummyChar(true);
+ }
SetDontMoveAttr( true );
SetOverlapAllowedAttr( true );
}
diff --git a/sw/source/core/txtnode/atrtox.cxx b/sw/source/core/txtnode/atrtox.cxx
index 5cc9388dcbcd..32ef6dc378eb 100644
--- a/sw/source/core/txtnode/atrtox.cxx
+++ b/sw/source/core/txtnode/atrtox.cxx
@@ -50,7 +50,10 @@ SwTxtTOXMark::SwTxtTOXMark( SwTOXMark& rAttr,
m_nEnd = *pEnd;
m_pEnd = & m_nEnd;
}
- SetDontMergeAttr( true );
+ else
+ {
+ SetHasDummyChar(true);
+ }
SetDontMoveAttr( true );
SetOverlapAllowedAttr( true );
}
diff --git a/sw/source/core/txtnode/fmtatr1.cxx b/sw/source/core/txtnode/fmtatr1.cxx
deleted file mode 100644
index bcbe7a2df680..000000000000
--- a/sw/source/core/txtnode/fmtatr1.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: fmtatr1.cxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sw.hxx"
-
-
-
-#include <hintids.hxx>
-#include <errhdl.hxx>
-#include <fmthbsh.hxx>
-
-
-/*************************************************************************
-|*
-|* class SwFmtHardBlank
-|*
-|* Beschreibung Dokument 1.20
-|* Ersterstellung JP 23.11.90
-|* Letzte Aenderung JP 20.02.91
-|*
-*************************************************************************/
-
-SwFmtHardBlank::SwFmtHardBlank( sal_Unicode cCh, BOOL )
- : SfxPoolItem( RES_TXTATR_HARDBLANK ),
- cChar( cCh )
-{
-// ASSERT( !bCheck || (' ' != cCh && '-' != cCh),
-// "Invalid character for the HardBlank attribute - "
-// "must be a normal unicode character" );
-}
-
-int SwFmtHardBlank::operator==( const SfxPoolItem& rAttr ) const
-{
- ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
- return cChar == ((SwFmtHardBlank&)rAttr).GetChar();
-}
-
-SfxPoolItem* SwFmtHardBlank::Clone( SfxItemPool* ) const
-{
- return new SwFmtHardBlank( *this );
-}
-
-/*************************************************************************
-|*
-|* class SwFmtSoftHyph
-|*
-|* Beschreibung Dokument 1.20
-|* Ersterstellung JP 23.11.90
-|* Letzte Aenderung JP 20.02.91
-|*
-*************************************************************************/
-
-SwFmtSoftHyph::SwFmtSoftHyph()
- : SfxPoolItem( RES_TXTATR_SOFTHYPH )
-{
-}
-
-int SwFmtSoftHyph::operator==( const SfxPoolItem& ) const
-{
-// ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
- return TRUE;
-}
-
-SfxPoolItem* SwFmtSoftHyph::Clone( SfxItemPool* ) const
-{
- return new SwFmtSoftHyph( *this );
-}
-
-
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 19b827d0b9f9..8093a84dbbd9 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -31,14 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
-
#include "hintids.hxx"
#include "unomid.h"
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
#include <svtools/macitem.hxx>
#include <svtools/stritem.hxx>
#include <svtools/stylepool.hxx>
@@ -51,16 +47,24 @@
#include <hints.hxx> // SwUpdateAttr
#include <unostyle.hxx>
#include <unoevent.hxx> // SwHyperlinkEventDescriptor
-#ifndef _COM_SUN_STAR_TEXT_RUBYADJUST_HDL_
#include <com/sun/star/text/RubyAdjust.hdl>
-#endif
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
#include <com/sun/star/uno/Any.h>
#include <SwStyleNameMapper.hxx>
+#include <fmtmeta.hxx>
+#include <ndtxt.hxx> // for meta
+#include <doc.hxx> // for meta
+#include <unometa.hxx>
+#include <unoobj.hxx> // SwXTextRange
+#include <docsh.hxx>
+#include <svtools/zforlist.hxx> // GetNumberFormat
+
+#include <boost/bind.hpp>
+#include <algorithm>
+
+
using namespace ::com::sun::star;
using ::rtl::OUString;
@@ -578,3 +582,328 @@ BOOL SwFmtRuby::PutValue( const uno::Any& rVal,
return bRet;
}
+
+/*************************************************************************
+ class SwFmtMeta
+ ************************************************************************/
+
+SwFmtMeta * SwFmtMeta::CreatePoolDefault(const USHORT i_nWhich)
+{
+ return new SwFmtMeta(i_nWhich);
+}
+
+SwFmtMeta::SwFmtMeta(const USHORT i_nWhich)
+ : SfxPoolItem( i_nWhich )
+ , m_pMeta()
+ , m_pTxtAttr( 0 )
+{
+ ASSERT((RES_TXTATR_META == i_nWhich) || (RES_TXTATR_METAFIELD == i_nWhich),
+ "ERROR: SwFmtMeta: invalid which id!");
+}
+
+SwFmtMeta::SwFmtMeta( ::boost::shared_ptr< ::sw::Meta > const & i_pMeta,
+ const USHORT i_nWhich )
+ : SfxPoolItem( i_nWhich )
+ , m_pMeta( i_pMeta )
+ , m_pTxtAttr( 0 )
+{
+ ASSERT((RES_TXTATR_META == i_nWhich) || (RES_TXTATR_METAFIELD == i_nWhich),
+ "ERROR: SwFmtMeta: invalid which id!");
+ ASSERT(m_pMeta, "SwFmtMeta: no Meta ?");
+ // DO NOT call m_pMeta->SetFmtMeta(this) here; only from SetTxtAttr!
+}
+
+SwFmtMeta::~SwFmtMeta()
+{
+ if (m_pMeta && (m_pMeta->GetFmtMeta() == this))
+ {
+ m_pMeta->SetFmtMeta(0);
+ }
+}
+
+int SwFmtMeta::operator==( const SfxPoolItem & i_rOther ) const
+{
+ ASSERT( SfxPoolItem::operator==( i_rOther ), "i just copied this assert" );
+ return SfxPoolItem::operator==( i_rOther )
+ && (m_pMeta == static_cast<SwFmtMeta const &>( i_rOther ).m_pMeta);
+}
+
+SfxPoolItem * SwFmtMeta::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ // if this is indeed a copy, then DoCopy must be called later!
+ return (m_pMeta) // #i105148# pool default may be cloned also!
+ ? new SwFmtMeta( m_pMeta, Which() ) : new SwFmtMeta( Which() );
+}
+
+void SwFmtMeta::SetTxtAttr(SwTxtMeta * const i_pTxtAttr)
+{
+ ASSERT(!(m_pTxtAttr && i_pTxtAttr),
+ "SwFmtMeta::SetTxtAttr: already has text attribute?");
+ ASSERT( m_pTxtAttr || i_pTxtAttr ,
+ "SwFmtMeta::SetTxtAttr: no attribute to remove?");
+ m_pTxtAttr = i_pTxtAttr;
+ ASSERT(m_pMeta, "inserted SwFmtMeta has no sw::Meta?");
+ // the sw::Meta must be able to find the current text attribute!
+ if (i_pTxtAttr && m_pMeta)
+ {
+ m_pMeta->SetFmtMeta(this);
+ }
+}
+
+void SwFmtMeta::NotifyRemoval()
+{
+ // N.B.: do not reset m_pTxtAttr here: see call in nodes.cxx,
+ // where the hint is not deleted!
+ ASSERT(m_pMeta, "NotifyRemoval: no meta ?");
+ if (m_pMeta)
+ {
+ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
+ &static_cast<SwModify&>(*m_pMeta) ); // cast to proper base class!
+ m_pMeta->Modify(&aMsgHint, &aMsgHint);
+ }
+}
+
+void SwFmtMeta::DoCopy(SwFmtMeta & rOriginalMeta)
+{
+ ASSERT(m_pMeta, "DoCopy called for SwFmtMeta with no sw::Meta?");
+ if (m_pMeta)
+ {
+ const ::boost::shared_ptr< ::sw::Meta> pOriginal( m_pMeta );
+ // UGLY: original sw::Meta now points at _this_ due to being already
+ // inserted via MakeTxtAttr! so fix it up to point at the original item
+ // (maybe would be better to tell MakeTxtAttr that it creates a copy?)
+ pOriginal->SetFmtMeta(&rOriginalMeta);
+ if (RES_TXTATR_META == Which())
+ {
+ m_pMeta.reset( new ::sw::Meta(this) );
+ }
+ else
+ {
+ ::sw::MetaField *const pMetaField(
+ static_cast< ::sw::MetaField* >(pOriginal.get()));
+ SwDoc * const pTargetDoc( GetTxtAttr()->GetTxtNode()->GetDoc() );
+ m_pMeta = pTargetDoc->GetMetaFieldManager().makeMetaField( this,
+ pMetaField->m_nNumberFormat, pMetaField->IsFixedLanguage() );
+ }
+ m_pMeta->RegisterAsCopyOf(*pOriginal);
+ }
+}
+
+
+namespace sw {
+
+/*************************************************************************
+ class sw::Meta
+ ************************************************************************/
+
+Meta::Meta(SwFmtMeta * const i_pFmt)
+ : ::sfx2::Metadatable()
+ , SwModify()
+ , m_pFmt( i_pFmt )
+{
+}
+
+Meta::~Meta()
+{
+}
+
+SwTxtMeta * Meta::GetTxtAttr() const
+{
+ return (m_pFmt) ? m_pFmt->GetTxtAttr() : 0;
+}
+
+SwTxtNode * Meta::GetTxtNode() const
+{
+ SwTxtMeta * const pTxtAttr( GetTxtAttr() );
+ return (pTxtAttr) ? pTxtAttr->GetTxtNode() : 0;
+}
+
+// SwClient
+void Meta::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+{
+ SwTxtNode * const pTxtNode( GetTxtNode() );
+ if (pTxtNode && (GetRegisteredIn() != pTxtNode))
+ {
+ pTxtNode->Add(this);
+ }
+ SwModify::Modify(pOld, pNew);
+}
+
+// sw::Metadatable
+::sfx2::IXmlIdRegistry& Meta::GetRegistry()
+{
+ SwTxtNode * const pTxtNode( GetTxtNode() );
+ // GetRegistry may only be called on a meta that is actually in the
+ // document, which means it has a pointer to its text node
+ OSL_ENSURE(pTxtNode, "ERROR: GetRegistry: no text node?");
+ if (!pTxtNode)
+ throw uno::RuntimeException();
+ return pTxtNode->GetRegistry();
+}
+
+bool Meta::IsInClipboard() const
+{
+ const SwTxtNode * const pTxtNode( GetTxtNode() );
+// no text node: in UNDO OSL_ENSURE(pTxtNode, "IsInClipboard: no text node?");
+ return (pTxtNode) ? pTxtNode->IsInClipboard() : false;
+}
+
+bool Meta::IsInUndo() const
+{
+ const SwTxtNode * const pTxtNode( GetTxtNode() );
+// no text node: in UNDO OSL_ENSURE(pTxtNode, "IsInUndo: no text node?");
+ return (pTxtNode) ? pTxtNode->IsInUndo() : true;
+}
+
+bool Meta::IsInContent() const
+{
+ const SwTxtNode * const pTxtNode( GetTxtNode() );
+ OSL_ENSURE(pTxtNode, "IsInContent: no text node?");
+ return (pTxtNode) ? pTxtNode->IsInContent() : true;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable >
+Meta::MakeUnoObject()
+{
+ // re-use existing SwXMeta
+ SwClientIter iter( *this );
+ SwClient * pClient( iter.First( TYPE( SwXMeta ) ) );
+ while (pClient) {
+ SwXMeta *const pMeta( dynamic_cast<SwXMeta*>(pClient) );
+ if (pMeta && pMeta->GetCoreObject() == this) {
+ return pMeta;
+ }
+ pClient = iter.Next();
+ }
+
+ // create new SwXMeta
+ SwTxtMeta * const pTxtAttr( GetTxtAttr() );
+ OSL_ENSURE(pTxtAttr, "MakeUnoObject: no text attr?");
+ if (!pTxtAttr) return 0;
+ SwTxtNode * const pTxtNode( pTxtAttr->GetTxtNode() );
+ OSL_ENSURE(pTxtNode, "MakeUnoObject: no text node?");
+ if (!pTxtNode) return 0;
+ const SwPosition aPos(*pTxtNode, *pTxtAttr->GetStart());
+ const uno::Reference<text::XText> xParentText(
+ SwXTextRange::CreateParentXText(pTxtNode->GetDoc(), aPos) );
+ if (!xParentText.is()) return 0;
+ return (RES_TXTATR_META == m_pFmt->Which())
+ ? new SwXMeta (pTxtNode->GetDoc(), xParentText, 0, pTxtAttr)
+ : new SwXMetaField(pTxtNode->GetDoc(), xParentText, 0, pTxtAttr);
+}
+
+/*************************************************************************
+ class sw::MetaField
+ ************************************************************************/
+
+MetaField::MetaField(SwFmtMeta * const i_pFmt,
+ const sal_uInt32 nNumberFormat, const bool bIsFixedLanguage)
+ : Meta(i_pFmt)
+ , m_nNumberFormat( nNumberFormat )
+ , m_bIsFixedLanguage( bIsFixedLanguage )
+{
+}
+
+void MetaField::GetPrefixAndSuffix(
+ ::rtl::OUString *const o_pPrefix, ::rtl::OUString *const o_pSuffix)
+{
+ try
+ {
+ const uno::Reference<rdf::XMetadatable> xMetaField( MakeUnoObject() );
+ OSL_ENSURE(dynamic_cast<SwXMetaField*>(xMetaField.get()),
+ "GetPrefixAndSuffix: no SwXMetaField?");
+ if (xMetaField.is())
+ {
+ SwTxtNode * const pTxtNode( GetTxtNode() );
+ SwDocShell const * const pShell(pTxtNode->GetDoc()->GetDocShell());
+ const uno::Reference<frame::XModel> xModel(
+ (pShell) ? pShell->GetModel() : 0, uno::UNO_SET_THROW);
+ getPrefixAndSuffix(xModel, xMetaField, o_pPrefix, o_pSuffix);
+ }
+ } catch (uno::Exception) {
+ OSL_ENSURE(false, "exception?");
+ }
+}
+
+sal_uInt32 MetaField::GetNumberFormat(::rtl::OUString const & rContent) const
+{
+ //TODO: this probably lacks treatment for some special cases
+ sal_uInt32 nNumberFormat( m_nNumberFormat );
+ SwTxtNode * const pTxtNode( GetTxtNode() );
+ if (pTxtNode)
+ {
+ SvNumberFormatter *const pNumberFormatter(
+ pTxtNode->GetDoc()->GetNumberFormatter() );
+ double number;
+ (void) pNumberFormatter->IsNumberFormat(
+ rContent, nNumberFormat, number );
+ }
+ return nNumberFormat;
+}
+
+void MetaField::SetNumberFormat(sal_uInt32 nNumberFormat)
+{
+ // effectively, the member is only a default:
+ // GetNumberFormat checks if the text actually conforms
+ m_nNumberFormat = nNumberFormat;
+}
+
+
+/*************************************************************************
+ class sw::MetaFieldManager
+ ************************************************************************/
+
+
+MetaFieldManager::MetaFieldManager()
+{
+}
+
+::boost::shared_ptr<MetaField>
+MetaFieldManager::makeMetaField(SwFmtMeta * const i_pFmt,
+ const sal_uInt32 nNumberFormat, const bool bIsFixedLanguage)
+{
+ const ::boost::shared_ptr<MetaField> pMetaField(
+ new MetaField(i_pFmt, nNumberFormat, bIsFixedLanguage) );
+ m_MetaFields.push_back(pMetaField);
+ return pMetaField;
+}
+
+struct IsInUndo
+{
+ bool operator()(::boost::weak_ptr<MetaField> const & pMetaField) {
+ return pMetaField.lock()->IsInUndo();
+ }
+};
+
+struct MakeUnoObject
+{
+ uno::Reference<text::XTextField>
+ operator()(::boost::weak_ptr<MetaField> const & pMetaField) {
+ return uno::Reference<text::XTextField>(
+ pMetaField.lock()->MakeUnoObject(), uno::UNO_QUERY);
+ }
+};
+
+::std::vector< uno::Reference<text::XTextField> >
+MetaFieldManager::getMetaFields()
+{
+ // erase deleted fields
+ const MetaFieldList_t::iterator iter(
+ ::std::remove_if(m_MetaFields.begin(), m_MetaFields.end(),
+ ::boost::bind(&::boost::weak_ptr<MetaField>::expired, _1)));
+ m_MetaFields.erase(iter, m_MetaFields.end());
+ // filter out fields in UNDO
+ MetaFieldList_t filtered(m_MetaFields.size());
+ const MetaFieldList_t::iterator iter2(
+ ::std::remove_copy_if(m_MetaFields.begin(), m_MetaFields.end(),
+ filtered.begin(), IsInUndo()));
+ filtered.erase(iter2, filtered.end());
+ // create uno objects
+ ::std::vector< uno::Reference<text::XTextField> > ret(filtered.size());
+ ::std::transform(filtered.begin(), filtered.end(), ret.begin(),
+ MakeUnoObject());
+ return ret;
+}
+
+} // namespace sw
+
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 3f8c9914c10f..9952c50e678d 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2425,7 +2425,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
// skip character cells for complex scripts
if ( rInf.GetFont() && SW_CTL == rInf.GetFont()->GetActual() &&
- pBreakIt->xBreak.is() )
+ pBreakIt->GetBreakIter().is() )
{
aLang = rInf.GetFont()->GetLanguage();
bSkipCell = sal_True;
@@ -2441,7 +2441,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
if ( bSkipCell )
{
- nIdx = (xub_StrLen)pBreakIt->xBreak->nextCharacters( rInf.GetText(),
+ nIdx = (xub_StrLen)pBreakIt->GetBreakIter()->nextCharacters( rInf.GetText(),
nIdx, pBreakIt->GetLocale( aLang ), nItrMode, 1, nDone );
if ( nIdx <= nLastIdx )
break;
@@ -2704,13 +2704,13 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
const XubString aSnippet( rInf.GetText(), rInf.GetIdx(), nLn );
aTmpText = aSub[nActual].CalcCaseMap( aSnippet );
const bool bTitle = SVX_CASEMAP_TITEL == aSub[nActual].GetCaseMap() &&
- pBreakIt->xBreak.is();
+ pBreakIt->GetBreakIter().is();
// Uaaaaahhhh!!! In title case mode, we would get wrong results
if ( bTitle && nLn )
{
// check if rInf.GetIdx() is begin of word
- if ( !pBreakIt->xBreak->isBeginWord(
+ if ( !pBreakIt->GetBreakIter()->isBeginWord(
rInf.GetText(), rInf.GetIdx(),
pBreakIt->GetLocale( aSub[nActual].GetLanguage() ),
i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index d9bd1bb44b03..160758d861b2 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -102,13 +102,13 @@ xub_StrLen lcl_CalcCaseMap( const SwFont& rFnt,
// special case for title case:
const bool bTitle = SVX_CASEMAP_TITEL == rFnt.GetCaseMap() &&
- pBreakIt->xBreak.is();
+ pBreakIt->GetBreakIter().is();
for ( xub_StrLen i = nOfst; i < nEnd; ++i )
{
XubString aTmp( rOrigString, i, 1 );
if ( !bTitle ||
- pBreakIt->xBreak->isBeginWord(
+ pBreakIt->GetBreakIter()->isBeginWord(
rOrigString, i,
pBreakIt->GetLocale( rFnt.GetLanguage() ),
WordType::ANYWORD_IGNOREWHITESPACES ) )
@@ -654,7 +654,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
if( nPos < nMaxPos )
{
- nPos = (xub_StrLen)pBreakIt->xBreak->endOfCharBlock( rOldText, nPos,
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfCharBlock( rOldText, nPos,
pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
if( nPos == STRING_LEN )
nPos = nOldPos;
@@ -702,7 +702,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
rDo.Do();
nOldPos = nPos;
}
- nPos = (xub_StrLen)pBreakIt->xBreak->nextCharBlock( rOldText, nPos,
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->nextCharBlock( rOldText, nPos,
pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
if( nPos == STRING_LEN || nPos > nMaxPos )
nPos = nMaxPos;
@@ -816,7 +816,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
}
} while( nOldPos != nPos );
}
- nPos = (xub_StrLen)pBreakIt->xBreak->endOfCharBlock( rOldText, nPos,
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfCharBlock( rOldText, nPos,
pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
if( nPos == STRING_LEN || nPos > nMaxPos )
nPos = nMaxPos;
diff --git a/sw/source/core/txtnode/makefile.mk b/sw/source/core/txtnode/makefile.mk
index f4fbf70014c8..36c6e09d6b7c 100644
--- a/sw/source/core/txtnode/makefile.mk
+++ b/sw/source/core/txtnode/makefile.mk
@@ -53,7 +53,6 @@ SLOFILES = \
$(SLO)$/atrref.obj \
$(SLO)$/atrtox.obj \
$(SLO)$/chrfmt.obj \
- $(SLO)$/fmtatr1.obj \
$(SLO)$/fmtatr2.obj \
$(SLO)$/fntcap.obj \
$(SLO)$/fntcache.obj \
@@ -71,6 +70,7 @@ SLOFILES = \
EXCEPTIONSFILES = \
+ $(SLO)$/fmtatr2.obj \
$(SLO)$/atrtox.obj \
$(SLO)$/atrflyin.obj \
$(SLO)$/docnew.obj \
@@ -78,7 +78,7 @@ EXCEPTIONSFILES = \
$(SLO)$/ndtxt.obj \
$(SLO)$/thints.obj \
$(SLO)$/txtedt.obj
-
+
.IF "$(dbutil)" != ""
OFILES+=$(SLO)$/dbchratr.$(QBJX)
diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index 64ca41cf8516..54be1b261655 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -37,6 +37,11 @@
#include "ndhints.hxx"
#include <txtatr.hxx>
+#ifndef PRODUCT
+#include <pam.hxx>
+#endif
+
+
_SV_IMPL_SORTAR_ALG( SwpHtStart, SwTxtAttr* )
_SV_IMPL_SORTAR_ALG( SwpHtEnd, SwTxtAttr* )
@@ -99,15 +104,15 @@ static BOOL lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
{
if ( *rHt1.GetStart() == *rHt2.GetStart() )
{
- xub_StrLen nHt1 = *rHt1.GetAnyEnd();
- xub_StrLen nHt2 = *rHt2.GetAnyEnd();
+ const xub_StrLen nHt1 = *rHt1.GetAnyEnd();
+ const xub_StrLen nHt2 = *rHt2.GetAnyEnd();
if ( nHt1 == nHt2 )
{
- nHt1 = rHt1.Which();
- nHt2 = rHt2.Which();
- if ( nHt1 == nHt2 )
+ const USHORT nWhich1 = rHt1.Which();
+ const USHORT nWhich2 = rHt2.Which();
+ if ( nWhich1 == nWhich2 )
{
- if ( RES_TXTATR_CHARFMT == nHt1 )
+ if ( RES_TXTATR_CHARFMT == nWhich1 )
{
const USHORT nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber();
const USHORT nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber();
@@ -118,6 +123,8 @@ static BOOL lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
return (long)&rHt1 < (long)&rHt2;
}
+ // order is important! for requirements see hintids.hxx
+ return ( nWhich1 > nWhich2 );
}
return ( nHt1 > nHt2 );
}
@@ -131,18 +138,17 @@ static BOOL lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
// Zuerst nach Ende danach nach Ptr
static BOOL lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
{
- xub_StrLen nHt1 = *rHt1.GetAnyEnd();
- xub_StrLen nHt2 = *rHt2.GetAnyEnd();
+ const xub_StrLen nHt1 = *rHt1.GetAnyEnd();
+ const xub_StrLen nHt2 = *rHt2.GetAnyEnd();
if ( nHt1 == nHt2 )
{
if ( *rHt1.GetStart() == *rHt2.GetStart() )
{
- nHt1 = rHt1.Which();
- nHt2 = rHt2.Which();
-
- if ( nHt1 == nHt2 )
+ const USHORT nWhich1 = rHt1.Which();
+ const USHORT nWhich2 = rHt2.Which();
+ if ( nWhich1 == nWhich2 )
{
- if ( RES_TXTATR_CHARFMT == nHt1 )
+ if ( RES_TXTATR_CHARFMT == nWhich1 )
{
const USHORT nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber();
const USHORT nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber();
@@ -153,7 +159,8 @@ static BOOL lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
return (long)&rHt1 > (long)&rHt2;
}
- // else return nHt1 < nHt2, see below
+ // order is important! for requirements see hintids.hxx
+ return ( nWhich1 < nWhich2 );
}
else
return ( *rHt1.GetStart() > *rHt2.GetStart() );
@@ -375,6 +382,37 @@ bool SwpHintsArray::Check() const
( *pHtThis->GetStart() == *pHtThis->GetEnd() ),
"HintsCheck: Portion inconsistency. "
"This can be temporarily ok during undo operations" );
+
+ if (pHtThis->IsNesting())
+ {
+ for ( USHORT j = 0; j < Count(); ++j )
+ {
+ SwTxtAttr const * const pOther( m_HintStarts[j] );
+ if ( pOther->IsNesting() && (i != j) )
+ {
+ SwComparePosition cmp = ComparePosition(
+ *pHtThis->GetStart(), *pHtThis->GetEnd(),
+ *pOther->GetStart(), *pOther->GetEnd());
+ CHECK_ERR( (POS_OVERLAP_BEFORE != cmp) &&
+ (POS_OVERLAP_BEHIND != cmp),
+ "HintsCheck: overlapping nesting hints!!!" );
+ }
+ }
+ }
+
+ // 9) dummy char check (unfortunately cannot check SwTxtNode::m_Text)
+ if (pHtThis->HasDummyChar())
+ {
+ for ( USHORT j = 0; j < i; ++j )
+ {
+ SwTxtAttr const * const pOther( m_HintStarts[j] );
+ if (pOther->HasDummyChar())
+ {
+ CHECK_ERR( (*pOther->GetStart() != *pHtThis->GetStart()),
+ "HintsCheck: multiple hints claim same CH_TXTATR!");
+ }
+ }
+ }
#endif
}
return true;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 8183d1c9b68b..f5ebacaac8cd 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -52,7 +52,6 @@
#include <fmtinfmt.hxx>
#include <fmtpdsc.hxx>
#include <txtatr.hxx>
-#include <fmthbsh.hxx>
#include <fmtrfmrk.hxx>
#include <txttxmrk.hxx>
#include <fchrfmt.hxx>
@@ -64,6 +63,7 @@
#include <ftnidx.hxx>
#include <ftninfo.hxx>
#include <fmtftn.hxx>
+#include <fmtmeta.hxx>
#include <charfmt.hxx>
#include <ndtxt.hxx>
#include <doc.hxx>
@@ -234,7 +234,6 @@ SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere,
mpNodeNum( 0 ),
m_bLastOutlineState( false ),
m_bNotifiable( false ),
- //nOutlineLevel( pTxtColl->GetOutlineLevel() )//#outline level, removed by zhaojianwei.
// --> OD 2008-11-19 #i70748#
mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ),
// <--
@@ -253,6 +252,15 @@ SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere,
// SyncNumberAndNumRule();
if ( !IsInList() && GetNumRule() && GetListId().Len() > 0 )
{
+ // --> OD 2009-08-27 #i101516#
+ // apply paragraph style's assigned outline style list level as
+ // list level of the paragraph, if it has none set already.
+ if ( !HasAttrListLevel() &&
+ pTxtColl && pTxtColl->IsAssignedToListLevelOfOutlineStyle() )
+ {
+ SetAttrListLevel( pTxtColl->GetAssignedOutlineStyleLevel() );
+ }
+ // <--
AddToList();
}
// <--
@@ -390,9 +398,10 @@ void lcl_ChangeFtnRef( SwTxtNode &rNode )
SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
{
// lege den Node "vor" mir an
- xub_StrLen nSplitPos = rPos.nContent.GetIndex();
- xub_StrLen nTxtLen = m_Text.Len();
- SwTxtNode* pNode = _MakeNewTxtNode( rPos.nNode, FALSE, nSplitPos==nTxtLen );
+ const xub_StrLen nSplitPos = rPos.nContent.GetIndex();
+ const xub_StrLen nTxtLen = m_Text.Len();
+ SwTxtNode* const pNode =
+ _MakeNewTxtNode( rPos.nNode, FALSE, nSplitPos==nTxtLen );
// the first paragraph gets the XmlId,
// _except_ if it is empty and the second is not empty
@@ -444,21 +453,27 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
//Ersten Teil des Inhalts in den neuen Node uebertragen und
//im alten Node loeschen.
SwIndex aIdx( this );
- Cut( pNode, aIdx, nSplitPos );
+ CutText( pNode, aIdx, nSplitPos );
if( GetWrong() )
+ {
pNode->SetWrong( GetWrong()->SplitList( nSplitPos ) );
+ }
SetWrongDirty( true );
if( GetGrammarCheck() )
+ {
pNode->SetGrammarCheck( GetGrammarCheck()->SplitGrammarList( nSplitPos ) );
+ }
SetGrammarCheckDirty( true );
SetWordCountDirty( true );
// SMARTTAGS
if( GetSmartTags() )
+ {
pNode->SetSmartTags( GetSmartTags()->SplitList( nSplitPos ) );
+ }
SetSmartTagDirty( true );
if ( pNode->HasHints() )
@@ -479,21 +494,22 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
// Attribute loeschen
if ( HasHints() )
{
- SwTxtAttr* pHt;
- xub_StrLen* pEnd;
for ( USHORT j = m_pSwpHints->Count(); j; )
{
- pHt = m_pSwpHints->GetTextHint( --j );
+ SwTxtAttr* const pHt = m_pSwpHints->GetTextHint( --j );
if ( RES_TXTATR_FLYCNT == pHt ->Which() )
{
pHt->GetFlyCnt().GetFrmFmt()->DelFrms();
}
- else if( pHt->DontExpand() && 0 != ( pEnd = pHt->GetEnd() )
- && *pHt->GetStart() == *pEnd )
+ else if ( pHt->DontExpand() )
{
- // delete it!
- m_pSwpHints->DeleteAtPos( j );
- DestroyAttr( pHt );
+ const xub_StrLen* const pEnd = pHt->GetEnd();
+ if (pEnd && *pHt->GetStart() == *pEnd )
+ {
+ // delete it!
+ m_pSwpHints->DeleteAtPos( j );
+ DestroyAttr( pHt );
+ }
}
}
}
@@ -503,6 +519,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
SwClientIter aIter( *this );
SwClient* pLastFrm = aIter.GoStart();
if( pLastFrm )
+ {
do
{ SwCntntFrm *pFrm = PTR_CAST( SwCntntFrm, pLastFrm );
if ( pFrm )
@@ -512,7 +529,9 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
((SwTxtFrm*)pFrm)->GetOfst() )
((SwTxtFrm*)pFrm)->SetOfst( 0 );
}
- } while( 0 != ( pLastFrm = aIter++ ));
+ pLastFrm = aIter++;
+ } while ( pLastFrm );
+ }
if ( IsInCache() )
{
@@ -522,13 +541,12 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
UnlockModify(); // Benachrichtigungen wieder freischalten
- const SwRootFrm *pRootFrm;
+ const SwRootFrm * const pRootFrm = pNode->GetDoc()->GetRootFrm();
// 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 ||
- ( (pRootFrm = pNode->GetDoc()->GetRootFrm()) != 0 &&
- pRootFrm->IsAnyShellAccessible() ) )
+ if ( (nTxtLen != nSplitPos) ||
+ ( pRootFrm && pRootFrm->IsAnyShellAccessible() ) )
{
// dann sage den Frames noch, das am Ende etwas "geloescht" wurde
@@ -568,18 +586,16 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
SetSmartTagDirty( true );
SwIndex aIdx( this );
- Cut( pNode, aIdx, rPos.nContent.GetIndex() );
+ CutText( pNode, aIdx, nSplitPos );
// JP 01.10.96: alle leeren und nicht zu expandierenden
// Attribute loeschen
if ( HasHints() )
{
- SwTxtAttr* pHt;
- xub_StrLen* pEnd;
for ( USHORT j = m_pSwpHints->Count(); j; )
{
- pHt = m_pSwpHints->GetTextHint( --j );
- pEnd = pHt->GetEnd();
+ SwTxtAttr* const pHt = m_pSwpHints->GetTextHint( --j );
+ const xub_StrLen* const pEnd = pHt->GetEnd();
if ( pHt->DontExpand() && pEnd && (*pHt->GetStart() == *pEnd) )
{
// delete it!
@@ -610,7 +626,9 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
}
if ( GetDepends() )
+ {
MakeFrms( *pNode ); // neue Frames anlegen.
+ }
lcl_ChangeFtnRef( *pNode );
}
@@ -622,7 +640,9 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
const SfxPoolItem *pItem;
if( GetDepends() && SFX_ITEM_SET == pNode->GetSwAttrSet().
GetItemState( RES_PAGEDESC, TRUE, &pItem ) )
+ {
pNode->Modify( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
+ }
}
return pNode;
}
@@ -727,7 +747,7 @@ SwCntntNode *SwTxtNode::JoinNext()
}
{ // wg. SwIndex
- pTxtNode->Cut( this, SwIndex(pTxtNode), pTxtNode->Len() );
+ pTxtNode->CutText( this, SwIndex(pTxtNode), pTxtNode->Len() );
}
// verschiebe noch alle Bookmarks/TOXMarks
if( aBkmkArr.Count() )
@@ -822,7 +842,7 @@ SwCntntNode *SwTxtNode::JoinPrev()
}
{ // wg. SwIndex
- pTxtNode->Cut( this, SwIndex( this ), SwIndex(pTxtNode), nLen );
+ pTxtNode->CutText( this, SwIndex(this), SwIndex(pTxtNode), nLen );
}
// verschiebe noch alle Bookmarks/TOXMarks
if( aBkmkArr.Count() )
@@ -869,51 +889,49 @@ void SwTxtNode::NewAttrSet( SwAttrPool& rPool )
}
-// Ueberladen der virtuellen Update-Methode von SwIndexReg. Dadurch
-// benoetigen die Text-Attribute nur xub_StrLen statt SwIndizies!
-void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
- BOOL bNegativ, BOOL bDelete )
+// override SwIndexReg::Update => text hints do not need SwIndex for start/end!
+void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
+ const bool bNegative, const bool bDelete )
{
SetAutoCompleteWordDirty( TRUE );
- TmpHints* pCollector = NULL;
+ ::std::auto_ptr<TmpHints> pCollector;
+ const xub_StrLen nChangePos = rPos.GetIndex();
+
if ( HasHints() )
{
- xub_StrLen nPos = aPos.GetIndex();
- xub_StrLen* pIdx;
- SwTxtAttr* pHt;
- if( bNegativ )
+ if ( bNegative )
{
- xub_StrLen nMax = nPos + nLen;
+ const xub_StrLen nChangeEnd = nChangePos + nChangeLen;
for ( USHORT n = 0; n < m_pSwpHints->Count(); ++n )
{
- BOOL bSttBefore = FALSE;
- pHt = m_pSwpHints->GetTextHint(n);
- pIdx = pHt->GetStart();
- if( *pIdx >= nPos )
+ SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(n);
+ xub_StrLen * const pStart = pHint->GetStart();
+ if ( *pStart > nChangePos )
{
- if( *pIdx > nMax )
- *pIdx = *pIdx - nLen;
+ if ( *pStart > nChangeEnd )
+ {
+ *pStart = *pStart - nChangeLen;
+ }
else
{
- *pIdx = nPos;
+ *pStart = nChangePos;
}
}
- else
- bSttBefore = TRUE;
- if( 0 == (pIdx = pHt->GetEnd()) )
- continue;
-
- if( *pIdx >= nPos )
+ xub_StrLen * const pEnd = pHint->GetEnd();
+ if (pEnd)
{
- if( *pIdx > nMax )
+ if ( *pEnd > nChangePos )
{
- *pIdx = *pIdx - nLen;
- }
- else if( *pIdx != nPos )
- {
- *pIdx = nPos;
+ if( *pEnd > nChangeEnd )
+ {
+ *pEnd = *pEnd - nChangeLen;
+ }
+ else
+ {
+ *pEnd = nChangePos;
+ }
}
}
}
@@ -922,9 +940,8 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
}
else
{
- xub_StrLen* pEnd;
- BOOL bNoExp = FALSE;
- BOOL bResort = FALSE;
+ bool bNoExp = false;
+ bool bResort = false;
const USHORT coArrSz = static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
static_cast<USHORT>(RES_CHRATR_BEGIN) +
static_cast<USHORT>(RES_UNKNOWNATR_END) -
@@ -935,27 +952,29 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
for ( USHORT n = 0; n < m_pSwpHints->Count(); ++n )
{
- pHt = m_pSwpHints->GetTextHint(n);
- pIdx = pHt->GetStart();
- pEnd = pHt->GetEnd();
- if ( *pIdx >= nPos )
+ SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(n);
+ xub_StrLen * const pStart = pHint->GetStart();
+ xub_StrLen * const pEnd = pHint->GetEnd();
+ if ( *pStart >= nChangePos )
{
- *pIdx = *pIdx + nLen;
+ *pStart = *pStart + nChangeLen;
if ( pEnd )
{
- *pEnd = *pEnd + nLen;
+ *pEnd = *pEnd + nChangeLen;
}
}
- else if ( pEnd && *pEnd >= nPos )
+ else if ( pEnd && (*pEnd >= nChangePos) )
{
- if( *pEnd > nPos || IsIgnoreDontExpand() )
+ if ( (*pEnd > nChangePos) || IsIgnoreDontExpand() )
{
- *pEnd = *pEnd + nLen;
+ *pEnd = *pEnd + nChangeLen;
}
- else
+ else // *pEnd == nChangePos
{
- USHORT nWhPos, nWhich = pHt->Which();
+ USHORT nWhPos;
+ const USHORT nWhich = pHint->Which();
+ ASSERT(!isCHRATR(nWhich), "Update: char attr hint?");
if (isCHRATR(nWhich) || isTXTATR_WITHEND(nWhich))
{
nWhPos = static_cast<USHORT>(nWhich -
@@ -975,13 +994,13 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
if( aDontExp[ nWhPos ] )
continue;
- if( pHt->DontExpand() )
+ if ( pHint->DontExpand() )
{
- pHt->SetDontExpand( FALSE );
- bResort = TRUE;
- if( pHt->IsCharFmtAttr() )
+ pHint->SetDontExpand( false );
+ bResort = true;
+ if ( pHint->IsCharFmtAttr() )
{
- bNoExp = TRUE;
+ bNoExp = true;
aDontExp[ static_cast<USHORT>(RES_TXTATR_CHARFMT) - static_cast<USHORT>(RES_CHRATR_BEGIN) ]
= TRUE;
aDontExp[ static_cast<USHORT>(RES_TXTATR_INETFMT) - static_cast<USHORT>(RES_CHRATR_BEGIN) ]
@@ -992,8 +1011,10 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
}
else if( bNoExp )
{
- if( !pCollector )
- pCollector = new TmpHints;
+ if ( !pCollector.get() )
+ {
+ pCollector.reset( new TmpHints );
+ }
USHORT nCollCnt = pCollector->Count();
for( USHORT i = 0; i < nCollCnt; ++i )
{
@@ -1001,22 +1022,24 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
if( nWhich == pTmp->Which() )
{
pCollector->Remove( i );
- delete pTmp;
+ SwTxtAttr::Destroy( pTmp,
+ GetDoc()->GetAttrPool() );
break;
}
}
- SwTxtAttr *pTmp = MakeTxtAttr( pHt->GetAttr(),
- nPos, nPos + nLen );
+ SwTxtAttr * const pTmp = MakeTxtAttr( *GetDoc(),
+ pHint->GetAttr(),
+ nChangePos, nChangePos + nChangeLen);
pCollector->C40_INSERT( SwTxtAttr, pTmp, pCollector->Count() );
}
else
{
- *pEnd = *pEnd + nLen;
+ *pEnd = *pEnd + nChangeLen;
}
}
}
}
- if( bResort )
+ if ( bResort )
{
m_pSwpHints->Resort();
}
@@ -1024,45 +1047,51 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
}
SwIndexReg aTmpIdxReg;
- if( !bNegativ && !bDelete )
+ if ( !bNegative && !bDelete )
{
- SwIndex* pIdx;
const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
- if( rTbl.Count() )
- for( USHORT i = 0; i < rTbl.Count(); ++i )
+ for ( USHORT i = 0; i < rTbl.Count(); ++i )
+ {
+ SwRedline *const pRedl = rTbl[ i ];
+ if ( pRedl->HasMark() )
{
- SwRedline* pRedl = rTbl[ i ];
- if( pRedl->HasMark() )
+ SwPosition* const pEnd = pRedl->End();
+ if ( this == &pEnd->nNode.GetNode() &&
+ *pRedl->GetPoint() != *pRedl->GetMark() )
{
- SwPosition* pEnd = pRedl->End();
-
- if( this == &pEnd->nNode.GetNode() &&
- *pRedl->GetPoint() != *pRedl->GetMark() &&
- aPos.GetIndex() ==
- (pIdx = &pEnd->nContent)->GetIndex() )
- pIdx->Assign( &aTmpIdxReg, pIdx->GetIndex() );
+ SwIndex & rIdx = pEnd->nContent;
+ if (nChangePos == rIdx.GetIndex())
+ {
+ rIdx.Assign( &aTmpIdxReg, rIdx.GetIndex() );
+ }
}
- else if( this == &pRedl->GetPoint()->nNode.GetNode() &&
- aPos.GetIndex() == (pIdx = &pRedl->GetPoint()->
- nContent)->GetIndex() )
+ }
+ else if ( this == &pRedl->GetPoint()->nNode.GetNode() )
+ {
+ SwIndex & rIdx = pRedl->GetPoint()->nContent;
+ if (nChangePos == rIdx.GetIndex())
{
- pIdx->Assign( &aTmpIdxReg, pIdx->GetIndex() );
- if( &pRedl->GetBound( TRUE ) == pRedl->GetPoint() )
+ rIdx.Assign( &aTmpIdxReg, rIdx.GetIndex() );
+ // mst: FIXME: why does this adjust the unused position???
+ SwIndex * pIdx;
+ if ( &pRedl->GetBound( true ) == pRedl->GetPoint() )
{
- pRedl->GetBound( FALSE ) = pRedl->GetBound( TRUE );
- pIdx = &pRedl->GetBound( FALSE ).nContent;
+ pRedl->GetBound( false ) = pRedl->GetBound( true );
+ pIdx = &pRedl->GetBound( false ).nContent;
}
else
{
- pRedl->GetBound( TRUE ) = pRedl->GetBound( FALSE );
- pIdx = &pRedl->GetBound( TRUE ).nContent;
+ pRedl->GetBound( true ) = pRedl->GetBound( false );
+ pIdx = &pRedl->GetBound( true ).nContent;
}
pIdx->Assign( &aTmpIdxReg, pIdx->GetIndex() );
}
}
+ }
const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
- for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ for(IDocumentMarkAccess::const_iterator_t ppMark =
+ pMarkAccess->getMarksBegin();
ppMark != pMarkAccess->getMarksEnd();
ppMark++)
{
@@ -1072,21 +1101,25 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
// to the left of the inserted text (used in XML import).
const ::sw::mark::IMark* const pMark = ppMark->get();
const SwPosition* pEnd = &pMark->GetMarkEnd();
- pIdx = (SwIndex*)&pEnd->nContent;
+ SwIndex & rIdx = const_cast<SwIndex&>(pEnd->nContent);
if( this == &pEnd->nNode.GetNode() &&
- aPos.GetIndex() == pIdx->GetIndex() )
- pIdx->Assign( &aTmpIdxReg, pIdx->GetIndex() );
+ rPos.GetIndex() == rIdx.GetIndex() )
+ {
+ rIdx.Assign( &aTmpIdxReg, rIdx.GetIndex() );
+ }
}
}
- SwIndexReg::Update( aPos, nLen, bNegativ );
- if( pCollector )
+
+ // base class
+ SwIndexReg::Update( rPos, nChangeLen, bNegative, bDelete );
+
+ if ( pCollector.get() )
{
- USHORT nCount = pCollector->Count();
- for( USHORT i = 0; i < nCount; ++i )
+ const USHORT nCount = pCollector->Count();
+ for ( USHORT i = 0; i < nCount; ++i )
{
- m_pSwpHints->Insert( (*pCollector)[ i ], *this, FALSE );
+ m_pSwpHints->TryInsertHint( (*pCollector)[ i ], *this );
}
- delete pCollector;
}
aTmpIdxReg.MoveTo( *this );
@@ -1252,8 +1285,8 @@ SwCharFmt* lcl_FindCharFmt( const SwCharFmts* pCharFmts, const XubString& rName
return NULL;
}
-void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr *pHt,
- SwTxtAttr *pNewHt, SwDoc* pOtherDoc, SwTxtNode *pDest )
+void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr * const pHt,
+ SwTxtAttr *const pNewHt, SwDoc *const pOtherDoc, SwTxtNode *const pDest )
{
ASSERT( nWhich == pHt->Which(), "Falsche Hint-Id" );
switch( nWhich )
@@ -1261,7 +1294,8 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr *pHt,
// Wenn wir es mit einem Fussnoten-Attribut zu tun haben,
// muessen wir natuerlich auch den Fussnotenbereich kopieren.
case RES_TXTATR_FTN :
- ((SwTxtFtn*)pHt)->CopyFtn( (SwTxtFtn*)pNewHt );
+ static_cast<const SwTxtFtn*>(pHt)->CopyFtn(
+ static_cast<SwTxtFtn*>(pNewHt));
break;
// Beim Kopieren von Feldern in andere Dokumente
@@ -1272,19 +1306,24 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr *pHt,
{
const SwFmtFld& rFld = pHt->GetFld();
if( pOtherDoc )
- ((SwTxtFld*)pHt)->CopyFld( (SwTxtFld*)pNewHt );
+ {
+ static_cast<const SwTxtFld*>(pHt)->CopyFld(
+ static_cast<SwTxtFld*>(pNewHt) );
+ }
// Tabellenformel ??
if( RES_TABLEFLD == rFld.GetFld()->GetTyp()->Which()
- && ((SwTblField*)rFld.GetFld())->IsIntrnlName() )
+ && static_cast<const SwTblField*>(rFld.GetFld())->IsIntrnlName())
{
// wandel die interne in eine externe Formel um
- const SwTableNode* pDstTblNd = ((SwTxtFld*)pHt)->
+ const SwTableNode* const pDstTblNd =
+ static_cast<const SwTxtFld*>(pHt)->
GetTxtNode().FindTableNode();
if( pDstTblNd )
{
- SwTblField* pTblFld = (SwTblField*)
- pNewHt->GetFld().GetFld();
+ SwTblField* const pTblFld = const_cast<SwTblField*>(
+ static_cast<const SwTblField*>(
+ pNewHt->GetFld().GetFld()));
pTblFld->PtrToBoxNm( &pDstTblNd->GetTable() );
}
}
@@ -1294,9 +1333,11 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr *pHt,
case RES_TXTATR_TOXMARK :
if( pOtherDoc && pDest && pDest->GetpSwpHints()
&& USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+ {
// Beim Kopieren von TOXMarks(Client) in andere Dokumente
// muss der Verzeichnis (Modify) ausgetauscht werden
- ((SwTxtTOXMark*)pNewHt)->CopyTOXMark( pOtherDoc );
+ static_cast<SwTxtTOXMark*>(pNewHt)->CopyTOXMark( pOtherDoc );
+ }
break;
case RES_TXTATR_CHARFMT :
@@ -1305,21 +1346,27 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr *pHt,
if( pDest && pDest->GetpSwpHints()
&& USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
{
- SwCharFmt* pFmt = (SwCharFmt*)pHt->GetCharFmt().GetCharFmt();
+ SwCharFmt* pFmt =
+ static_cast<SwCharFmt*>(pHt->GetCharFmt().GetCharFmt());
if( pFmt && pOtherDoc )
+ {
pFmt = pOtherDoc->CopyCharFmt( *pFmt );
- ((SwFmtCharFmt&)pNewHt->GetCharFmt()).SetCharFmt( pFmt );
+ }
+ const_cast<SwFmtCharFmt&>( static_cast<const SwFmtCharFmt&>(
+ pNewHt->GetCharFmt() ) ).SetCharFmt( pFmt );
}
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() ) )
+ const SwDoc* const pDoc = static_cast<const SwTxtINetFmt*>(pHt)
+ ->GetTxtNode().GetDoc();
+ if ( pDoc )
{
const SwCharFmts* pCharFmts = pDoc->GetCharFmts();
const SwFmtINetFmt& rFmt = pHt->GetINetFmt();
@@ -1335,11 +1382,27 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr *pHt,
//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 );
+ SwTxtINetFmt* const pINetHt = static_cast<SwTxtINetFmt*>(pNewHt);
+ if ( !pINetHt->GetpTxtNode() )
+ {
+ pINetHt->ChgTxtNode( pDest );
+ }
//JP 22.10.97: Bug 44875 - Verbindung zum Format herstellen
- ((SwTxtINetFmt*)pNewHt)->GetCharFmt();
+ pINetHt->GetCharFmt();
+ break;
+ }
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ ASSERT(pNewHt, "copying META should not fail! cannot call DoCopy");
+ ASSERT(pDest && (CH_TXTATR_INWORD ==
+ pDest->GetTxt().GetChar(*pNewHt->GetStart())),
+ "missing CH_TXTATR?");
+ if (pNewHt)
+ {
+ SwFmtMeta & rMeta(static_cast<SwFmtMeta&>(pNewHt->GetAttr()));
+ rMeta.DoCopy( const_cast<SwFmtMeta&>(pHt->GetMeta()) );
+ }
break;
}
}
@@ -1358,40 +1421,41 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
{
if ( HasHints() ) // keine Attribute, keine Kekse
{
- const xub_StrLen *pEndIdx = 0;
- const SwTxtAttr *pHt = 0;
- SwTxtAttr *pNewHt = 0;
- xub_StrLen nAttrStartIdx = 0;
- USHORT nWhich;
-
- SwDoc* pOtherDoc = pDest->GetDoc();
- if( pOtherDoc == GetDoc() )
- pOtherDoc = 0;
+ SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ?
+ pDest->GetDoc() : 0;
for ( USHORT i = 0; i < m_pSwpHints->Count(); i++ )
{
- pHt = (*m_pSwpHints)[i];
- if( nTxtStartIdx < ( nAttrStartIdx = *pHt->GetStart() ) )
+ SwTxtAttr *const pHt = m_pSwpHints->GetTextHint(i);
+ xub_StrLen const nAttrStartIdx = *pHt->GetStart();
+ if ( nTxtStartIdx < nAttrStartIdx )
break; // ueber das Textende, da nLen == 0
- pEndIdx = pHt->GetEnd();
- if( pEndIdx )
+ const xub_StrLen *const pEndIdx = pHt->GetEnd();
+ if ( pEndIdx && !pHt->HasDummyChar() )
{
if( ( *pEndIdx > nTxtStartIdx ||
( *pEndIdx == nTxtStartIdx &&
nAttrStartIdx == nTxtStartIdx ) ) )
{
- if( RES_TXTATR_REFMARK != ( nWhich = pHt->Which()) )
+ USHORT const nWhich = pHt->Which();
+ if ( RES_TXTATR_REFMARK != nWhich )
{
- // Attribut liegt im Bereich, also kopieren
- if( 0 != ( pNewHt = pDest->InsertItem( pHt->GetAttr(),
- nOldPos, nOldPos ) ) )
- lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
+ // attribute in the area => copy
+ SwTxtAttr *const pNewHt = pDest->InsertItem(
+ pHt->GetAttr(), nOldPos, nOldPos );
+ if ( pNewHt )
+ {
+ lcl_CopyHint( nWhich, pHt, pNewHt,
+ pOtherDoc, pDest );
+ }
}
else if( !pOtherDoc ? GetDoc()->IsCopyIsMove()
: 0 == pOtherDoc->GetRefMark(
pHt->GetRefMark().GetRefName() ) )
+ {
pDest->InsertItem( pHt->GetAttr(), nOldPos, nOldPos );
+ }
}
}
}
@@ -1413,19 +1477,19 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
// --> OD 2008-11-18 #i96213#
// introduction of new optional parameter to control, if all attributes have to be copied.
-void SwTxtNode::Copy( SwTxtNode *pDest,
+void SwTxtNode::CopyText( SwTxtNode *const pDest,
const SwIndex &rStart,
- xub_StrLen nLen,
+ const xub_StrLen nLen,
const bool bForceCopyOfAllAttrs )
{
SwIndex aIdx( pDest, pDest->m_Text.Len() );
- Copy( pDest, aIdx, rStart, nLen, bForceCopyOfAllAttrs );
+ CopyText( pDest, aIdx, rStart, nLen, bForceCopyOfAllAttrs );
}
// <--
// --> OD 2008-11-18 #i96213#
// introduction of new optional parameter to control, if all attributes have to be copied.
-void SwTxtNode::Copy( SwTxtNode *pDest,
+void SwTxtNode::CopyText( SwTxtNode *const pDest,
const SwIndex &rDestStart,
const SwIndex &rStart,
xub_StrLen nLen,
@@ -1454,42 +1518,39 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
{
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_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0 );
aCharSet.Put( *GetpSwAttrSet() );
if( aCharSet.Count() )
+ {
pDest->SetAttr( aCharSet, nDestStart, nDestStart );
+ }
}
else
+ {
GetpSwAttrSet()->CopyToModify( *pDest );
+ }
}
return;
}
// 1. Text kopieren
- xub_StrLen i = pDest->m_Text.Len() - nDestStart;
+ const xub_StrLen oldLen = pDest->m_Text.Len();
//JP 15.02.96: Bug 25537 - Attributbehandlung am Ende fehlt! Darum
// ueber die InsertMethode den Text einfuegen und nicht
// selbst direkt
- pDest->Insert( m_Text.Copy( nTxtStartIdx, nLen ), rDestStart,
- INS_EMPTYEXPAND );
+ pDest->InsertText( m_Text.Copy( nTxtStartIdx, nLen ), rDestStart,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
// um reale Groesse Updaten !
- nLen = pDest->m_Text.Len() - nDestStart - i;
+ nLen = pDest->m_Text.Len() - oldLen;
if ( !nLen ) // string not longer?
return;
- i = 0;
- const xub_StrLen *pEndIdx = 0;
- xub_StrLen nAttrStartIdx = 0;
- const SwTxtAttr *pHt = 0;
- SwTxtAttr *pNewHt = 0;
-
- SwDoc* pOtherDoc = pDest->GetDoc();
- if( pOtherDoc == GetDoc() )
- pOtherDoc = 0;
+ SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ?
+ pDest->GetDoc() : 0;
// harte Absatz umspannende Attribute kopieren
if( HasSwAttrSet() )
@@ -1504,32 +1565,33 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
{
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_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0 );
aCharSet.Put( *GetpSwAttrSet() );
if( aCharSet.Count() )
+ {
pDest->SetAttr( aCharSet, nDestStart, nDestStart + nLen );
+ }
}
else
+ {
GetpSwAttrSet()->CopyToModify( *pDest );
+ }
}
-
- const BOOL bUndoNodes = !pOtherDoc && GetDoc()->GetUndoNds() == &GetNodes();
+ const bool bUndoNodes = !pOtherDoc && GetDoc()->GetUndoNds() == &GetNodes();
// Ende erst jetzt holen, weil beim Kopieren in sich selbst der
// Start-Index und alle Attribute vorher aktualisiert werden.
nTxtStartIdx = rStart.GetIndex();
- xub_StrLen nEnd = nTxtStartIdx + nLen;
+ const xub_StrLen nEnd = nTxtStartIdx + nLen;
// 2. Attribute kopieren
// durch das Attribute-Array, bis der Anfang des Geltungsbereiches
// des Attributs hinter dem zu kopierenden Bereich liegt
- USHORT nWhich;
- USHORT nSize = m_pSwpHints ? m_pSwpHints->Count() : 0;
- xub_StrLen nAttrStt, nAttrEnd;
+ const USHORT nSize = m_pSwpHints ? m_pSwpHints->Count() : 0;
// wird in sich selbst kopiert, dann kann beim Einfuegen ein
// Attribut geloescht werden. Darum erst ins Tmp-Array kopieren und
@@ -1540,13 +1602,15 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
SwpHts aRefMrkArr;
//Achtung: kann ungueltig sein!!
- while ( ( i < nSize ) &&
- ((nAttrStartIdx = *(*m_pSwpHints)[i]->GetStart()) < nEnd) )
+ for (USHORT n = 0; ( n < nSize ); ++n)
{
- pHt = (*m_pSwpHints)[i];
- pNewHt = 0;
- pEndIdx = pHt->GetEnd();
- nWhich = pHt->Which();
+ const xub_StrLen nAttrStartIdx = *(*m_pSwpHints)[n]->GetStart();
+ if (!( nAttrStartIdx < nEnd))
+ break;
+
+ SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(n);
+ const xub_StrLen * const pEndIdx = pHt->GetEnd();
+ const USHORT nWhich = pHt->Which();
// JP 26.04.94: REFMARK's werden nie kopiert. Hat das Refmark aber
// keinen Bereich umspannt, so steht im Text ein 255
@@ -1561,44 +1625,52 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
if( pEndIdx && RES_TXTATR_REFMARK == nWhich && !bCopyRefMark )
{
- ++i;
continue;
}
+ xub_StrLen nAttrStt;
+ xub_StrLen nAttrEnd;
+
if( nAttrStartIdx < nTxtStartIdx )
{
- // Anfang liegt vor dem Bereich
- if( pEndIdx && ( nAttrEnd = *pEndIdx ) > nTxtStartIdx )
+ // start is before selection
+ // copy hints with end and CH_TXTATR only if dummy char is copied
+ if ( pEndIdx && (*pEndIdx > nTxtStartIdx) && !pHt->HasDummyChar() )
{
- // Attribut mit einem Bereich
- // und das Ende des Attribut liegt im Bereich
+ // attribute with extent and the end is in the selection
nAttrStt = nDestStart;
- nAttrEnd = nAttrEnd > nEnd
+ nAttrEnd = (*pEndIdx > nEnd)
? rDestStart.GetIndex()
- : nDestStart + nAttrEnd - nTxtStartIdx;
+ : nDestStart + (*pEndIdx) - nTxtStartIdx;
}
else
{
- ++i;
continue;
}
}
else
{
- // der Anfang liegt innerhalb des Bereiches
+ // start is in the selection
nAttrStt = nDestStart + ( nAttrStartIdx - nTxtStartIdx );
if( pEndIdx )
+ {
nAttrEnd = *pEndIdx > nEnd
? rDestStart.GetIndex()
: nDestStart + ( *pEndIdx - nTxtStartIdx );
+ }
else
+ {
nAttrEnd = nAttrStt;
+ }
}
+ SwTxtAttr * pNewHt = 0;
+
if( pDest == this )
{
// die Daten kopieren
- pNewHt = MakeTxtAttr( pHt->GetAttr(), nAttrStt, nAttrEnd );
+ pNewHt = MakeTxtAttr( *GetDoc(), pHt->GetAttr(),
+ nAttrStt, nAttrEnd );
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//JP 23.04.95: erstmal so gesondert hier behandeln. Am Besten ist es
@@ -1623,38 +1695,28 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
else
{
pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt,
- nAttrEnd, nsSetAttrMode::SETATTR_NOTXTATRCHR );
- if( pNewHt )
- lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
- else if( !pEndIdx )
- {
- // Attribut wurde nicht kopiert, hat seinen Inhalt mitgenommen!
- // Damit der rest aber korrekt kopiert werden kann, muss das
- // Zeichen wieder an der Position stehen. Darum hier ein
- // "Dummy-TextAttribut" einfuegen, wird am Ende wieder entfernt!
- pNewHt = pDest->InsertItem( SwFmtHardBlank( 0xB7 ), nAttrStt, 0
- /*???, INS_NOHINTEXPAND*/ );
- aRefMrkArr.C40_INSERT( SwTxtAttr, pNewHt, aRefMrkArr.Count() );
- }
+ nAttrEnd, nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
}
if( RES_TXTATR_REFMARK == nWhich && !pEndIdx && !bCopyRefMark )
{
aRefMrkArr.C40_INSERT( SwTxtAttr, pNewHt, aRefMrkArr.Count() );
}
-
- ++i;
}
// nur falls im Array Attribute stehen (kann nur beim Kopieren
// sich selbst passieren!!)
- for( i = 0; i < aArr.Count(); ++i )
- Insert( aArr[ i ], nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ for ( USHORT i = 0; i < aArr.Count(); ++i )
+ {
+ InsertHint( aArr[ i ], nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ }
if( pDest->GetpSwpHints() )
- for( i = 0; i < aRefMrkArr.Count(); ++i )
+ {
+ for ( USHORT i = 0; i < aRefMrkArr.Count(); ++i )
{
- pNewHt = aRefMrkArr[i];
+ SwTxtAttr * const pNewHt = aRefMrkArr[i];
if( pNewHt->GetEnd() )
{
pDest->GetpSwpHints()->Delete( pNewHt );
@@ -1663,69 +1725,77 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
else
{
const SwIndex aIdx( pDest, *pNewHt->GetStart() );
- pDest->Erase( aIdx, 1 );
+ pDest->EraseText( aIdx, 1 );
}
}
+ }
CHECK_SWPHINTS(this);
}
-/*
- * Rudimentaeres Editieren, damit die SwDoc-Insert-Methoden
- * funktionieren.
- */
-
-SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
- const SwIndex &rIdx, const USHORT nMode )
+void SwTxtNode::InsertText( const XubString & rStr, const SwIndex & rIdx,
+ const IDocumentContentOperations::InsertFlags nMode )
{
- ASSERT( rIdx <= m_Text.Len(), "SwTxtNode::Insert: invalid index." );
+ ASSERT( rIdx <= m_Text.Len(), "SwTxtNode::InsertText: invalid index." );
ASSERT( (ULONG)m_Text.Len() + (ULONG)rStr.Len() <= STRING_LEN,
- "SwTxtNode::Insert: node text with insertion > STRING_LEN." );
+ "SwTxtNode::InsertText: node text with insertion > STRING_LEN." );
xub_StrLen aPos = rIdx.GetIndex();
xub_StrLen nLen = m_Text.Len() - aPos;
m_Text.Insert( rStr, aPos );
nLen = m_Text.Len() - aPos - nLen;
- if( !nLen )
- return *this;
- Update( rIdx, nLen ); // um reale Groesse Updaten !
+
+ if ( !nLen ) return;
+
+ BOOL bOldExpFlg = IsIgnoreDontExpand();
+ if (nMode & IDocumentContentOperations::INS_FORCEHINTEXPAND)
+ {
+ SetIgnoreDontExpand( TRUE );
+ }
+
+ Update( rIdx, nLen ); // text content changed!
+
+ if (nMode & IDocumentContentOperations::INS_FORCEHINTEXPAND)
+ {
+ SetIgnoreDontExpand( bOldExpFlg );
+ }
// analog zu Insert(char) in txtedt.cxx:
// 1) bei bHintExp leere Hints an rIdx.GetIndex suchen und aufspannen
// 2) bei bHintExp == FALSE mitgezogene Feldattribute zuruecksetzen
- USHORT i;
-
if ( HasHints() )
{
- for ( i = 0; i < m_pSwpHints->Count() &&
+ for ( USHORT i = 0; i < m_pSwpHints->Count() &&
rIdx >= *(*m_pSwpHints)[i]->GetStart(); ++i )
{
- SwTxtAttr *pHt = m_pSwpHints->GetTextHint( i );
- xub_StrLen* pEndIdx = pHt->GetEnd();
+ SwTxtAttr * const pHt = m_pSwpHints->GetTextHint( i );
+ xub_StrLen * const pEndIdx = pHt->GetEnd();
if( !pEndIdx )
continue;
if( rIdx == *pEndIdx )
{
- if( nMode & INS_NOHINTEXPAND || pHt->DontExpand() )
+ if ( (nMode & IDocumentContentOperations::INS_NOHINTEXPAND) ||
+ (!(nMode & IDocumentContentOperations::INS_FORCEHINTEXPAND)
+ && pHt->DontExpand()) )
{
// bei leeren Attributen auch Start veraendern
if( rIdx == *pHt->GetStart() )
*pHt->GetStart() = *pHt->GetStart() - nLen;
*pEndIdx = *pEndIdx - nLen;
m_pSwpHints->DeleteAtPos(i);
- Insert( pHt, nsSetAttrMode::SETATTR_NOHINTADJUST );
+ InsertHint( pHt, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
- // leere Hints an rIdx.GetIndex ?
- else if( nMode & INS_EMPTYEXPAND &&
- *pEndIdx == *pHt->GetStart() )
+ // empty hints at insert position?
+ else if ( (nMode & IDocumentContentOperations::INS_EMPTYEXPAND)
+ && (*pEndIdx == *pHt->GetStart()) )
{
*pHt->GetStart() = *pHt->GetStart() - nLen;
const USHORT nAktLen = m_pSwpHints->Count();
m_pSwpHints->DeleteAtPos(i);
- Insert( pHt/* AUTOSTYLES:, nsSetAttrMode::SETATTR_NOHINTADJUST*/ );
+ InsertHint( pHt/* AUTOSTYLES:, nsSetAttrMode::SETATTR_NOHINTADJUST*/ );
if ( nAktLen > m_pSwpHints->Count() && i )
{
--i;
@@ -1737,14 +1807,14 @@ SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
continue;
}
}
- if ( !(nMode & INS_NOHINTEXPAND) &&
+ if ( !(nMode & IDocumentContentOperations::INS_NOHINTEXPAND) &&
rIdx == nLen && *pHt->GetStart() == rIdx.GetIndex() &&
!pHt->IsDontExpandStartAttr() )
{
// Kein Feld, am Absatzanfang, HintExpand
m_pSwpHints->DeleteAtPos(i);
*pHt->GetStart() = *pHt->GetStart() - nLen;
- Insert( pHt, nsSetAttrMode::SETATTR_NOHINTADJUST );
+ InsertHint( pHt, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
}
TryDeleteSwpHints();
@@ -1761,7 +1831,6 @@ SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
SetCalcHiddenCharFlags();
CHECK_SWPHINTS(this);
- return *this;
}
/*************************************************************************
@@ -1774,32 +1843,41 @@ SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
|*
*************************************************************************/
-void SwTxtNode::Cut( SwTxtNode *pDest, const SwIndex &rStart, xub_StrLen nLen )
+void SwTxtNode::CutText( SwTxtNode * const pDest,
+ const SwIndex & rStart, const xub_StrLen nLen )
{
if(pDest)
{
SwIndex aDestStt( pDest, pDest->GetTxt().Len() );
- _Cut( pDest, aDestStt, rStart, nLen, FALSE );
+ CutImpl( pDest, aDestStt, rStart, nLen, false );
}
else
- Erase( rStart, nLen );
+ {
+ ASSERT(false,
+ "mst: entering dead and bitrotted code; fasten your seatbelts!");
+ EraseText( rStart, nLen );
+ }
}
-void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
- const SwIndex &rStart, xub_StrLen nLen, BOOL bUpdate )
+void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart,
+ const SwIndex & rStart, /*const*/ xub_StrLen nLen, const bool bUpdate )
{
if(!pDest)
{
- Erase( rStart, nLen );
+ ASSERT(false,
+ "mst: entering dead and bitrotted code; fasten your seatbelts!");
+ EraseText( rStart, nLen );
return;
}
// nicht im Dokument verschieben ?
if( GetDoc() != pDest->GetDoc() )
{
- Copy( pDest, rDestStart, rStart, nLen);
- Erase(rStart,nLen);
+ ASSERT(false,
+ "mst: entering dead and bitrotted code; fasten your seatbelts!");
+ CopyText( pDest, rDestStart, rStart, nLen);
+ EraseText(rStart, nLen);
return;
}
@@ -1813,48 +1891,46 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
xub_StrLen nTxtStartIdx = rStart.GetIndex();
xub_StrLen nDestStart = rDestStart.GetIndex(); // alte Pos merken
- xub_StrLen nInitSize = pDest->m_Text.Len();
-
- xub_StrLen *pEndIdx = 0;
- xub_StrLen nAttrStartIdx = 0;
- SwTxtAttr *pHt = 0;
- SwTxtAttr *pNewHt = 0;
+ const xub_StrLen nInitSize = pDest->m_Text.Len();
// wird in sich selbst verschoben, muss es gesondert behandelt werden !!
if( pDest == this )
{
+ ASSERT(false,
+ "mst: entering dead and bitrotted code; fasten your seatbelts!");
m_Text.Insert( m_Text, nTxtStartIdx, nLen, nDestStart );
m_Text.Erase( nTxtStartIdx + (nDestStart<nTxtStartIdx ? nLen : 0), nLen );
- xub_StrLen nEnd = rStart.GetIndex() + nLen;
- USHORT n;
+ const xub_StrLen nEnd = rStart.GetIndex() + nLen;
// 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 ( m_pSwpHints && nAttrCnt < m_pSwpHints->Count() &&
- (nAttrStartIdx = *(pHt = m_pSwpHints->GetTextHint(nAttrCnt))->
- GetStart()) < nEnd )
+ USHORT nAttrCnt = 0;
+ while ( m_pSwpHints && nAttrCnt < m_pSwpHints->Count() )
{
- pNewHt = 0;
- pEndIdx = pHt->GetEnd();
+ SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(nAttrCnt);
+ const xub_StrLen nAttrStartIdx = *pHt->GetStart();
+ if (!( nAttrStartIdx < nEnd ))
+ break;
+ const xub_StrLen * const pEndIdx = pHt->GetEnd();
+ const USHORT nWhich = pHt->Which();
+ SwTxtAttr *pNewHt = 0;
if(nAttrStartIdx < nTxtStartIdx)
{
// Anfang liegt vor dem Bereich
- if( RES_TXTATR_REFMARK != ( nWhich = pHt->Which() ) &&
+ if ( RES_TXTATR_REFMARK != nWhich && !pHt->HasDummyChar() &&
pEndIdx && *pEndIdx > nTxtStartIdx )
{
// Attribut mit einem Bereich
// und das Ende des Attribut liegt im Bereich
- pNewHt = MakeTxtAttr( pHt->GetAttr(), 0,
+ pNewHt = MakeTxtAttr( *GetDoc(), pHt->GetAttr(), 0,
*pEndIdx > nEnd
? nLen
: *pEndIdx - nTxtStartIdx );
@@ -1875,9 +1951,9 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
continue; // while-Schleife weiter, ohne ++ !
}
// das Ende liegt dahinter
- else if( RES_TXTATR_REFMARK != ( nWhich = pHt->Which() ))
+ else if (RES_TXTATR_REFMARK != nWhich && !pHt->HasDummyChar())
{
- pNewHt = MakeTxtAttr( pHt->GetAttr(),
+ pNewHt = MakeTxtAttr( *GetDoc(), pHt->GetAttr(),
nAttrStartIdx - nTxtStartIdx,
!pEndIdx ? 0
: ( *pEndIdx > nEnd
@@ -1895,8 +1971,10 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
}
if( bUpdate )
+ {
// Update aller Indizies
Update( rDestStart, nLen, FALSE, TRUE );
+ }
#ifdef CUTNOEXPAND
else
// wird am Ende eingefuegt, nur die Attribut-Indizies verschieben
@@ -1904,10 +1982,10 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
{
// check if there was the end of an attribute at the insertion
// position: if it is not a field, it must be expanded
- for ( n = 0; n < m_pSwpHints->Count(); n++ )
+ for ( USHORT n = 0; n < m_pSwpHints->Count(); n++ )
{
- pHt = m_pSwpHints->GetTextHint(n);
- pEndIdx = pHt->GetEnd();
+ SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(n);
+ const xub_StrLen * const pEndIdx = pHt->GetEnd();
if ( pEndIdx && (*pEndIdx == nInitSize) )
{
*pEndIdx = *pEndIdx + nLen;
@@ -1923,33 +2001,39 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
// dann setze die kopierten/geloeschten Attribute in den Node
if( nDestStart <= nTxtStartIdx )
+ {
nTxtStartIdx = nTxtStartIdx + nLen;
+ }
else
+ {
nDestStart = nDestStart - nLen;
+ }
- for( n = 0; n < aArr.Count(); ++n )
+ for ( USHORT n = 0; n < aArr.Count(); ++n )
{
- pNewHt = aArr[n];
+ SwTxtAttr *const pNewHt = aArr[n];
*pNewHt->GetStart() = nDestStart + *pNewHt->GetStart();
- if( 0 != ( pEndIdx = pNewHt->GetEnd() ))
+ xub_StrLen * const pEndIdx = pNewHt->GetEnd();
+ if ( pEndIdx )
+ {
*pEndIdx = nDestStart + *pEndIdx;
- Insert( pNewHt, nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ }
+ InsertHint( pNewHt, nsSetAttrMode::SETATTR_NOTXTATRCHR );
}
}
else
{
- xub_StrLen i = nInitSize - nDestStart;
pDest->m_Text.Insert( m_Text, nTxtStartIdx, nLen, nDestStart );
m_Text.Erase( nTxtStartIdx, nLen );
- nLen = pDest->m_Text.Len() - nDestStart - i; // update w/ current size!
+ nLen = pDest->m_Text.Len() - nInitSize; // update w/ current size!
if( !nLen ) // String nicht gewachsen ??
return;
- i = 0;
-
if( bUpdate )
+ {
// Update aller Indizies
pDest->Update( rDestStart, nLen, FALSE, TRUE);
+ }
#ifdef CUTNOEXPAND
else
// wird am Ende eingefuegt, nur die Attribut-Indizies verschieben
@@ -1959,8 +2043,8 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
// position: if it is not a field, it must be expanded
for ( USHORT n = 0; n < pDest->m_pSwpHints->Count(); n++ )
{
- pHt = pDest->m_pSwpHints->GetTextHint(n);
- pEndIdx = pHt->GetEnd();
+ SwTxtAttr * const pHt = pDest->m_pSwpHints->GetTextHint(n);
+ const xub_StrLen * const pEndIdx = pHt->GetEnd();
if ( pEndIdx && (*pEndIdx == nInitSize) )
{
*pEndIdx = *pEndIdx + nLen;
@@ -1970,11 +2054,14 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
#endif
CHECK_SWPHINTS(pDest);
- USHORT nEnd = rStart.GetIndex() + nLen;
- SwDoc* pOtherDoc = pDest->GetDoc();
- if( pOtherDoc == GetDoc() )
- pOtherDoc = 0;
- const BOOL bUndoNodes = !pOtherDoc && GetDoc()->GetUndoNds() == &GetNodes();
+ const xub_StrLen nEnd = rStart.GetIndex() + nLen;
+ SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc())
+ ? pDest->GetDoc() : 0;
+ const bool bUndoNodes =
+ !pOtherDoc && GetDoc()->GetUndoNds() == &GetNodes();
+
+ ASSERT(!pOtherDoc,
+ "mst: entering dead and bitrotted code; fasten your seatbelts!");
// harte Absatz umspannende Attribute kopieren
if( HasSwAttrSet() )
@@ -1985,8 +2072,8 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
{
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_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0 );
aCharSet.Put( *GetpSwAttrSet() );
@@ -1994,30 +2081,37 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
pDest->SetAttr( aCharSet, nDestStart, nDestStart + nLen );
}
else
+ {
GetpSwAttrSet()->CopyToModify( *pDest );
+ }
}
// 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 ( m_pSwpHints && nAttrCnt < m_pSwpHints->Count() &&
- ( (nAttrStartIdx = *(pHt = m_pSwpHints->GetTextHint(nAttrCnt))->
- GetStart()) < nEnd ) )
+ USHORT nAttrCnt = 0;
+ while ( m_pSwpHints && (nAttrCnt < m_pSwpHints->Count()) )
{
- pNewHt = 0;
- pEndIdx = pHt->GetEnd();
+ SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(nAttrCnt);
+ const xub_StrLen nAttrStartIdx = *pHt->GetStart();
+ if (!( nAttrStartIdx < nEnd ))
+ break;
+ const xub_StrLen * const pEndIdx = pHt->GetEnd();
+ const USHORT nWhich = pHt->Which();
+ SwTxtAttr *pNewHt = 0;
+ // if the hint has a dummy character, then it must not be split!
if(nAttrStartIdx < nTxtStartIdx)
{
// Anfang liegt vor dem Bereich
- if( ( RES_TXTATR_REFMARK != ( nWhich = pHt->Which() )
+ if( !pHt->HasDummyChar() && ( RES_TXTATR_REFMARK != nWhich
|| bUndoNodes ) && pEndIdx && *pEndIdx > nTxtStartIdx )
{
// Attribut mit einem Bereich
// und das Ende des Attribut liegt im Bereich
- pNewHt = pDest->MakeTxtAttr( pHt->GetAttr(), nDestStart,
- nDestStart + (
+ pNewHt = MakeTxtAttr( *pDest->GetDoc(), pHt->GetAttr(),
+ nDestStart,
+ nDestStart + (
*pEndIdx > nEnd
? nLen
: *pEndIdx - nTxtStartIdx ) );
@@ -2026,33 +2120,40 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
else
{
// der Anfang liegt vollstaendig im Bereich
- nWhich = pHt->Which();
if( !pEndIdx || *pEndIdx < nEnd ||
- ( !pOtherDoc && !bUndoNodes && RES_TXTATR_REFMARK
- == nWhich ) )
+ (!pOtherDoc && !bUndoNodes && RES_TXTATR_REFMARK == nWhich)
+ || pHt->HasDummyChar() )
{
// do not delete note and later add it -> sidebar flickering
if ( GetDoc()->GetDocShell() )
+ {
GetDoc()->GetDocShell()->Broadcast( SfxSimpleHint(SFX_HINT_USER04));
+ }
// Attribut verschieben
m_pSwpHints->Delete( pHt );
// die Start/End Indicies neu setzen
*pHt->GetStart() =
nDestStart + (nAttrStartIdx - nTxtStartIdx);
if( pEndIdx )
+ {
*pHt->GetEnd() = nDestStart + (
*pEndIdx > nEnd
? nLen
: *pEndIdx - nTxtStartIdx );
- pDest->Insert( pHt, nsSetAttrMode::SETATTR_NOTXTATRCHR | nsSetAttrMode::SETATTR_DONTREPLACE );
+ }
+ pDest->InsertHint( pHt,
+ nsSetAttrMode::SETATTR_NOTXTATRCHR
+ | nsSetAttrMode::SETATTR_DONTREPLACE );
if ( GetDoc()->GetDocShell() )
+ {
GetDoc()->GetDocShell()->Broadcast( SfxSimpleHint(SFX_HINT_USER04));
+ }
continue; // while-Schleife weiter, ohne ++ !
}
// das Ende liegt dahinter
else if( RES_TXTATR_REFMARK != nWhich || bUndoNodes )
{
- pNewHt = MakeTxtAttr( pHt->GetAttr(),
+ pNewHt = MakeTxtAttr( *GetDoc(), pHt->GetAttr(),
nDestStart + (nAttrStartIdx - nTxtStartIdx),
!pEndIdx ? 0
: nDestStart + ( *pEndIdx > nEnd
@@ -2062,8 +2163,13 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
}
if ( pNewHt )
{
- if( pDest->Insert( pNewHt, nsSetAttrMode::SETATTR_NOTXTATRCHR | nsSetAttrMode::SETATTR_DONTREPLACE ))
+ const bool bSuccess( pDest->InsertHint( pNewHt,
+ nsSetAttrMode::SETATTR_NOTXTATRCHR
+ | nsSetAttrMode::SETATTR_DONTREPLACE ) );
+ if (bSuccess)
+ {
lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
+ }
}
++nAttrCnt;
}
@@ -2074,29 +2180,35 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
if( m_pSwpHints && nAttrCnt < m_pSwpHints->Count() )
{
SwpHts aArr( 5 );
- for ( ; nAttrCnt < m_pSwpHints->Count() &&
- nEnd == *(pHt = m_pSwpHints->GetTextHint(nAttrCnt))->GetStart();
- ++nAttrCnt )
+ while ( nAttrCnt < m_pSwpHints->Count() )
{
- pEndIdx = pHt->GetEnd();
+ SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(nAttrCnt);
+ if ( nEnd != *pHt->GetStart() )
+ break;
+ const xub_StrLen * const pEndIdx = pHt->GetEnd();
if ( pEndIdx && *pEndIdx == nEnd )
{
aArr.C40_INSERT( SwTxtAttr, pHt, aArr.Count() );
m_pSwpHints->Delete( pHt );
- --nAttrCnt;
+ }
+ else
+ {
+ ++nAttrCnt;
}
}
Update( rStart, nLen, TRUE, TRUE );
- for( nAttrCnt = 0; nAttrCnt < aArr.Count(); ++nAttrCnt )
+ for ( USHORT n = 0; n < aArr.Count(); ++n )
{
- pHt = aArr[ nAttrCnt ];
+ SwTxtAttr * const pHt = aArr[ n ];
*pHt->GetStart() = *pHt->GetEnd() = rStart.GetIndex();
- Insert( pHt );
+ InsertHint( pHt );
}
}
else
+ {
Update( rStart, nLen, TRUE, TRUE );
+ }
CHECK_SWPHINTS(this);
}
@@ -2111,98 +2223,112 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
}
-SwTxtNode& SwTxtNode::Erase(const SwIndex &rIdx, xub_StrLen nCount,
- const USHORT nMode )
+void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount,
+ const IDocumentContentOperations::InsertFlags nMode )
{
- ASSERT( rIdx <= m_Text.Len(), "SwTxtNode::Erase: invalid index." );
+ ASSERT( rIdx <= m_Text.Len(), "SwTxtNode::EraseText: invalid index." );
- const xub_StrLen nCnt = STRING_LEN == nCount
- ? m_Text.Len() - rIdx.GetIndex() : nCount;
- m_Text.Erase( rIdx.GetIndex(), nCnt );
+ const xub_StrLen nStartIdx = rIdx.GetIndex();
+ const xub_StrLen nCnt = (STRING_LEN == nCount)
+ ? m_Text.Len() - nStartIdx : nCount;
+ const xub_StrLen nEndIdx = nStartIdx + nCnt;
+ m_Text.Erase( nStartIdx, nCnt );
/* GCAttr(); alle leeren weggwerfen ist zu brutal.
* Es duerfen nur die wegggeworfen werden,
* die im Bereich liegen und nicht am Ende des Bereiches liegen
*/
- // check m_pSwpHints because fields and FlyFrames delete text (recursion!)
for ( USHORT i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
SwTxtAttr *pHt = m_pSwpHints->GetTextHint(i);
- const xub_StrLen nHtStt = *pHt->GetStart();
+ const xub_StrLen nHintStart = *pHt->GetStart();
- if( nHtStt < rIdx.GetIndex() )
+ if ( nHintStart < nStartIdx )
continue;
- // TextFelder und FlyFrames loeschen Text (Rekursion)!!
- const xub_StrLen nEndIdx = rIdx.GetIndex() + nCnt;
- if( nHtStt > nEndIdx )
- // die Hints sind nach Ende sortiert, also ist Start
- // vom Hint groesser als EndIdx dann Abbrechen
- break;
+ if ( nHintStart > nEndIdx )
+ break; // hints are sorted by end, so break here
const xub_StrLen* pHtEndIdx = pHt->GetEnd();
const USHORT nWhich = pHt->Which();
if( !pHtEndIdx )
{
+ ASSERT(pHt->HasDummyChar(),
+ "attribute with neither end nor CH_TXTATR?");
if (isTXTATR(nWhich) &&
- (nHtStt >= rIdx.GetIndex()) && (nHtStt < nEndIdx))
+ (nHintStart >= nStartIdx) && (nHintStart < nEndIdx))
{
m_pSwpHints->DeleteAtPos(i);
- // Damit im Dtor der TxtAttr ohne End die CH_TXTATR nicht
- // geloescht werden...
- *(pHt->GetStart()) = USHRT_MAX;
DestroyAttr( pHt );
--i;
}
continue;
}
+ ASSERT (!( (nHintStart < nEndIdx) && (*pHtEndIdx > nEndIdx)
+ && pHt->HasDummyChar() )
+ // next line: deleting exactly dummy char: DeleteAttributes
+ || ((nHintStart == nStartIdx) && (nHintStart + 1 == nEndIdx)),
+ "ERROR: deleting left-overlapped attribute with CH_TXTATR");
+
// Delete the hint if:
// 1. The hint ends before the deletion end position or
// 2. The hint ends at the deletion end position and
// we are not in empty expand mode and
// the hint is a [toxmark|refmark|ruby] text attribute
- if( *pHtEndIdx >= nEndIdx &&
- !(
- *pHtEndIdx == nEndIdx &&
- !(INS_EMPTYEXPAND & nMode) &&
- (nWhich == RES_TXTATR_TOXMARK || nWhich == RES_TXTATR_REFMARK ||
- // --> FME 2006-03-03 #i62668# Ruby text attribute has to be treated
- // just like toxmark and refmarks
- nWhich == RES_TXTATR_CJK_RUBY) )
+ // 3. deleting exactly the dummy char of an hint with end and dummy
+ // char deletes the hint
+ if ( (*pHtEndIdx < nEndIdx)
+ || ( (*pHtEndIdx == nEndIdx) &&
+ !(IDocumentContentOperations::INS_EMPTYEXPAND & nMode) &&
+ ( (RES_TXTATR_TOXMARK == nWhich) ||
+ (RES_TXTATR_REFMARK == nWhich) ||
+ // --> FME 2006-03-03 #i62668# Ruby text attribute must be
+ // treated just like toxmark and refmarks
+ (RES_TXTATR_CJK_RUBY == nWhich) ) )
// <--
- )
- continue;
-
- m_pSwpHints->DeleteAtPos(i);
- DestroyAttr( pHt );
- --i;
+#if 0
+ || ( (nHintStart == nStartIdx) &&
+ (nHintStart + 1 == nEndIdx)&&
+#else // generalize this to left-overlapped dummy char hints (see ASSERT)
+ || ( (nHintStart < nEndIdx) &&
+#endif
+ pHt->HasDummyChar() )
+ )
+ {
+ m_pSwpHints->DeleteAtPos(i);
+ DestroyAttr( pHt );
+ --i;
+ }
}
+ ASSERT(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?");
+
TryDeleteSwpHints();
Update( rIdx, nCnt, TRUE );
if( 1 == nCnt )
{
- SwDelChr aHint( rIdx.GetIndex() );
+ SwDelChr aHint( nStartIdx );
SwModify::Modify( 0, &aHint );
}
else
{
- SwDelTxt aHint( rIdx.GetIndex(), nCnt );
+ SwDelTxt aHint( nStartIdx, nCnt );
SwModify::Modify( 0, &aHint );
}
+ ASSERT(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?");
+
// By deleting a character, the hidden flags
// at the TxtNode can become invalid:
SetCalcHiddenCharFlags();
CHECK_SWPHINTS(this);
- return *this;
}
/***********************************************************************
@@ -2221,9 +2347,7 @@ void SwTxtNode::GCAttr()
if ( !HasHints() )
return;
- const SwTxtAttr *pHt = 0;
- const xub_StrLen *pEndIdx = 0;
- BOOL bChanged = FALSE;
+ bool bChanged = false;
USHORT nMin = m_Text.Len(),
nMax = 0;
BOOL bAll = nMin != 0; // Bei leeren Absaetzen werden nur die
@@ -2231,21 +2355,23 @@ void SwTxtNode::GCAttr()
for ( USHORT i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
- pHt = (*m_pSwpHints)[i];
+ SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(i);
// wenn Ende und Start gleich sind --> loeschen
- pEndIdx = pHt->GetEnd();
- if( pEndIdx && (*pEndIdx == *pHt->GetStart())
+ const xub_StrLen * const pEndIdx = pHt->GetEnd();
+ if (pEndIdx && !pHt->HasDummyChar() && (*pEndIdx == *pHt->GetStart())
&& ( bAll || pHt->Which() == RES_TXTATR_INETFMT ) )
{
- bChanged = TRUE;
+ bChanged = true;
nMin = Min( nMin, *pHt->GetStart() );
nMax = Max( nMax, *pHt->GetEnd() );
DestroyAttr( m_pSwpHints->Cut(i) );
--i;
}
else
- ((SwTxtAttr*)pHt)->SetDontExpand( FALSE );
+ {
+ pHt->SetDontExpand( false );
+ }
}
TryDeleteSwpHints();
@@ -2258,6 +2384,7 @@ void SwTxtNode::GCAttr()
SwModify::Modify( 0, &aNew );
}
}
+
// #i23726#
SwNumRule* SwTxtNode::_GetNumRule(BOOL bInParent) const
{
@@ -2600,30 +2727,25 @@ SwCntntNode* SwTxtNode::AppendNode( const SwPosition & rPos )
/*************************************************************************
* 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.
*************************************************************************/
-SwTxtAttr *SwTxtNode::GetTxtAttr( const xub_StrLen nIdx,
- const USHORT nWhichHt ) const
+SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt( const xub_StrLen nIndex,
+ const RES_TXTATR nWhich ) const
{
if ( HasHints() )
{
for ( USHORT i = 0; i < m_pSwpHints->Count(); ++i )
{
- SwTxtAttr *pPos = m_pSwpHints->GetTextHint(i);
- const xub_StrLen nStartPos = *pPos->GetStart();
- if( nIdx < nStartPos )
+ SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(i);
+ const xub_StrLen nStartPos = *pHint->GetStart();
+ if ( nIndex < nStartPos )
+ {
return 0;
- if( nIdx == nStartPos && !pPos->GetEnd() )
+ }
+ if ( (nIndex == nStartPos) && pHint->HasDummyChar() )
{
- if( RES_TXTATR_END == nWhichHt || nWhichHt == pPos->Which() )
- return pPos;
- else
- return 0;
+ return ( RES_TXTATR_END == nWhich || nWhich == pHint->Which() )
+ ? pHint : 0;
}
}
}
@@ -2835,7 +2957,8 @@ void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt,
xub_StrLen nPos = rTxt.Search( cSrchChr );
while( STRING_NOTFOUND != nPos && nPos < nEndPos )
{
- const SwTxtAttr* pAttr = GetTxtAttr( rTxtStt + nPos );
+ const SwTxtAttr* const pAttr =
+ GetTxtAttrForCharAt( rTxtStt + nPos );
if( pAttr )
{
switch( pAttr->Which() )
@@ -2853,11 +2976,6 @@ void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt,
}
++rTxtStt;
break;
- case RES_TXTATR_HARDBLANK:
- rTxt.SetChar( nPos, ((SwTxtHardBlank*)pAttr)->GetChar() );
- ++nPos;
- ++nEndPos;
- break;
case RES_TXTATR_FTN:
rTxt.Erase( nPos, 1 );
if( bExpandFlds )
@@ -2959,7 +3077,7 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
SwScriptInfo::MaskHiddenRanges( *this, sTmpText, 0, sTmpText.Len(), cChar );
sTmpText = sTmpText.Copy( nIdx, nLen );
- rDestNd.Insert( sTmpText, aDestIdx );
+ rDestNd.InsertText( sTmpText, aDestIdx );
nLen = aDestIdx.GetIndex() - nDestStt;
// alle FontAttribute mit CHARSET Symbol in dem Bereich setzen
@@ -2969,25 +3087,28 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
for ( USHORT i = 0; i < m_pSwpHints->Count(); i++ )
{
const SwTxtAttr* pHt = (*m_pSwpHints)[i];
- xub_StrLen nAttrStartIdx;
- USHORT nWhich = pHt->Which();
- if( nIdx + nLen <= ( nAttrStartIdx = *pHt->GetStart() ) )
+ const xub_StrLen nAttrStartIdx = *pHt->GetStart();
+ const USHORT nWhich = pHt->Which();
+ if (nIdx + nLen <= nAttrStartIdx)
break; // ueber das Textende
- const SvxFontItem* pFont;
const xub_StrLen *pEndIdx = pHt->GetEnd();
if( pEndIdx && *pEndIdx > nIdx &&
( RES_CHRATR_FONT == nWhich ||
RES_TXTATR_CHARFMT == nWhich ||
- RES_TXTATR_AUTOFMT == nWhich ) &&
- 0 != ( pFont = static_cast<const SvxFontItem*>(CharFmt::GetItem( *pHt, RES_CHRATR_FONT )) ) &&
- RTL_TEXTENCODING_SYMBOL == pFont->GetCharSet() )
+ RES_TXTATR_AUTOFMT == nWhich ))
{
- // Attribut liegt im Bereich, also kopieren
- rDestNd.InsertItem( *pFont, nInsPos + nAttrStartIdx,
- nInsPos + *pEndIdx );
+ const SvxFontItem* const pFont =
+ static_cast<const SvxFontItem*>(
+ CharFmt::GetItem( *pHt, RES_CHRATR_FONT ));
+ if ( pFont && RTL_TEXTENCODING_SYMBOL == pFont->GetCharSet() )
+ {
+ // attribute in area => copy
+ rDestNd.InsertItem( *const_cast<SvxFontItem*>(pFont),
+ nInsPos + nAttrStartIdx, nInsPos + *pEndIdx );
+ }
}
- else if( !pEndIdx && nAttrStartIdx >= nIdx )
+ else if ( pHt->HasDummyChar() && (nAttrStartIdx >= nIdx) )
{
aDestIdx = nInsPos + nAttrStartIdx;
switch( nWhich )
@@ -2998,20 +3119,15 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
if( aExpand.Len() )
{
aDestIdx++; // dahinter einfuegen;
- rDestNd.Insert( aExpand, aDestIdx );
+ rDestNd.InsertText( aExpand, aDestIdx );
aDestIdx = nInsPos + nAttrStartIdx;
nInsPos = nInsPos + aExpand.Len();
}
- rDestNd.Erase( aDestIdx, 1 );
+ rDestNd.EraseText( aDestIdx, 1 );
--nInsPos;
}
break;
- case RES_TXTATR_HARDBLANK:
- rDestNd.m_Text.SetChar( nInsPos + nAttrStartIdx,
- ((SwTxtHardBlank*)pHt)->GetChar() );
- break;
-
case RES_TXTATR_FTN:
{
if ( bWithFtn )
@@ -3028,23 +3144,25 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
GetNumStr( rFtn.GetNumber() );
if( sExpand.Len() )
{
- aDestIdx++; // dahinter einfuegen;
- rDestNd.InsertItem( SvxEscapementItem(
- SVX_ESCAPEMENT_SUPERSCRIPT ),
+ aDestIdx++; // insert behind
+ SvxEscapementItem aItem(
+ SVX_ESCAPEMENT_SUPERSCRIPT );
+ rDestNd.InsertItem(aItem,
aDestIdx.GetIndex(),
aDestIdx.GetIndex() );
- rDestNd.Insert( sExpand, aDestIdx, INS_EMPTYEXPAND );
+ rDestNd.InsertText( sExpand, aDestIdx,
+ IDocumentContentOperations::INS_EMPTYEXPAND);
aDestIdx = nInsPos + nAttrStartIdx;
nInsPos = nInsPos + sExpand.Len();
}
}
- rDestNd.Erase( aDestIdx, 1 );
+ rDestNd.EraseText( aDestIdx, 1 );
--nInsPos;
}
break;
default:
- rDestNd.Erase( aDestIdx, 1 );
+ rDestNd.EraseText( aDestIdx, 1 );
--nInsPos;
}
}
@@ -3054,7 +3172,7 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
if( bWithNum )
{
aDestIdx = nDestStt;
- rDestNd.Insert( GetNumString(), aDestIdx );
+ rDestNd.InsertText( GetNumString(), aDestIdx );
}
if ( nHiddenChrs > 0 )
@@ -3068,7 +3186,7 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
while ( nIndex < rDestNd.GetTxt().Len() &&
cChar == rDestNd.GetTxt().GetChar( ++nIndex ) )
;
- rDestNd.Erase( aDestIdx, nIndex - aDestIdx.GetIndex() );
+ rDestNd.EraseText( aDestIdx, nIndex - aDestIdx.GetIndex() );
}
else
++aDestIdx;
@@ -3188,55 +3306,35 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen,
}
/*************************************************************************
- * SwTxtNode::GetExpandTxt
+ * SwTxtNode::ReplaceText
*************************************************************************/
-// Felder werden expandiert:
-
-void SwTxtNode::Replace( const SwIndex& rStart, xub_Unicode cCh )
-{
- ASSERT( rStart.GetIndex() < m_Text.Len(),
- "SwTxtNode::Replace: invalid index." );
-
- SwTxtAttr* pHt;
- if ( ( CH_TXTATR_BREAKWORD == m_Text.GetChar( rStart.GetIndex() ) ||
- CH_TXTATR_INWORD == m_Text.GetChar( rStart.GetIndex() )) &&
- 0 != ( pHt = GetTxtAttr( rStart.GetIndex() ) ))
- {
- Delete( pHt );
- m_Text.Insert( cCh, rStart.GetIndex() );
- }
- else
- {
- m_Text.SetChar( rStart.GetIndex(), cCh );
- }
-
- SwDelTxt aDelHint( rStart.GetIndex(), 1 );
- SwModify::Modify( 0, &aDelHint );
-
- SwInsTxt aHint( rStart.GetIndex(), 1 );
- SwModify::Modify( 0, &aHint );
-}
-
-void SwTxtNode::Replace( const SwIndex& rStart, xub_StrLen nLen,
- const XubString& rText )
+void SwTxtNode::ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen,
+ const XubString& rText )
{
ASSERT( rStart.GetIndex() < m_Text.Len() &&
- rStart.GetIndex() + nLen <= m_Text.Len(),
- "ausserhalb des Strings" );
- SwTxtAttr* pHt;
+ rStart.GetIndex() + nDelLen <= m_Text.Len(),
+ "SwTxtNode::ReplaceText: index out of bounds" );
const xub_StrLen nStartPos = rStart.GetIndex();
- xub_StrLen nEnde = nStartPos + nLen;
- xub_StrLen nDelLen = nLen;
- for( xub_StrLen nPos = nStartPos; nPos < nEnde; ++nPos )
+ xub_StrLen nEndPos = nStartPos + nDelLen;
+ xub_StrLen nLen = nDelLen;
+ for ( xub_StrLen nPos = nStartPos; nPos < nEndPos; ++nPos )
{
- if ( ( CH_TXTATR_BREAKWORD == m_Text.GetChar( nPos ) ||
- CH_TXTATR_INWORD == m_Text.GetChar( nPos )) &&
- 0 != ( pHt = GetTxtAttr( nPos ) ))
+ if ( ( CH_TXTATR_BREAKWORD == m_Text.GetChar( nPos ) ) ||
+ ( CH_TXTATR_INWORD == m_Text.GetChar( nPos ) ) )
{
- Delete( pHt );
- --nEnde;
- --nLen;
+ SwTxtAttr *const pHint = GetTxtAttrForCharAt( nPos );
+ if (pHint)
+ {
+ ASSERT (!( pHint->GetEnd() && pHint->HasDummyChar()
+ && (*pHint->GetStart() < nEndPos)
+ && (*pHint->GetEnd() > nEndPos) ),
+ "ReplaceText: ERROR: "
+ "deleting left-overlapped attribute with CH_TXTATR");
+ DeleteAttribute( pHint );
+ --nEndPos;
+ --nLen;
+ }
}
}
@@ -3251,20 +3349,21 @@ void SwTxtNode::Replace( const SwIndex& rStart, xub_StrLen nLen,
((SwIndex&)rStart)++;
m_Text.Erase( rStart.GetIndex(), nLen - 1 );
- Update( rStart, nLen - 1, TRUE );
+ Update( rStart, nLen - 1, true );
XubString aTmpTxt( rText ); aTmpTxt.Erase( 0, 1 );
m_Text.Insert( aTmpTxt, rStart.GetIndex() );
- Update( rStart, aTmpTxt.Len(), FALSE );
+ Update( rStart, aTmpTxt.Len(), false );
}
else
{
m_Text.Erase( nStartPos, nLen );
- Update( rStart, nLen, TRUE );
+ Update( rStart, nLen, true );
m_Text.Insert( rText, nStartPos );
- Update( rStart, rText.Len(), FALSE );
+ Update( rStart, rText.Len(), false );
}
+
SetIgnoreDontExpand( bOldExpFlg );
SwDelTxt aDelHint( nStartPos, nDelLen );
SwModify::Modify( 0, &aDelHint );
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index c70d8aaa4a14..3c2a643099cb 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -445,7 +445,9 @@ SwFont::SwFont( const SwFont &rFont )
pBackColor = rFont.pBackColor ? new Color( *rFont.pBackColor ) : NULL;
aUnderColor = rFont.GetUnderColor();
aOverColor = rFont.GetOverColor();
- nToxCnt = nRefCnt = 0;
+ nToxCnt = 0;
+ nRefCnt = 0;
+ m_nMetaCount = 0;
bFntChg = rFont.bFntChg;
bOrgChg = rFont.bOrgChg;
bPaintBlank = rFont.bPaintBlank;
@@ -461,7 +463,9 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
const IDocumentSettingAccess* pIDocumentSettingAccess )
{
nActual = SW_LATIN;
- nToxCnt = nRefCnt = 0;
+ nToxCnt = 0;
+ nRefCnt = 0;
+ m_nMetaCount = 0;
bPaintBlank = FALSE;
bPaintWrong = FALSE;
bURL = FALSE;
@@ -590,7 +594,9 @@ SwFont& SwFont::operator=( const SwFont &rFont )
pBackColor = rFont.pBackColor ? new Color( *rFont.pBackColor ) : NULL;
aUnderColor = rFont.GetUnderColor();
aOverColor = rFont.GetOverColor();
- nToxCnt = nRefCnt = 0;
+ nToxCnt = 0;
+ nRefCnt = 0;
+ m_nMetaCount = 0;
bFntChg = rFont.bFntChg;
bOrgChg = rFont.bOrgChg;
bPaintBlank = rFont.bPaintBlank;
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 1b5fc81d366f..12f8e210e7c5 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -65,6 +65,7 @@
#include <frmfmt.hxx>
#include <ftnidx.hxx>
#include <fmtruby.hxx>
+#include <fmtmeta.hxx>
#include <breakit.hxx>
#include <doc.hxx>
#include <errhdl.hxx>
@@ -107,142 +108,497 @@ SwpHints::SwpHints()
{
}
+struct TxtAttrDeleter
+{
+ SwAttrPool & m_rPool;
+ TxtAttrDeleter( SwDoc & rDoc ) : m_rPool( rDoc.GetAttrPool() ) { }
+ void operator() (SwTxtAttr * const pAttr)
+ {
+ SwTxtAttr::Destroy( pAttr, m_rPool );
+ }
+};
-// This function takes care for the following text attribute:
-// RES_TXTATR_CHARFMT, RES_TXTATR_INETFMT, RES_TXTATR_AUTOFMT, and
-// RES_TXTATR_CJK_RUBY. These attributes have to be handled in a
-// special way (Portion building).
-// 1. New attribute is RES_TXTATR_AUTOFMT or RES_TXTATR_CHARFMT:
-// The new attribute will be split by any existing RES_TXTATR_AUTOFMT,
-// RES_TXTATR_CHARFMT or RES_TXTATR_INETFMT. The new attribute itself will
-// split any existing RES_TXTATR_AUTOFMT or RES_TXTATR_CHARFMT.
-// 2. New attribute is RES_TXTATR_INETFMT:
-// The new attribute will split any existing RES_TXTATR_AUTOFMT or RES_TXTATR_CHARFMT.
-// The new attribute will suppress any existing RES_TXTATR_INETFMT.
-// 3. New attribute is RES_TXTATR_CJK_RUBY:
-// The new attribute will suppress any existing RES_TXTATR_CJK_RUBY.
+struct TxtAttrContains
+{
+ xub_StrLen m_nPos;
+ TxtAttrContains( const xub_StrLen nPos ) : m_nPos( nPos ) { }
+ bool operator() (SwTxtAttrEnd * const pAttr)
+ {
+ return (*pAttr->GetStart() < m_nPos) && (m_nPos < *pAttr->GetEnd());
+ }
+};
-void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMode )
+// a: |-----|
+// b:
+// |---| => valid: b before a
+// |-----| => valid: start == end; b before a
+// |---------| => invalid: overlap (1)
+// |-----------| => valid: same end; b around a
+// |-----------------| => valid: b around a
+// |---| => valid; same start; b within a
+// |-----| => valid; same start and end; b around or within a?
+// |-----------| => valid: same start: b around a
+// |-| => valid: b within a
+// |---| => valid: same end; b within a
+// |---------| => invalid: overlap (2)
+// |-----| => valid: end == start; b after a
+// |---| => valid: b after a
+// ===> 2 invalid overlap cases
+static
+bool isOverlap(const xub_StrLen nStart1, const xub_StrLen nEnd1,
+ const xub_StrLen nStart2, const xub_StrLen nEnd2)
{
- ASSERT( RES_TXTATR_CHARFMT == rNewHint.Which() ||
- RES_TXTATR_INETFMT == rNewHint.Which() ||
- RES_TXTATR_AUTOFMT == rNewHint.Which() ||
- RES_TXTATR_CJK_RUBY == rNewHint.Which(),
- "Expecting CHARFMT or AUTOFMT or INETFMT or RUBY" )
+ return
+ ((nStart1 > nStart2) && (nStart1 < nEnd2) && (nEnd1 > nEnd2)) // (1)
+ || ((nStart1 < nStart2) && (nStart2 < nEnd1) && (nEnd1 < nEnd2)); // (2)
+}
- const USHORT nWhich = rNewHint.Which();
+static
+bool isNestedAny(const xub_StrLen nStart1, const xub_StrLen nEnd1,
+ const xub_StrLen nStart2, const xub_StrLen nEnd2)
+{
+ return (nStart1 == nStart2) // in this case ends do not matter
+ || ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2));
+}
- const xub_StrLen nThisStart = *rNewHint.GetStart();
- const xub_StrLen nThisEnd = *rNewHint.GetEnd();
- const bool bNoLengthAttribute = nThisStart == nThisEnd;
+static
+bool isSelfNestable(const USHORT nWhich)
+{
+ if ((RES_TXTATR_INETFMT == nWhich) ||
+ (RES_TXTATR_CJK_RUBY == nWhich))
+ return false;
+ ASSERT((RES_TXTATR_META == nWhich) ||
+ (RES_TXTATR_METAFIELD == nWhich), "???");
+ return true;
+}
- std::vector<SwTxtAttr*> aInsDelHints;
- std::vector<SwTxtAttr*>::iterator aIter;
+static
+bool isSplittable(const USHORT nWhich)
+{
+ if ((RES_TXTATR_INETFMT == nWhich) ||
+ (RES_TXTATR_CJK_RUBY == nWhich))
+ return true;
+ ASSERT((RES_TXTATR_META == nWhich) ||
+ (RES_TXTATR_METAFIELD == nWhich), "???");
+ return false;
+}
- //
- // 1. Some attributes are not allowed to overlap.
- // They should displace attributes of the same kind.
- // This is a special case for RES_TXTATR_INETFMT and
- // RES_TXTATR_CJK_RUBY.
- //
- if ( RES_TXTATR_INETFMT == nWhich || RES_TXTATR_CJK_RUBY == nWhich )
+enum Split_t { FAIL, SPLIT_NEW, SPLIT_OTHER };
+/**
+ Calculate splitting policy for overlapping hints, based on what kind of
+ hint is inserted, and what kind of existing hint overlaps.
+ */
+static Split_t
+splitPolicy(const USHORT nWhichNew, const USHORT nWhichOther)
+{
+ if (!isSplittable(nWhichOther))
{
- for ( USHORT i = 0; i < Count(); ++i )
+ if (!isSplittable(nWhichNew))
+ return FAIL;
+ else
+ return SPLIT_NEW;
+ }
+ else
+ {
+ if ((RES_TXTATR_INETFMT == nWhichNew) &&
+ (RES_TXTATR_CJK_RUBY == nWhichOther))
+ return SPLIT_NEW;
+ else
+ return SPLIT_OTHER;
+ }
+}
+
+static void
+lcl_InitINetFmt(SwTxtNode & rNode, SwTxtINetFmt * pNew)
+{
+ pNew->ChgTxtNode(&rNode);
+ SwCharFmt * const pFmt(
+ rNode.GetDoc()->GetCharFmtFromPool(RES_POOLCHR_INET_NORMAL) );
+ pFmt->Add( pNew );
+}
+
+static void
+lcl_InitRuby(SwTxtNode & rNode, SwTxtRuby * pNew)
+{
+ pNew->ChgTxtNode(&rNode);
+ SwCharFmt * const pFmt(
+ rNode.GetDoc()->GetCharFmtFromPool(RES_POOLCHR_RUBYTEXT) );
+ pFmt->Add( pNew );
+}
+
+/**
+ Create a new nesting text hint.
+ */
+static SwTxtAttrNesting *
+MakeTxtAttrNesting(SwTxtNode & rNode, SwTxtAttrNesting & rNesting,
+ const xub_StrLen nStart, const xub_StrLen nEnd)
+{
+ SwTxtAttr * const pNew( MakeTxtAttr(
+ *rNode.GetDoc(), rNesting.GetAttr(), nStart, nEnd ) );
+ switch (pNew->Which())
+ {
+ case RES_TXTATR_INETFMT:
{
- SwTxtAttr* pOther = GetTextHint(i);
+ lcl_InitINetFmt(rNode, static_cast<SwTxtINetFmt*>(pNew));
+ break;
+ }
+ case RES_TXTATR_CJK_RUBY:
+ {
+ lcl_InitRuby(rNode, static_cast<SwTxtRuby*>(pNew));
+ break;
+ }
+ default:
+ ASSERT(false, "MakeTxtAttrNesting: what the hell is that?");
+ break;
+ }
+ return static_cast<SwTxtAttrNesting*>(pNew);
+}
- if ( nWhich == pOther->Which() )
- {
- xub_StrLen nOtherStart = *pOther->GetStart();
- const xub_StrLen nOtherEnd = *pOther->GetEnd();
+typedef ::std::vector<SwTxtAttrNesting *> NestList_t;
- // Check if start of new attribute overlaps with pOther.
- // Split pOther if necessary:
- if ( nOtherStart < nThisStart && nThisStart < nOtherEnd )
- {
- SwTxtAttr* pNewAttr = rNode.MakeTxtAttr( pOther->GetAttr(), nOtherStart, nThisStart );
- aInsDelHints.push_back( pNewAttr );
+static void
+lcl_DoSplitNew(NestList_t & rSplits, SwTxtNode & rNode,
+ const xub_StrLen nNewStart,
+ const xub_StrLen nOtherStart, const xub_StrLen nOtherEnd, bool bOtherDummy)
+{
+ const bool bSplitAtStart(nNewStart < nOtherStart);
+ const xub_StrLen nSplitPos( (bSplitAtStart) ? nOtherStart : nOtherEnd );
+ // first find the portion that is split (not necessarily the last one!)
+ NestList_t::iterator const iter(
+ ::std::find_if( rSplits.begin(), rSplits.end(),
+ TxtAttrContains(nSplitPos) ) );
+ if (iter != rSplits.end()) // already split here?
+ {
+ const xub_StrLen nStartPos( // skip other's dummy character!
+ (bSplitAtStart && bOtherDummy) ? nSplitPos + 1 : nSplitPos );
+ SwTxtAttrNesting * const pNew( MakeTxtAttrNesting(
+ rNode, **iter, nStartPos, *(*iter)->GetEnd() ) );
+ *(*iter)->GetEnd() = nSplitPos;
+ rSplits.insert(iter + 1, pNew);
+ }
+}
- NoteInHistory( pOther );
- *pOther->GetStart() = nThisStart;
- NoteInHistory( pOther, true );
- nOtherStart = nThisStart;
- }
+/**
+ Insert nesting hint into the hints array. Also calls NoteInHistory.
+ @param rNewHint the hint to be inserted (must not overlap existing!)
+ */
+void SwpHints::InsertNesting(SwTxtAttrNesting & rNewHint)
+{
+ SwpHintsArray::Insert(& rNewHint);
+ NoteInHistory( & rNewHint, true );
+}
- // Check if end of new attribute overlaps with pOther:
- // Split pOther if necessary:
- if ( nOtherStart < nThisEnd && nThisEnd < nOtherEnd )
- {
- SwTxtAttr* pNewAttr = rNode.MakeTxtAttr( pOther->GetAttr(),
- nOtherStart, nThisEnd );
- aInsDelHints.push_back( pNewAttr );
+/**
+
+The following hints correspond to well-formed XML elements in ODF:
+RES_TXTATR_INETFMT, RES_TXTATR_CJK_RUBY, RES_TXTATR_META, RES_TXTATR_METAFIELD
+
+The writer core must ensure that these do not overlap; if they did,
+the document would not be storable as ODF.
+
+Also, a Hyperlink must not be nested within another Hyperlink,
+and a Ruby must not be nested within another Ruby.
+
+The ODF export in xmloff will only put a hyperlink into a ruby, never a ruby
+into a hyperlink.
+
+Unfortunately the UNO API for Hyperlink and Ruby consists of the properties
+Hyperlink* and Ruby* of the css.text.CharacterProperties service. In other
+words, they are treated as formatting attributes, not as content entites.
+Furthermore, for API users it is not possible to easily test whether a certain
+range would be overlapping with other nested attributes, and most importantly,
+<em>which ones</em>, so we can hardly refuse to insert these in cases of
+overlap.
+
+It is possible to split Hyperlink and Ruby into multiple portions, such that
+the result is properly nested.
+
+meta and meta-field must not be split, because they have xml:id.
+
+These constraints result in the following design:
+
+RES_TXTATR_INETFMT:
+ always succeeds
+ inserts n attributes split at RES_TXTATR_CJK_RUBY, RES_TXTATR_META,
+ RES_TXTATR_METAFIELD
+ may replace existing RES_TXTATR_INETFMT at overlap
+RES_TXTATR_CJK_RUBY:
+ always succeeds
+ inserts n attributes split at RES_TXTATR_META, RES_TXTATR_METAFIELD
+ may replace existing RES_TXTATR_CJK_RUBY at overlap
+ may split existing overlapping RES_TXTATR_INETFMT
+RES_TXTATR_META:
+ may fail if overlapping existing RES_TXTATR_META/RES_TXTATR_METAFIELD
+ may split existing overlapping RES_TXTATR_INETFMT or RES_TXTATR_CJK_RUBY
+ inserts 1 attribute
+RES_TXTATR_METAFIELD:
+ may fail if overlapping existing RES_TXTATR_META/RES_TXTATR_METAFIELD
+ may split existing overlapping RES_TXTATR_INETFMT or RES_TXTATR_CJK_RUBY
+ inserts 1 attribute
+
+The nesting is expressed by the position of the hints.
+RES_TXTATR_META and RES_TXTATR_METAFIELD have a CH_TXTATR, and there can
+only be one such hint starting and ending at a given position.
+Only RES_TXTATR_INETFMT and RES_TXTATR_CJK_RUBY lack a CH_TXTATR.
+The interpretation given is that RES_TXTATR_CJK_RUBY is always around
+a RES_TXTATR_INETFMT at the same start and end position (which corresponds
+with the UNO API).
+Both of these are always around a nesting hint with CH_TXTATR at the same
+start and end position (if they should be inside, then the start should be
+after the CH_TXTATR).
+It would probably be a bad idea to add another nesting hint without
+CH_TXTATR; on the other hand, it would be difficult adding a CH_TXTATR to
+RES_TXTATR_INETFMT and RES_TXTATR_CJK_RUBY, due to the overwriting and
+splitting of exising hints that is necessary for backward compatibility.
+
+ @param rNode the text node
+ @param rHint the hint to be inserted
+ @returns true iff hint was successfully inserted
+*/
+bool
+SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
+{
+// INVARIANT: the nestable hints in the array are properly nested
+ const USHORT nNewWhich( rNewHint.Which() );
+ const xub_StrLen nNewStart( *rNewHint.GetStart() );
+ const xub_StrLen nNewEnd ( *rNewHint.GetEnd() );
+//??? const bool bNoLengthAttribute( nNewStart == nNewEnd );
+ const bool bNewSelfNestable( isSelfNestable(nNewWhich) );
+
+ ASSERT( (RES_TXTATR_INETFMT == nNewWhich) ||
+ (RES_TXTATR_CJK_RUBY == nNewWhich) ||
+ (RES_TXTATR_META == nNewWhich) ||
+ (RES_TXTATR_METAFIELD == nNewWhich),
+ "TryInsertNesting: Expecting INETFMT or RUBY or META or METAFIELD" );
+
+ NestList_t OverlappingExisting; // existing hints to be split
+ NestList_t OverwrittenExisting; // existing hints to be replaced
+ NestList_t SplitNew; // new hints to be inserted
+
+ SplitNew.push_back(& rNewHint);
+
+ // pass 1: split the inserted hint into fragments if necessary
+ for ( USHORT i = 0; i < GetEndCount(); ++i )
+ {
+ SwTxtAttr * const pOther = GetEnd(i);
- NoteInHistory( pOther );
- *pOther->GetStart() = nThisEnd;
- NoteInHistory( pOther, true );
+ if (pOther->IsNesting())
+ {
+ const USHORT nOtherWhich( pOther->Which() );
+ const xub_StrLen nOtherStart( *(pOther)->GetStart() );
+ const xub_StrLen nOtherEnd ( *(pOther)->GetEnd() );
+ if (isOverlap(nNewStart, nNewEnd, nOtherStart, nOtherEnd ))
+ {
+ switch (splitPolicy(nNewWhich, nOtherWhich))
+ {
+ case FAIL:
+ OSL_TRACE("cannot insert hint: overlap detected");
+ ::std::for_each(SplitNew.begin(), SplitNew.end(),
+ TxtAttrDeleter(*rNode.GetDoc()));
+ return false;
+ case SPLIT_NEW:
+ lcl_DoSplitNew(SplitNew, rNode, nNewStart,
+ nOtherStart, nOtherEnd, pOther->HasDummyChar());
+ break;
+ case SPLIT_OTHER:
+ OverlappingExisting.push_back(
+ static_cast<SwTxtAttrNesting*>(pOther));
+ break;
+ default:
+ ASSERT(false, "bad code monkey");
+ break;
+ }
+ }
+ else if (isNestedAny(nNewStart, nNewEnd, nOtherStart, nOtherEnd))
+ {
+ if (!bNewSelfNestable && (nNewWhich == nOtherWhich))
+ {
+ // ruby and hyperlink: if there is nesting, _overwrite_
+ OverwrittenExisting.push_back(
+ static_cast<SwTxtAttrNesting*>(pOther));
+ }
+ else if ((nNewStart == nOtherStart) && pOther->HasDummyChar())
+ {
+ if (rNewHint.HasDummyChar())
+ {
+ ASSERT(false,
+ "ERROR: inserting duplicate CH_TXTATR hint");
+ return false;
+ } else if (nNewEnd < nOtherEnd) {
+ // other has dummy char, new is inside other, but
+ // new contains the other's dummy char?
+ // should be corrected because it may lead to problems
+ // in SwXMeta::createEnumeration
+ // SplitNew is sorted, so this is the first split
+ xub_StrLen *const pStart(SplitNew.front()->GetStart());
+ ASSERT(*pStart == nNewStart, "how did that happen?");
+ *pStart = nNewStart + 1;
+ }
}
}
}
+ }
- // Insert the newly created attributes:
- const sal_uInt16 nCharFmtID = static_cast<sal_uInt16>( RES_TXTATR_INETFMT == nWhich ?
- RES_POOLCHR_INET_NORMAL :
- RES_POOLCHR_RUBYTEXT );
- SwCharFmt* pFmt = rNode.GetDoc()->GetCharFmtFromPool( nCharFmtID );
+ ASSERT (isSplittable(nNewWhich) || SplitNew.size() == 1,
+ "splitting the unsplittable ???");
+
+ // pass 2: split existing hints that overlap/nest with new hint
+ // do not iterate over hints array, but over remembered set of overlapping
+ // hints, to keep things simple w.r.t. insertion/removal
+ // N.B: if there is a hint that splits the inserted hint, then
+ // that hint would also have already split any hint in OverlappingExisting
+ // so any hint in OverlappingExisting can be split at most by one hint
+ // in SplitNew, or even not at all (this is not true for existing hints
+ // that go _around_ new hint, which is the raison d'^etre for pass 4)
+ for (NestList_t::iterator itOther = OverlappingExisting.begin();
+ itOther != OverlappingExisting.end(); ++itOther)
+ {
+ const xub_StrLen nOtherStart( *(*itOther)->GetStart() );
+ const xub_StrLen nOtherEnd ( *(*itOther)->GetEnd() );
- for ( aIter = aInsDelHints.begin(); aIter != aInsDelHints.end(); ++aIter )
+ for (NestList_t::iterator itNew = SplitNew.begin();
+ itNew != SplitNew.end(); ++itNew)
{
- if ( RES_TXTATR_INETFMT == nWhich )
+ const xub_StrLen nSplitNewStart( *(*itNew)->GetStart() );
+ const xub_StrLen nSplitNewEnd ( *(*itNew)->GetEnd() );
+ // 4 cases: within, around, overlap l, overlap r, (OTHER: no action)
+ const bool bRemoveOverlap(
+ !bNewSelfNestable && (nNewWhich == (*itOther)->Which()) );
+
+ switch (ComparePosition(nSplitNewStart, nSplitNewEnd,
+ nOtherStart, nOtherEnd))
{
- SwTxtINetFmt* pInetAttr = static_cast<SwTxtINetFmt*>(*aIter);
- pInetAttr->ChgTxtNode( &rNode );
- pFmt->Add( pInetAttr );
-
+ case POS_INSIDE:
+ {
+ ASSERT(!bRemoveOverlap,
+ "this one should be in OverwrittenExisting?");
+ }
+ break;
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ {
+ ASSERT(false, "existing hint inside new hint: why?");
+ }
+ break;
+ case POS_OVERLAP_BEFORE:
+ {
+ Delete( *itOther ); // this also does NoteInHistory!
+ *(*itOther)->GetStart() = nSplitNewEnd;
+ InsertNesting( **itOther );
+ if (!bRemoveOverlap)
+ {
+ if ( USHRT_MAX == Count() )
+ {
+ ASSERT(false, "hints array full :-(");
+ return false;
+ }
+ SwTxtAttrNesting * const pOtherLeft(
+ MakeTxtAttrNesting( rNode, **itOther,
+ nOtherStart, nSplitNewEnd ) );
+ InsertNesting( *pOtherLeft );
+ }
+ }
+ break;
+ case POS_OVERLAP_BEHIND:
+ {
+ Delete( *itOther ); // this also does NoteInHistory!
+ *(*itOther)->GetEnd() = nSplitNewStart;
+ InsertNesting( **itOther );
+ if (!bRemoveOverlap)
+ {
+ if ( USHRT_MAX == Count() )
+ {
+ ASSERT(false, "hints array full :-(");
+ return false;
+ }
+ SwTxtAttrNesting * const pOtherRight(
+ MakeTxtAttrNesting( rNode, **itOther,
+ nSplitNewStart, nOtherEnd ) );
+ InsertNesting( *pOtherRight );
+ }
+ }
+ break;
+ default:
+ break; // overlap resolved by splitting new: nothing to do
}
+ }
+ }
- else
- {
- SwTxtRuby* pRubyAttr = static_cast<SwTxtRuby*>(*aIter);
- pRubyAttr->ChgTxtNode( &rNode );
- pFmt->Add( pRubyAttr );
-
- }
+ if ( USHRT_MAX - SplitNew.size() <= Count() )
+ {
+ ASSERT(false, "hints array full :-(");
+ return false;
+ }
- SwpHintsArray::Insert( *aIter );
- NoteInHistory( *aIter, true );
- }
+ // pass 3: insert new hints
+ for (NestList_t::iterator iter = SplitNew.begin();
+ iter != SplitNew.end(); ++iter)
+ {
+ InsertNesting(**iter);
+ }
- aInsDelHints.clear();
+ // pass 4: handle overwritten hints
+ // RES_TXTATR_INETFMT and RES_TXTATR_CJK_RUBY should displace attributes
+ // of the same kind.
+ for (NestList_t::iterator itOther = OverwrittenExisting.begin();
+ itOther != OverwrittenExisting.end(); ++itOther)
+ {
+ const xub_StrLen nOtherStart( *(*itOther)->GetStart() );
+ const xub_StrLen nOtherEnd ( *(*itOther)->GetEnd() );
- // Now delete all attributes of the same type as the new one
- // which are fully covered by the new attribute:
- for ( USHORT i = 0; i < Count(); ++i )
+ // overwritten portion is given by start/end of inserted hint
+ if ((nNewStart <= nOtherStart) && (nOtherEnd <= nNewEnd))
{
- SwTxtAttr* pOther = GetTextHint(i);
- if ( nWhich == pOther->Which() )
- {
- const xub_StrLen nOtherStart = *pOther->GetStart();
- const xub_StrLen nOtherEnd = *pOther->GetEnd();
-
- if ( nOtherStart >= nThisStart && nOtherEnd <= nThisEnd )
- aInsDelHints.push_back( pOther );
- }
+ Delete(*itOther);
+ rNode.DestroyAttr( *itOther );
}
- for ( aIter = aInsDelHints.begin(); aIter != aInsDelHints.end(); ++aIter )
+ else
{
- Delete( *aIter );
- rNode.DestroyAttr( *aIter );
+ ASSERT((nOtherStart < nNewStart) && (nNewEnd < nOtherEnd), "huh?");
+ // scenario: there is a RUBY, and contained within that a META;
+ // now a RUBY is inserted within the META => the exising RUBY is split:
+ // here it is not possible to simply insert the left/right fragment
+ // of the existing RUBY because they <em>overlap</em> with the META!
+ Delete( *itOther ); // this also does NoteInHistory!
+ *(*itOther)->GetEnd() = nNewStart;
+ bool bSuccess( TryInsertNesting(rNode, **itOther) );
+ ASSERT(bSuccess, "recursive call 1 failed?");
+ SwTxtAttrNesting * const pOtherRight(
+ MakeTxtAttrNesting(
+ rNode, **itOther, nNewEnd, nOtherEnd ) );
+ bSuccess = TryInsertNesting(rNode, *pOtherRight);
+ ASSERT(bSuccess, "recursive call 2 failed?");
}
- SwpHintsArray::Insert( &rNewHint );
- NoteInHistory( &rNewHint, true );
-
- return;
}
+ return true;
+}
+
+
+// This function takes care for the following text attribute:
+// RES_TXTATR_CHARFMT, RES_TXTATR_AUTOFMT
+// These attributes have to be handled in a special way (Portion building).
+//
+// The new attribute will be split by any existing RES_TXTATR_AUTOFMT or
+// RES_TXTATR_CHARFMT. The new attribute itself will
+// split any existing RES_TXTATR_AUTOFMT or RES_TXTATR_CHARFMT.
+
+void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint,
+ const SetAttrMode nMode )
+{
+ const USHORT nWhich = rNewHint.Which();
+
+ const xub_StrLen nThisStart = *rNewHint.GetStart();
+ const xub_StrLen nThisEnd = *rNewHint.GetEnd();
+ const bool bNoLengthAttribute = nThisStart == nThisEnd;
+
+ std::vector<SwTxtAttr*> aInsDelHints;
+ std::vector<SwTxtAttr*>::iterator aIter;
+
ASSERT( RES_TXTATR_CHARFMT == rNewHint.Which() ||
RES_TXTATR_AUTOFMT == rNewHint.Which(),
- "Expecting CHARFMT or AUTOFMT" )
+ "Expecting CHARFMT or AUTOFMT" );
//
// 2. Find the hints which cover the start and end position
@@ -265,7 +621,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
// Split pOther if necessary:
if ( nOtherStart < nThisStart && nThisStart < nOtherEnd )
{
- SwTxtAttr* pNewAttr = rNode.MakeTxtAttr( pOther->GetAttr(), nOtherStart, nThisStart );
+ SwTxtAttr* pNewAttr = MakeTxtAttr( *rNode.GetDoc(),
+ pOther->GetAttr(), nOtherStart, nThisStart );
if ( RES_TXTATR_CHARFMT == pOther->Which() )
static_cast<SwTxtCharFmt*>(pNewAttr)->SetSortNumber( static_cast<SwTxtCharFmt*>(pOther)->GetSortNumber() );
aInsDelHints.push_back( pNewAttr );
@@ -281,7 +638,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
// Split pOther if necessary:
if ( nOtherStart < nThisEnd && nThisEnd < nOtherEnd )
{
- SwTxtAttr* pNewAttr = rNode.MakeTxtAttr( pOther->GetAttr(), nOtherStart, nThisEnd );
+ SwTxtAttr* pNewAttr = MakeTxtAttr( *rNode.GetDoc(),
+ pOther->GetAttr(), nOtherStart, nThisEnd );
if ( RES_TXTATR_CHARFMT == pOther->Which() )
static_cast<SwTxtCharFmt*>(pNewAttr)->SetSortNumber( static_cast<SwTxtCharFmt*>(pOther)->GetSortNumber() );
aInsDelHints.push_back( pNewAttr );
@@ -433,8 +791,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
// Create new AutoStyle
if ( aNewSet.Count() )
{
- pNewAttr = rNode.MakeTxtAttr( aNewSet,
- nPorStart, nPorEnd );
+ pNewAttr = MakeTxtAttr( *rNode.GetDoc(),
+ aNewSet, nPorStart, nPorEnd );
SwpHintsArray::Insert( pNewAttr );
NoteInHistory( pNewAttr, true );
}
@@ -453,7 +811,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
}
else
{
- pNewAttr = rNode.MakeTxtAttr( rNewHint.GetAttr(), nPorStart, nPorEnd );
+ pNewAttr = MakeTxtAttr( *rNode.GetDoc(), rNewHint.GetAttr(),
+ nPorStart, nPorEnd );
static_cast<SwTxtCharFmt*>(pNewAttr)->SetSortNumber( nCharStyleCount );
}
}
@@ -510,7 +869,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
// Create new AutoStyle
if ( aNewSet.Count() )
- pNewAttr = rNode.MakeTxtAttr( aNewSet, nPorStart, nPorEnd );
+ pNewAttr = MakeTxtAttr( *rNode.GetDoc(), aNewSet,
+ nPorStart, nPorEnd );
}
else
{
@@ -568,7 +928,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
}
else if ( pNewStyle.get() )
{
- pNewAttr = rNode.MakeTxtAttr( *pNewStyle, nPorStart, nPorEnd );
+ pNewAttr = MakeTxtAttr( *rNode.GetDoc(), *pNewStyle,
+ nPorStart, nPorEnd );
}
}
}
@@ -597,35 +958,66 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
* SwTxtNode::MakeTxtAttr()
*************************************************************************/
-// create new text attribute
-SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxPoolItem& rAttr,
- xub_StrLen nStt, xub_StrLen nEnd, bool bRedlineAttr )
+SwTxtAttr* MakeRedlineTxtAttr( SwDoc & rDoc, SfxPoolItem & rAttr )
{
- SwDoc* pDoc = GetDoc();
+ // this is intended _only_ for special-purpose redline attributes!
+ switch (rAttr.Which())
+ {
+ case RES_CHRATR_COLOR:
+ case RES_CHRATR_WEIGHT:
+ case RES_CHRATR_CJK_WEIGHT:
+ case RES_CHRATR_CTL_WEIGHT:
+ case RES_CHRATR_POSTURE:
+ case RES_CHRATR_CJK_POSTURE:
+ case RES_CHRATR_CTL_POSTURE:
+ case RES_CHRATR_UNDERLINE:
+ case RES_CHRATR_CROSSEDOUT:
+ case RES_CHRATR_CASEMAP:
+ case RES_CHRATR_BACKGROUND:
+ break;
+ default:
+ ASSERT(false, "unsupported redline attribute");
+ break;
+ }
+
+ // Put new attribute into pool
+ // FIXME: this const_cast is evil!
+ SfxPoolItem& rNew =
+ const_cast<SfxPoolItem&>( rDoc.GetAttrPool().Put( rAttr ) );
+ return new SwTxtAttrEnd( rNew, 0, 0 );
+}
- if ( !bRedlineAttr && isCHRATR(rAttr.Which()) )
+// create new text attribute
+SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr,
+ xub_StrLen nStt, xub_StrLen nEnd )
+{
+ if ( isCHRATR(rAttr.Which()) )
{
- // Somebody wants to build a SwTxtAttr for a character attribute (and
- // this attribute is not meant for redlining). Sorry, this is not allowed
- // any longer. You'll get a brand new autostyle attribute:
- SfxItemSet aItemSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END );
+ // Somebody wants to build a SwTxtAttr for a character attribute.
+ // Sorry, this is not allowed any longer.
+ // You'll get a brand new autostyle attribute:
+ SfxItemSet aItemSet( rDoc.GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END );
aItemSet.Put( rAttr );
- return MakeTxtAttr( aItemSet, nStt, nEnd );
+ return MakeTxtAttr( rDoc, aItemSet, nStt, nEnd );
}
else if ( RES_TXTATR_AUTOFMT == rAttr.Which() &&
- static_cast<const SwFmtAutoFmt&>(rAttr).GetStyleHandle()->GetPool() != &pDoc->GetAttrPool() )
+ static_cast<const SwFmtAutoFmt&>(rAttr).GetStyleHandle()->
+ GetPool() != &rDoc.GetAttrPool() )
{
- // If the attribut is an autostyle which referes to a pool that is different from
- // pDoc's pool, we have to correct this:
+ // If the attribute is an auto-style which refers to a pool that is
+ // different from rDoc's pool, we have to correct this:
const StylePool::SfxItemSet_Pointer_t pAutoStyle = static_cast<const SwFmtAutoFmt&>(rAttr).GetStyleHandle();
- const SfxItemSet* pNewSet = pAutoStyle->SfxItemSet::Clone( TRUE, &pDoc->GetAttrPool() );
- SwTxtAttr* pNew = MakeTxtAttr( *pNewSet, nStt, nEnd );
- delete pNewSet;
+ ::std::auto_ptr<const SfxItemSet> pNewSet(
+ pAutoStyle->SfxItemSet::Clone( TRUE, &rDoc.GetAttrPool() ));
+ SwTxtAttr* pNew = MakeTxtAttr( rDoc, *pNewSet, nStt, nEnd );
return pNew;
}
- // Put new attribute into pool unless we are asked to build a redline attribute
- const SfxPoolItem& rNew = !bRedlineAttr ? GetDoc()->GetAttrPool().Put( rAttr ) : rAttr;
+ // Put new attribute into pool
+ // FIXME: this const_cast is evil!
+ SfxPoolItem& rNew =
+ const_cast<SfxPoolItem&>( rDoc.GetAttrPool().Put( rAttr ) );
SwTxtAttr* pNew = 0;
switch( rNew.Which() )
@@ -634,7 +1026,9 @@ SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxPoolItem& rAttr,
{
SwFmtCharFmt &rFmtCharFmt = (SwFmtCharFmt&) rNew;
if( !rFmtCharFmt.GetCharFmt() )
- rFmtCharFmt.SetCharFmt( GetDoc()->GetDfltCharFmt() );
+ {
+ rFmtCharFmt.SetCharFmt( rDoc.GetDfltCharFmt() );
+ }
pNew = new SwTxtCharFmt( rFmtCharFmt, nStt, nEnd );
}
@@ -650,9 +1044,11 @@ SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxPoolItem& rAttr,
// erst hier wird das Frame-Format kopiert (mit Inhalt) !!
pNew = new SwTxtFlyCnt( (SwFmtFlyCnt&)rNew, nStt );
// Kopie von einem Text-Attribut
- if( ((SwFmtFlyCnt&)rAttr).GetTxtFlyCnt() )
- // dann muss das Format Kopiert werden
- ((SwTxtFlyCnt*)pNew)->CopyFlyFmt( GetDoc() );
+ if ( static_cast<const SwFmtFlyCnt &>(rAttr).GetTxtFlyCnt() )
+ {
+ // then the format must be copied
+ static_cast<SwTxtFlyCnt *>(pNew)->CopyFlyFmt( &rDoc );
+ }
}
break;
case RES_TXTATR_FTN:
@@ -661,12 +1057,6 @@ SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxPoolItem& rAttr,
if( ((SwFmtFtn&)rAttr).GetTxtFtn() )
((SwTxtFtn*)pNew)->SetSeqNo( ((SwFmtFtn&)rAttr).GetTxtFtn()->GetSeqRefNo() );
break;
- case RES_TXTATR_HARDBLANK:
- pNew = new SwTxtHardBlank( (SwFmtHardBlank&)rNew, nStt );
- break;
- case RES_CHRATR_TWO_LINES:
- pNew = new SwTxt2Lines( (SvxTwoLinesItem&)rNew, nStt, nEnd );
- break;
case RES_TXTATR_REFMARK:
pNew = nStt == nEnd
? new SwTxtRefMark( (SwFmtRefMark&)rNew, nStt )
@@ -683,7 +1073,12 @@ SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxPoolItem& rAttr,
case RES_TXTATR_CJK_RUBY:
pNew = new SwTxtRuby( (SwFmtRuby&)rNew, nStt, nEnd );
break;
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ pNew = new SwTxtMeta( static_cast<SwFmtMeta&>(rNew), nStt, nEnd );
+ break;
default:
+ ASSERT(RES_TXTATR_AUTOFMT == rNew.Which(), "unknown attribute");
pNew = new SwTxtAttrEnd( rNew, nStt, nEnd );
break;
}
@@ -691,13 +1086,14 @@ SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxPoolItem& rAttr,
return pNew;
}
-SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd )
+SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, const SfxItemSet& rSet,
+ xub_StrLen nStt, xub_StrLen nEnd )
{
- IStyleAccess& rStyleAccess = getIDocumentStyleAccess();
+ IStyleAccess& rStyleAccess = rDoc.GetIStyleAccess();
const StylePool::SfxItemSet_Pointer_t pAutoStyle = rStyleAccess.getAutomaticStyle( rSet, IStyleAccess::AUTO_STYLE_CHAR );
SwFmtAutoFmt aNewAutoFmt;
aNewAutoFmt.SetStyleHandle( pAutoStyle );
- SwTxtAttr* pNew = MakeTxtAttr( aNewAutoFmt, nStt, nEnd );
+ SwTxtAttr* pNew = MakeTxtAttr( rDoc, aNewAutoFmt, nStt, nEnd );
return pNew;
}
@@ -781,6 +1177,14 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr )
case RES_TXTATR_REFMARK:
nDelMsg = RES_REFMARK_DELETED;
break;
+
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ static_cast<SwFmtMeta&>(pAttr->GetAttr()).NotifyRemoval();
+ break;
+
+ default:
+ break;
}
if( nDelMsg && !pDoc->IsInDtor() && GetNodes().IsDocNodes() )
@@ -789,8 +1193,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr )
pDoc->GetUnoCallBack()->Modify( &aMsgHint, &aMsgHint );
}
- pAttr->RemoveFromPool( pDoc->GetAttrPool() );
- delete pAttr;
+ SwTxtAttr::Destroy( pAttr, pDoc->GetAttrPool() );
}
}
@@ -798,30 +1201,52 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr )
* SwTxtNode::Insert()
*************************************************************************/
-// lege ein neues TextAttribut an und fuege es ins SwpHints-Array ein
-SwTxtAttr* SwTxtNode::InsertItem( const SfxPoolItem& rAttr,
- xub_StrLen nStt, xub_StrLen nEnd, USHORT nMode )
+SwTxtAttr*
+SwTxtNode::InsertItem( SfxPoolItem& rAttr,
+ const xub_StrLen nStart, const xub_StrLen nEnd, const SetAttrMode nMode )
{
// character attributes will be inserted as automatic styles:
ASSERT( !isCHRATR(rAttr.Which()), "AUTOSTYLES - "
"SwTxtNode::InsertItem should not be called with character attributes");
- SwTxtAttr* pNew = MakeTxtAttr( rAttr, nStt, nEnd );
+ SwTxtAttr* const pNew = MakeTxtAttr( *GetDoc(), rAttr, nStart, nEnd );
if ( pNew )
- Insert( pNew, nMode );
+ {
+ const bool bSuccess( InsertHint( pNew, nMode ) );
+ // N.B.: also check that the hint is actually in the hints array,
+ // because hints of certain types may be merged after succesful
+ // insertion, and thus destroyed!
+ if (!bSuccess || ( USHRT_MAX == m_pSwpHints->GetPos( pNew ) ))
+ {
+ return 0;
+ }
+ }
return pNew;
}
-// uebernehme den Pointer auf das Text-Attribut
-BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
+// take ownership of pAttr; if insertion fails, delete pAttr
+bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
{
BOOL bHiddenPara = FALSE;
- ASSERT( pAttr && *pAttr->GetStart() <= Len(), "StartIdx hinter Len!" );
-
- if( !pAttr->GetEnd() )
+ ASSERT( pAttr && *pAttr->GetStart() <= Len(), "StartIdx out of bounds!" );
+ ASSERT( !pAttr->GetEnd() || (*pAttr->GetEnd() <= Len()),
+ "EndIdx out of bounds!" );
+
+ // translate from SetAttrMode to InsertMode (for hints with CH_TXTATR)
+ const enum IDocumentContentOperations::InsertFlags nInsertFlags =
+ (nMode & nsSetAttrMode::SETATTR_FORCEHINTEXPAND)
+ ? static_cast<IDocumentContentOperations::InsertFlags>(
+ IDocumentContentOperations::INS_FORCEHINTEXPAND |
+ IDocumentContentOperations::INS_EMPTYEXPAND)
+ : IDocumentContentOperations::INS_EMPTYEXPAND;
+
+ // need this after TryInsertHint, when pAttr may be deleted
+ const xub_StrLen nStart( *pAttr->GetStart() );
+ const bool bDummyChar( pAttr->HasDummyChar() );
+ if (bDummyChar)
{
USHORT nInsMode = nMode;
switch( pAttr->Which() )
@@ -843,7 +1268,8 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
(const SfxPoolItem**)&pAnchor );
SwIndex aIdx( this, *pAttr->GetStart() );
- Insert( GetCharOfTxtAttr(*pAttr), aIdx );
+ const sal_Unicode c = GetCharOfTxtAttr(*pAttr);
+ InsertText( c, aIdx, nInsertFlags );
nInsMode |= nsSetAttrMode::SETATTR_NOTXTATRCHR;
if( pAnchor && FLY_IN_CNTNT == pAnchor->GetAnchorId() &&
@@ -892,7 +1318,7 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
pDoc->DoUndo( FALSE );
DestroyAttr( pAttr );
pDoc->DoUndo( bUndo );
- return FALSE;
+ return false;
}
}
break;
@@ -926,7 +1352,7 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
Update( aTmpIdx, 1, TRUE );
}
DestroyAttr( pAttr );
- return FALSE;
+ return false;
}
// wird eine neue Fussnote eingefuegt ??
@@ -957,7 +1383,8 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
// entstehen koennen und das Attribut im _SortArr_ am
// Dokument nicht eingetrage wird.
SwIndex aNdIdx( this, *pAttr->GetStart() );
- Insert( GetCharOfTxtAttr(*pAttr), aNdIdx );
+ const sal_Unicode c = GetCharOfTxtAttr(*pAttr);
+ InsertText( c, aNdIdx, nInsertFlags );
nInsMode |= nsSetAttrMode::SETATTR_NOTXTATRCHR;
}
@@ -1020,92 +1447,105 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
if( !(nsSetAttrMode::SETATTR_NOTXTATRCHR & nInsMode) )
{
SwIndex aIdx( this, *pAttr->GetStart() );
- Insert( GetCharOfTxtAttr(*pAttr), aIdx );
+ InsertText( GetCharOfTxtAttr(*pAttr), aIdx, nInsertFlags );
+
+ // adjust end of hint to account for inserted CH_TXTATR
+ xub_StrLen * const pEnd(pAttr->GetEnd());
+ if (pEnd)
+ {
+ *pEnd = *pEnd + 1;
+ }
}
}
- else {
- ASSERT( *pAttr->GetEnd() <= Len(), "EndIdx hinter Len!" );
- }
GetOrCreateSwpHints();
// 4263: AttrInsert durch TextInsert => kein Adjust
- m_pSwpHints->Insert( pAttr, *this, nMode );
+ const bool bRet = m_pSwpHints->TryInsertHint( pAttr, *this, nMode );
- // 47375: In pSwpHints->Insert wird u.a. Merge gerufen und das Hints-Array
- // von ueberfluessigen Hints befreit, dies kann u.U. sogar der frisch
- // eingefuegte Hint pAttr sein, der dann zerstoert wird!!
- if ( USHRT_MAX == m_pSwpHints->GetPos( pAttr ) )
+ if (!bRet && bDummyChar)
{
- return FALSE;
+ // undo insertion of dummy character
+ // N.B. cannot insert the dummy character after inserting the hint,
+ // because if the hint has no extent it will be moved in InsertText,
+ // resulting in infinite recursion
+ if ( !(nsSetAttrMode::SETATTR_NOTXTATRCHR & nMode) )
+ {
+ ASSERT( ( CH_TXTATR_BREAKWORD == m_Text.GetChar(nStart) ||
+ CH_TXTATR_INWORD == m_Text.GetChar(nStart) ),
+ "where is my attribute character?" );
+ SwIndex aIdx( this, nStart );
+ EraseText( aIdx, 1 );
+ }
}
- if( bHiddenPara )
+ if ( bHiddenPara )
+ {
SetCalcHiddenParaField();
+ }
- return TRUE;
+ return bRet;
}
/*************************************************************************
- * SwTxtNode::Delete()
+ * SwTxtNode::DeleteAttribute()
*************************************************************************/
-void SwTxtNode::Delete( SwTxtAttr *pAttr, BOOL bThisOnly )
+void SwTxtNode::DeleteAttribute( SwTxtAttr * const pAttr )
{
if ( !HasHints() )
+ {
+ ASSERT(false, "DeleteAttribute called, but text node without hints?");
return;
+ }
- if( bThisOnly )
+ if ( pAttr->HasDummyChar() )
{
- 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() );
- m_pSwpHints->Delete( pAttr );
- pAttr->RemoveFromPool( GetDoc()->GetAttrPool() );
- delete pAttr;
- SwModify::Modify( 0, &aHint ); // die Frames benachrichtigen
-
- TryDeleteSwpHints();
- }
-
- return;
+ // Unbedingt Copy-konstruieren!
+ const SwIndex aIdx( this, *pAttr->GetStart() );
+ // erase the CH_TXTATR, which will also delete pAttr
+ EraseText( aIdx, 1 );
+ }
+ else
+ {
+ // create MsgHint before start/end become invalid
+ SwUpdateAttr aHint(
+ *pAttr->GetStart(), *pAttr->GetEnd(), pAttr->Which() );
+ m_pSwpHints->Delete( pAttr );
+ SwTxtAttr::Destroy( pAttr, GetDoc()->GetAttrPool() );
+ SwModify::Modify( 0, &aHint ); // notify Frames
+
+ TryDeleteSwpHints();
}
- Delete( pAttr->Which(), *pAttr->GetStart(), *pAttr->GetAnyEnd() );
}
/*************************************************************************
- * SwTxtNode::Delete()
+ * SwTxtNode::DeleteAttributes()
*************************************************************************/
-void SwTxtNode::Delete( USHORT nTxtWhich, xub_StrLen nStt, xub_StrLen nEnd )
+//FIXME: this does NOT respect SORT NUMBER (for CHARFMT)!
+void SwTxtNode::DeleteAttributes( const USHORT nWhich,
+ const xub_StrLen nStart, const xub_StrLen nEnd )
{
if ( !HasHints() )
return;
- const xub_StrLen *pEndIdx;
- const xub_StrLen *pSttIdx;
- SwTxtAttr* pTxtHt;
-
for ( USHORT nPos = 0; m_pSwpHints && nPos < m_pSwpHints->Count(); nPos++ )
{
- pTxtHt = m_pSwpHints->GetTextHint( nPos );
- const USHORT nWhich = pTxtHt->Which();
- if( nWhich == nTxtWhich &&
- *( pSttIdx = pTxtHt->GetStart()) == nStt )
+ SwTxtAttr * const pTxtHt = m_pSwpHints->GetTextHint( nPos );
+ const xub_StrLen nHintStart = *(pTxtHt->GetStart());
+ if (nStart < nHintStart)
+ {
+ break; // sorted by start
+ }
+ else if ( (nStart == nHintStart) && (nWhich == pTxtHt->Which()) )
{
if ( nWhich == RES_CHRATR_HIDDEN )
+ {
+ ASSERT(false, "hey, that's a CHRATR! how did that get in?");
SetCalcHiddenCharFlags();
+ }
else if ( nWhich == RES_TXTATR_CHARFMT )
{
// Check if character format contains hidden attribute:
@@ -1124,16 +1564,14 @@ void SwTxtNode::Delete( USHORT nTxtWhich, xub_StrLen nStt, xub_StrLen nEnd )
}
// <--
- pEndIdx = pTxtHt->GetEnd();
+ xub_StrLen const * const pEndIdx = pTxtHt->GetEnd();
- // Text-Attribute sind voellig dynamisch, so dass diese nur
- // mit ihrer Start-Position verglichen werden.
- if( !pEndIdx )
+ if ( pTxtHt->HasDummyChar() )
{
// Unbedingt Copy-konstruieren!
- const SwIndex aIdx( this, *pSttIdx );
- Erase( aIdx, 1 );
- break;
+ const SwIndex aIdx( this, nStart );
+ // erase the CH_TXTATR, which will also delete pTxtHt
+ EraseText( aIdx, 1 );
}
else if( *pEndIdx == nEnd )
{
@@ -1141,12 +1579,10 @@ void SwTxtNode::Delete( USHORT nTxtWhich, xub_StrLen nStt, xub_StrLen nEnd )
// Start und End weg.
// Das CalcVisibleFlag bei HiddenParaFields entfaellt,
// da dies das Feld im Dtor selbst erledigt.
- SwUpdateAttr aHint( *pSttIdx, *pEndIdx, nTxtWhich );
+ SwUpdateAttr aHint( nStart, *pEndIdx, nWhich );
m_pSwpHints->DeleteAtPos( nPos ); // gefunden, loeschen,
- pTxtHt->RemoveFromPool( GetDoc()->GetAttrPool() );
- delete pTxtHt;
+ SwTxtAttr::Destroy( pTxtHt, GetDoc()->GetAttrPool() );
SwModify::Modify( 0, &aHint ); // die Frames benachrichtigen
- break;
}
}
}
@@ -1165,7 +1601,7 @@ void SwTxtNode::DelSoftHyph( const xub_StrLen nStt, const xub_StrLen nEnd )
nFndPos < nEndPos )
{
const SwIndex aIdx( this, nFndPos );
- Erase( aIdx, 1 );
+ EraseText( aIdx, 1 );
--nEndPos;
}
}
@@ -1173,7 +1609,7 @@ void SwTxtNode::DelSoftHyph( const xub_StrLen nStt, const xub_StrLen nEnd )
// setze diese Attribute am TextNode. Wird der gesamte Bereich umspannt,
// dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr)
BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
- xub_StrLen nEnd, USHORT nMode )
+ xub_StrLen nEnd, const SetAttrMode nMode )
{
if( !rSet.Count() )
return FALSE;
@@ -1262,7 +1698,8 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
}
else
{
- pNew = MakeTxtAttr( *pItem, nStt, nEnd );
+ pNew = MakeTxtAttr( *GetDoc(),
+ const_cast<SfxPoolItem&>(*pItem), nStt, nEnd );
if ( pNew )
{
if ( nEnd != nStt && !pNew->GetEnd() )
@@ -1271,7 +1708,7 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
"Attribut without end, but area marked");
DestroyAttr( pNew ); // do not insert
}
- else if ( Insert( pNew, nMode ) )
+ else if ( InsertHint( pNew, nMode ) )
{
++nCount;
}
@@ -1287,9 +1724,11 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
if ( aCharSet.Count() )
{
- SwTxtAttr* pTmpNew = MakeTxtAttr( aCharSet, nStt, nEnd );
- if ( Insert( pTmpNew, nMode ) )
+ SwTxtAttr* pTmpNew = MakeTxtAttr( *GetDoc(), aCharSet, nStt, nEnd );
+ if ( InsertHint( pTmpNew, nMode ) )
+ {
++nCount;
+ }
}
TryDeleteSwpHints();
@@ -1669,7 +2108,9 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
if (lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ))
{
m_pSwpHints->SwpHintsArray::Insert(
- MakeTxtAttr( *pItem, 0, GetTxt().Len() ) );
+ MakeTxtAttr( *GetDoc(),
+ const_cast<SfxPoolItem&>(*pItem),
+ 0, GetTxt().Len() ) );
aClearWhichIds.push_back( pItem->Which() );
}
@@ -1701,8 +2142,9 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
&pNdItem ) || *pItem != *pNdItem ) &&
lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ) )
{
- m_pSwpHints->SwpHintsArray::Insert(
- MakeTxtAttr( *pItem, 0, GetTxt().Len() ) );
+ m_pSwpHints->SwpHintsArray::Insert( MakeTxtAttr( *GetDoc(),
+ const_cast<SfxPoolItem&>(*pItem),
+ 0, GetTxt().Len() ) );
aClearWhichIds.push_back( pItem->Which() );
}
aNdSet.ClearItem( pItem->Which() );
@@ -1726,7 +2168,9 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
pNd->GetTxt().Len() ) )
{
pNd->m_pSwpHints->SwpHintsArray::Insert(
- pNd->MakeTxtAttr( *pItem, 0, pNd->GetTxt().Len() ) );
+ MakeTxtAttr( *pNd->GetDoc(),
+ const_cast<SfxPoolItem&>(*pItem),
+ 0, pNd->GetTxt().Len() ) );
}
aClearWhichIds.push_back( pItem->Which() );
@@ -1979,18 +2423,20 @@ void lcl_CheckSortNumber( const SwpHints& rHints, SwTxtCharFmt& rNewCharFmt )
*************************************************************************/
/*
- * 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()).
+ * Try to insert the new hint.
+ * Depending on the type of the hint, this either always succeeds, or may fail.
+ * Depending on the type of the hint, other hints may be deleted or
+ * overwritten.
+ * The return value indicates successful insertion.
*/
-
-void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
+bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode,
+ const SetAttrMode nMode )
{
- // Irgendwann ist immer Schluss
- if( USHRT_MAX == Count() )
- return;
+ if ( USHRT_MAX == Count() ) // we're sorry, this flight is overbooked...
+ {
+ ASSERT(false, "hints array full :-(");
+ return false;
+ }
// Felder bilden eine Ausnahme:
// 1) Sie koennen nie ueberlappen
@@ -2025,11 +2471,7 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
}
// <--
case RES_TXTATR_INETFMT:
- {
- ((SwTxtINetFmt*)pHint)->ChgTxtNode( &rNode );
- SwCharFmt* pFmt = rNode.GetDoc()->GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL );
- pFmt->Add( (SwTxtINetFmt*)pHint );
- }
+ lcl_InitINetFmt(rNode, static_cast<SwTxtINetFmt*>(pHint));
break;
case RES_TXTATR_FIELD:
{
@@ -2163,12 +2605,12 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
break;
case RES_TXTATR_CJK_RUBY:
- {
- ((SwTxtRuby*)pHint)->ChgTxtNode( &rNode );
- SwCharFmt* pFmt = rNode.GetDoc()->GetCharFmtFromPool(
- RES_POOLCHR_RUBYTEXT );
- pFmt->Add( (SwTxtRuby*)pHint );
- }
+ lcl_InitRuby(rNode, static_cast<SwTxtRuby*>(pHint));
+ break;
+
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ static_cast<SwTxtMeta *>(pHint)->ChgTxtNode( &rNode );
break;
case RES_CHRATR_HIDDEN:
@@ -2198,7 +2640,7 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
SwUpdateAttr aHint( nHtStart, nHtStart, nWhich );
rNode.Modify( 0, &aHint );
}
- return;
+ return true;
}
// ----------------------------------------------------------------
@@ -2219,18 +2661,24 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
const xub_StrLen nHintEnd = *pHtEnd;
const bool bNoHintAdjustMode = (nsSetAttrMode::SETATTR_NOHINTADJUST & nMode);
+ // handle nesting attributes: inserting may fail due to overlap!
+ if (pHint->IsNesting())
+ {
+ const bool bRet(
+ TryInsertNesting(rNode, *static_cast<SwTxtAttrNesting*>(pHint)));
+ if (!bRet) return false;
+ }
// Currently REFMARK and TOXMARK have OverlapAllowed set to true.
// These attributes may be inserted directly.
// Also attributes without length may be inserted directly.
// SETATTR_NOHINTADJUST is set e.g., during undo.
// Portion building in not necessary during XML import.
+ else
if ( !bNoHintAdjustMode &&
!pHint->IsOverlapAllowedAttr() &&
!rNode.GetDoc()->IsInXMLImport() &&
( RES_TXTATR_AUTOFMT == nWhich ||
- RES_TXTATR_INETFMT == nWhich ||
- RES_TXTATR_CHARFMT == nWhich ||
- RES_TXTATR_CJK_RUBY == nWhich ) )
+ RES_TXTATR_CHARFMT == nWhich ) )
{
ASSERT( nWhich != RES_TXTATR_AUTOFMT ||
static_cast<const SwFmtAutoFmt&>(pHint->GetAttr()).GetStyleHandle()->GetPool() ==
@@ -2252,10 +2700,10 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
// multiple times
// FME 2007-11-08 #i82989# in NOHINTADJUST mode, we want to insert
// character attributes directly
- if ( ( RES_TXTATR_CHARFMT == nWhich && !bNoHintAdjustMode ) ||
- RES_TXTATR_CJK_RUBY == nWhich ||
- RES_TXTATR_INETFMT == nWhich )
+ if ( ( RES_TXTATR_CHARFMT == nWhich && !bNoHintAdjustMode ) )
+ {
BuildPortions( rNode, *pHint, nMode );
+ }
else
{
// --> FME 2007-11-08 #i82989# Check sort numbers in NoHintAdjustMode
@@ -2280,7 +2728,7 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
CHECK;
#endif
- return;
+ return true;
}
/*************************************************************************
@@ -2348,7 +2796,6 @@ void SwTxtNode::ClearSwpHintsArr( bool bDelFields )
break;
case RES_TXTATR_FIELD:
- case RES_TXTATR_HARDBLANK:
if( bDelFields )
bDel = true;
break;
@@ -2435,20 +2882,22 @@ sal_Unicode GetCharOfTxtAttr( const SwTxtAttr& rAttr )
sal_Unicode cRet = CH_TXTATR_BREAKWORD;
switch ( rAttr.Which() )
{
- case RES_TXTATR_REFMARK:
- case RES_TXTATR_TOXMARK:
-
-// case RES_TXTATR_FIELD: ??????
-// case RES_TXTATR_FLYCNT, // 29
+ case RES_TXTATR_FTN:
+ case RES_TXTATR_REFMARK:
+ case RES_TXTATR_TOXMARK:
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ cRet = CH_TXTATR_INWORD;
+ break;
- case RES_TXTATR_FTN:
- cRet = CH_TXTATR_INWORD;
- break;
+ case RES_TXTATR_FIELD:
+ case RES_TXTATR_FLYCNT:
+ cRet = CH_TXTATR_BREAKWORD;
+ break;
- // depends on the character ??
-// case RES_TXTATR_HARDBLANK:
-// cRet = CH_TXTATR_INWORD;
-// break;
+ default:
+ ASSERT(false, "GetCharOfTxtAttr: unknown attr");
+ break;
}
return cRet;
}
diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx
index 17c94a9e20c9..0ce234483f40 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -37,17 +37,18 @@
#include <fmtfld.hxx>
#include <docufld.hxx>
-SwTxtAttr::SwTxtAttr( const SfxPoolItem& rAttr, xub_StrLen nStart )
+SwTxtAttr::SwTxtAttr( SfxPoolItem& rAttr, xub_StrLen nStart )
: m_pAttr( &rAttr )
, m_nStart( nStart )
, m_bDontExpand( false )
, m_bLockExpandFlag( false )
- , m_bDontMergeAttr( false )
, m_bDontMoveAttr( false )
, m_bCharFmtAttr( false )
, m_bOverlapAllowedAttr( false )
, m_bPriorityAttr( false )
, m_bDontExpandStart( false )
+ , m_bNesting( false )
+ , m_bHasDummyChar( false )
{
}
@@ -60,11 +61,12 @@ xub_StrLen* SwTxtAttr::GetEnd()
return 0;
}
-// RemoveFromPool must be called before destructor!
-void SwTxtAttr::RemoveFromPool( SfxItemPool& rPool )
+void SwTxtAttr::Destroy( SwTxtAttr * pToDestroy, SfxItemPool& rPool )
{
- rPool.Remove( GetAttr() );
- m_pAttr = 0;
+ if (!pToDestroy) return;
+ SfxPoolItem * const pAttr = pToDestroy->m_pAttr;
+ delete pToDestroy;
+ rPool.Remove( *pAttr );
}
int SwTxtAttr::operator==( const SwTxtAttr& rAttr ) const
@@ -72,7 +74,7 @@ int SwTxtAttr::operator==( const SwTxtAttr& rAttr ) const
return GetAttr() == rAttr.GetAttr();
}
-SwTxtAttrEnd::SwTxtAttrEnd( const SfxPoolItem& rAttr,
+SwTxtAttrEnd::SwTxtAttrEnd( SfxPoolItem& rAttr,
xub_StrLen nStart, xub_StrLen nEnd ) :
SwTxtAttr( rAttr, nStart ), m_nEnd( nEnd )
{
diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx
index b35c93bf8c89..7b83db43f5fa 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -55,50 +55,50 @@ SwScriptIterator::SwScriptIterator( const String& rStr, xub_StrLen nStt, sal_Boo
nCurScript( ScriptType::WEAK ),
bForward( bFrwrd )
{
- if( pBreakIt->xBreak.is() )
+ if( pBreakIt->GetBreakIter().is() )
{
if ( ! bFrwrd && nStt )
--nStt;
xub_StrLen nPos = nStt;
- nCurScript = pBreakIt->xBreak->getScriptType( rText, nPos );
+ nCurScript = pBreakIt->GetBreakIter()->getScriptType( rText, nPos );
if( ScriptType::WEAK == nCurScript )
{
if( nPos )
{
- nPos = (xub_StrLen)pBreakIt->xBreak->beginOfScript(
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfScript(
rText, nPos, nCurScript );
if( nPos && nPos < rText.Len() )
{
nStt = --nPos;
- nCurScript = pBreakIt->xBreak->getScriptType( rText,nPos);
+ nCurScript = pBreakIt->GetBreakIter()->getScriptType( rText,nPos);
}
}
}
nChgPos = bForward ?
- (xub_StrLen)pBreakIt->xBreak->endOfScript( rText, nStt, nCurScript ) :
- (xub_StrLen)pBreakIt->xBreak->beginOfScript( rText, nStt, nCurScript );
+ (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( rText, nStt, nCurScript ) :
+ (xub_StrLen)pBreakIt->GetBreakIter()->beginOfScript( rText, nStt, nCurScript );
}
}
sal_Bool SwScriptIterator::Next()
{
sal_Bool bRet = sal_False;
- if( pBreakIt->xBreak.is() )
+ if( pBreakIt->GetBreakIter().is() )
{
if ( bForward && nChgPos < rText.Len() )
{
- nCurScript = pBreakIt->xBreak->getScriptType( rText, nChgPos );
- nChgPos = (xub_StrLen)pBreakIt->xBreak->endOfScript(
+ nCurScript = pBreakIt->GetBreakIter()->getScriptType( rText, nChgPos );
+ nChgPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript(
rText, nChgPos, nCurScript );
bRet = sal_True;
}
else if ( ! bForward && nChgPos )
{
--nChgPos;
- nCurScript = pBreakIt->xBreak->getScriptType( rText, nChgPos );
- nChgPos = (xub_StrLen)pBreakIt->xBreak->beginOfScript(
+ nCurScript = pBreakIt->GetBreakIter()->getScriptType( rText, nChgPos );
+ nChgPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfScript(
rText, nChgPos, nCurScript );
bRet = sal_True;
}
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index eca88502f771..18db65d13dc8 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -46,24 +46,19 @@
#include <poolfmt.hxx> // RES_POOLCHR_INET_...
#include <doc.hxx> // SwDoc
#include <fmtruby.hxx>
-#include <fmthbsh.hxx>
+#include <fmtmeta.hxx>
+
TYPEINIT1(SwTxtINetFmt,SwClient);
TYPEINIT1(SwTxtRuby,SwClient);
-/*************************************************************************
- * class SwTxtHardBlank
- *************************************************************************/
-
-SwTxtHardBlank::SwTxtHardBlank( const SwFmtHardBlank& rAttr, xub_StrLen nStt )
- : SwTxtAttr( rAttr, nStt )
- , m_Char( rAttr.GetChar() )
-{
- ASSERT( ' ' != m_Char && '-' != m_Char,
- "Invalid character for the HardBlank attribute - "
- "must be a normal unicode character" );
-}
+// ATT_XMLCONTAINERITEM ******************************
+SwTxtXMLAttrContainer::SwTxtXMLAttrContainer(
+ SvXMLAttrContainerItem& rAttr,
+ xub_StrLen nStt, xub_StrLen nEnde )
+ : SwTxtAttrEnd( rAttr, nStt, nEnde )
+{}
/*************************************************************************
* class SwTxtCharFmt
@@ -110,20 +105,42 @@ BOOL SwTxtCharFmt::GetInfo( SfxPoolItem& rInfo ) const
return FALSE;
}
+
+/*************************************************************************
+ * class SwTxtAttrNesting
+ *************************************************************************/
+
+SwTxtAttrNesting::SwTxtAttrNesting( SfxPoolItem & i_rAttr,
+ const xub_StrLen i_nStart, const xub_StrLen i_nEnd )
+ : SwTxtAttrEnd( i_rAttr, i_nStart, i_nEnd )
+{
+ SetDontExpand( true ); // never expand this attribute
+ // lock the expand flag: simple guarantee that nesting will not be
+ // invalidated by expand operations
+ SetLockExpandFlag( true );
+ SetDontExpandStartAttr( true );
+ SetNesting( true );
+}
+
+SwTxtAttrNesting::~SwTxtAttrNesting()
+{
+}
+
+
/*************************************************************************
* class SwTxtINetFmt
*************************************************************************/
SwTxtINetFmt::SwTxtINetFmt( SwFmtINetFmt& rAttr,
- xub_StrLen nStt, xub_StrLen nEnde )
- : SwTxtAttrEnd( rAttr, nStt, nEnde )
+ xub_StrLen nStart, xub_StrLen nEnd )
+ : SwTxtAttrNesting( rAttr, nStart, nEnd )
, SwClient( 0 )
, m_pTxtNode( 0 )
, m_bVisited( false )
, m_bVisitedValid( false )
{
rAttr.pTxtAttr = this;
- SetCharFmtAttr( TRUE );
+ SetCharFmtAttr( true );
}
SwTxtINetFmt::~SwTxtINetFmt( )
@@ -212,30 +229,17 @@ BOOL SwTxtINetFmt::IsProtect( ) const
return m_pTxtNode && m_pTxtNode->IsProtect();
}
-// ATT_XNLCONTAINERITEM ******************************
-
-SwTxtXMLAttrContainer::SwTxtXMLAttrContainer(
- const SvXMLAttrContainerItem& rAttr,
- xub_StrLen nStt, xub_StrLen nEnde )
- : SwTxtAttrEnd( rAttr, nStt, nEnde )
-{}
-
-
/*************************************************************************
* class SwTxtRuby
*************************************************************************/
SwTxtRuby::SwTxtRuby( SwFmtRuby& rAttr,
xub_StrLen nStart, xub_StrLen nEnd )
- : SwTxtAttrEnd( rAttr, nStart, nEnd )
+ : SwTxtAttrNesting( rAttr, nStart, nEnd )
, SwClient( 0 )
, m_pTxtNode( 0 )
{
rAttr.pTxtAttr = this;
- SetDontExpand( true ); // never expand this attribute
- SetLockExpandFlag( true );
- SetDontMergeAttr( true );
- SetDontExpandStartAttr( true );
}
SwTxtRuby::~SwTxtRuby()
@@ -310,11 +314,26 @@ SwCharFmt* SwTxtRuby::GetCharFmt()
return pRet;
}
-// ******************************
-SwTxt2Lines::SwTxt2Lines( const SvxTwoLinesItem& rAttr,
- xub_StrLen nStt, xub_StrLen nEnde )
- : SwTxtAttrEnd( rAttr, nStt, nEnde )
+/*************************************************************************
+ * class SwTxtMeta
+ *************************************************************************/
+
+SwTxtMeta::SwTxtMeta( SwFmtMeta & i_rAttr,
+ const xub_StrLen i_nStart, const xub_StrLen i_nEnd )
+ : SwTxtAttrNesting( i_rAttr, i_nStart, i_nEnd )
+ , m_pTxtNode( 0 )
{
+ i_rAttr.SetTxtAttr( this );
+ SetHasDummyChar(true);
+}
+
+SwTxtMeta::~SwTxtMeta()
+{
+ SwFmtMeta & rFmtMeta( static_cast<SwFmtMeta &>(GetAttr()) );
+ if (rFmtMeta.GetTxtAttr() == this)
+ {
+ rFmtMeta.SetTxtAttr(0);
+ }
}
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 51e4963698a7..b34d013f3264 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -368,56 +368,6 @@ static bool lcl_HaveCommonAttributes( IStyleAccess& rStyleAccess,
return bRet;
}
-/*
- * Ein Zeichen wurde eingefuegt.
- */
-
-SwTxtNode& SwTxtNode::Insert( xub_Unicode c, const SwIndex &rIdx )
-{
- xub_StrLen nOrigLen = m_Text.Len();
-
- ASSERT( rIdx <= nOrigLen, "SwTxtNode::Insert: invalid index." );
- ASSERT( nOrigLen < STRING_LEN,
- "SwTxtNode::Insert: node text with insertion > STRING_LEN." );
-
- if ( nOrigLen == m_Text.Insert( c, rIdx.GetIndex() ).Len() )
- return *this;
-
- Update(rIdx,1);
-
- // leere Hints und Feldattribute an rIdx.GetIndex suchen
- if ( HasHints() )
- {
- USHORT* pEndIdx;
- for ( USHORT i=0; i < m_pSwpHints->Count() &&
- rIdx >= *(*m_pSwpHints)[i]->GetStart(); ++i)
- {
- SwTxtAttr *pHt = m_pSwpHints->GetTextHint(i);
- pEndIdx = pHt->GetEnd();
- if ( pEndIdx )
- {
- // leere Hints an rIdx.GetIndex ?
- BOOL bEmpty = *pEndIdx == *pHt->GetStart()
- && rIdx == *pHt->GetStart();
-
- if( bEmpty )
- {
- m_pSwpHints->DeleteAtPos(i);
- if( bEmpty )
- *pHt->GetStart() -= 1;
- else
- *pEndIdx -= 1;
- Insert(pHt);
- }
- }
- }
- TryDeleteSwpHints();
- }
- // den Frames Bescheid sagen
- SwInsChr aHint( rIdx.GetIndex()-1 );
- SwModify::Modify( 0, &aHint );
- return *this;
-}
inline BOOL InRange(xub_StrLen nIdx, xub_StrLen nStart, xub_StrLen nEnd) {
return ((nIdx >=nStart) && (nIdx <= nEnd));
@@ -454,7 +404,6 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
USHORT i = 0;
xub_StrLen nStt = rIdx.GetIndex();
xub_StrLen nEnd = nStt + nLen;
- xub_StrLen *pAttrEnd;
xub_StrLen nAttrStart;
SwTxtAttr *pHt;
@@ -479,8 +428,8 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
pHt = m_pSwpHints->GetTextHint(i);
// attributes without end stay in!
- pAttrEnd = pHt->GetEnd();
- if ( !pAttrEnd )
+ xub_StrLen * const pAttrEnd = pHt->GetEnd();
+ if ( !pAttrEnd /*|| pHt->HasDummyChar()*/ ) // see bInclRefToxMark
{
i++;
continue;
@@ -514,8 +463,12 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
else if ( !bInclRefToxMark )
{
// 3. case: Reset all attributes except from ref/toxmarks:
- bSkipAttr = RES_TXTATR_REFMARK == pHt->Which() ||
- RES_TXTATR_TOXMARK == pHt->Which();
+ // skip hints with CH_TXTATR here
+ // (deleting those is ONLY allowed for UNDO!)
+ bSkipAttr = RES_TXTATR_REFMARK == pHt->Which()
+ || RES_TXTATR_TOXMARK == pHt->Which()
+ || RES_TXTATR_META == pHt->Which()
+ || RES_TXTATR_METAFIELD == pHt->Which();
}
if ( bSkipAttr )
@@ -547,8 +500,9 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
if ( pStyleHandle.get() )
{
- SwTxtAttr* pNew = MakeTxtAttr( *pStyleHandle, nAttrStart, nAttrEnd );
- Insert( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
+ SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
+ *pStyleHandle, nAttrStart, nAttrEnd );
+ InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
// if the last attribute is a Field, the HintsArray is
@@ -574,8 +528,9 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
if ( pStyleHandle.get() && nAttrStart < nEnd )
{
- SwTxtAttr* pNew = MakeTxtAttr( *pStyleHandle, nAttrStart, nEnd );
- Insert( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
+ SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
+ *pStyleHandle, nAttrStart, nEnd );
+ InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
bChanged = TRUE;
@@ -601,8 +556,9 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
if ( pStyleHandle.get() )
{
- SwTxtAttr* pNew = MakeTxtAttr( *pStyleHandle, nStt, nAttrEnd );
- Insert( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
+ SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
+ *pStyleHandle, nStt, nAttrEnd );
+ InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
}
else if( nLen ) // Fall: 4
@@ -620,20 +576,23 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
if ( pStyleHandle.get() && nStt < nEnd )
{
- SwTxtAttr* pNew = MakeTxtAttr( *pStyleHandle, nStt, nEnd );
- Insert( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
+ SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
+ *pStyleHandle, nStt, nEnd );
+ InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
if( nEnd < nTmpEnd )
{
- SwTxtAttr* pNew = MakeTxtAttr( pHt->GetAttr(), nEnd, nTmpEnd );
+ SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
+ pHt->GetAttr(), nEnd, nTmpEnd );
if ( pNew )
{
SwTxtCharFmt* pCharFmt = dynamic_cast<SwTxtCharFmt*>(pHt);
if ( pCharFmt )
static_cast<SwTxtCharFmt*>(pNew)->SetSortNumber( pCharFmt->GetSortNumber() );
- Insert( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
+ InsertHint( pNew,
+ nsSetAttrMode::SETATTR_NOHINTADJUST );
}
@@ -682,7 +641,7 @@ XubString SwTxtNode::GetCurWord( xub_StrLen nPos ) const
return m_Text;
Boundary aBndry;
- const uno::Reference< XBreakIterator > &rxBreak = pBreakIt->xBreak;
+ const uno::Reference< XBreakIterator > &rxBreak = pBreakIt->GetBreakIter();
if (rxBreak.is())
{
sal_Int16 nWordType = WordType::DICTIONARY_WORD;
@@ -750,7 +709,7 @@ BOOL SwScanner::NextWord()
{
if ( !pLanguage )
{
- const USHORT nNextScriptType = pBreakIt->xBreak->getScriptType( rText, nBegin );
+ const USHORT nNextScriptType = pBreakIt->GetBreakIter()->getScriptType( rText, nBegin );
ModelToViewHelper::ModelPosition aModelBeginPos = ModelToViewHelper::ConvertToModelPosition( pConversionMap, nBegin );
const xub_StrLen nBeginModelPos = (xub_StrLen)aModelBeginPos.mnPos;
aCurrLang = rNode.GetLang( nBeginModelPos, 1, nNextScriptType );
@@ -772,7 +731,7 @@ BOOL SwScanner::NextWord()
return FALSE;
// get the word boundaries
- aBound = pBreakIt->xBreak->getWordBoundary( rText, nBegin,
+ aBound = pBreakIt->GetBreakIter()->getWordBoundary( rText, nBegin,
pBreakIt->GetLocale( aCurrLang ), nWordType, sal_True );
//no word boundaries could be found
@@ -795,11 +754,11 @@ BOOL SwScanner::NextWord()
// restrict boundaries to script boundaries and nEndPos
const USHORT nCurrScript =
- pBreakIt->xBreak->getScriptType( rText, nBegin );
+ pBreakIt->GetBreakIter()->getScriptType( rText, nBegin );
XubString aTmpWord = rText.Copy( nBegin, static_cast<xub_StrLen>(aBound.endPos - nBegin) );
const sal_Int32 nScriptEnd = nBegin +
- pBreakIt->xBreak->endOfScript( aTmpWord, 0, nCurrScript );
+ pBreakIt->GetBreakIter()->endOfScript( aTmpWord, 0, nCurrScript );
const sal_Int32 nEnd = Min( aBound.endPos, nScriptEnd );
// restrict word start to last script change position
@@ -810,7 +769,7 @@ BOOL SwScanner::NextWord()
aTmpWord = rText.Copy( static_cast<xub_StrLen>(aBound.startPos),
static_cast<xub_StrLen>(nBegin - aBound.startPos + 1) );
nScriptBegin = aBound.startPos +
- pBreakIt->xBreak->beginOfScript( aTmpWord, nBegin - aBound.startPos,
+ pBreakIt->GetBreakIter()->beginOfScript( aTmpWord, nBegin - aBound.startPos,
nCurrScript );
}
@@ -820,11 +779,11 @@ BOOL SwScanner::NextWord()
else
{
const USHORT nCurrScript =
- pBreakIt->xBreak->getScriptType( rText, aBound.startPos );
+ pBreakIt->GetBreakIter()->getScriptType( rText, aBound.startPos );
XubString aTmpWord = rText.Copy( static_cast<xub_StrLen>(aBound.startPos),
static_cast<xub_StrLen>(aBound.endPos - aBound.startPos) );
const sal_Int32 nScriptEnd = aBound.startPos +
- pBreakIt->xBreak->endOfScript( aTmpWord, 0, nCurrScript );
+ pBreakIt->GetBreakIter()->endOfScript( aTmpWord, 0, nCurrScript );
const sal_Int32 nEnd = Min( aBound.endPos, nScriptEnd );
nBegin = (xub_StrLen)aBound.startPos;
nLen = (xub_StrLen)(nEnd - nBegin);
@@ -1003,7 +962,7 @@ void SwTxtNode::SetLanguageAndFont( const SwPaM &rPaM,
aSet.Put( aFontItem );
}
- GetDoc()->Insert( rPaM, aSet, 0 );
+ GetDoc()->InsertItemSet( rPaM, aSet, 0 );
// SetAttr( aSet ); <- Does not set language attribute of empty paragraphs correctly,
// <- because since there is no selection the flag to garbage
// <- collect all attributes is set, and therefore attributes spanned
@@ -1196,7 +1155,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
LanguageType eActLang = pNode->GetLang( nBegin );
Boundary aBound =
- pBreakIt->xBreak->getWordBoundary( pNode->GetTxt(), nBegin,
+ pBreakIt->GetBreakIter()->getWordBoundary( pNode->GetTxt(), nBegin,
pBreakIt->GetLocale( eActLang ),
WordType::DICTIONARY_WORD, TRUE );
nBegin = xub_StrLen(aBound.startPos);
@@ -1352,8 +1311,8 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
{
const LanguageType aCurrLang = pNode->GetLang( nBegin );
const com::sun::star::lang::Locale aCurrLocale = pBreakIt->GetLocale( aCurrLang );
- nBegin = static_cast< xub_StrLen >(pBreakIt->xBreak->beginOfSentence( rText, nBegin, aCurrLocale ));
- nEnd = static_cast< xub_StrLen >(Min( rText.getLength(), pBreakIt->xBreak->endOfSentence( rText, nEnd, aCurrLocale ) ));
+ nBegin = static_cast< xub_StrLen >(pBreakIt->GetBreakIter()->beginOfSentence( rText, nBegin, aCurrLocale ));
+ nEnd = static_cast< xub_StrLen >(Min( rText.getLength(), pBreakIt->GetBreakIter()->endOfSentence( rText, nEnd, aCurrLocale ) ));
}
}
}
@@ -1753,7 +1712,7 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
const bool bCount = aExpandText.getLength() > 0;
// count words in 'regular' text:
- if( bCount && pBreakIt->xBreak.is() )
+ if( bCount && pBreakIt->GetBreakIter().is() )
{
const String aScannerText( aExpandText );
SwScanner aScanner( *this, aScannerText, 0, pConversionMap,
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 07eb7182d717..1eeb9246dffe 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -679,22 +679,27 @@ SwUndoIdAndName * lcl_GetUndoIdAndName(const SwUndos & rUndos, sal_uInt16 nPos )
int nTmpPos = nPos + pUndoStart->GetEndOffset();
int nSubstitute = -1;
- SwUndo * pTmpUndo;
- do
+ // --> OD 2009-09-30 #i105457#
+ if ( nTmpPos > 0 )
+ // <--
{
- nTmpPos--;
- pTmpUndo = rUndos[ static_cast<USHORT>(nTmpPos) ];
+ SwUndo * pTmpUndo;
+ do
+ {
+ nTmpPos--;
+ pTmpUndo = rUndos[ static_cast<USHORT>(nTmpPos) ];
- if (pTmpUndo->GetEffectiveId() > UNDO_END)
- nSubstitute = nTmpPos;
- }
- while (nSubstitute < 0 && nTmpPos > nPos);
+ if (pTmpUndo->GetEffectiveId() > UNDO_END)
+ nSubstitute = nTmpPos;
+ }
+ while (nSubstitute < 0 && nTmpPos > nPos);
- if (nSubstitute >= 0)
- {
- SwUndo * pSubUndo = rUndos[ static_cast<USHORT>(nSubstitute) ];
- nId = pSubUndo->GetEffectiveId();
- sStr = pSubUndo->GetComment();
+ if (nSubstitute >= 0)
+ {
+ SwUndo * pSubUndo = rUndos[ static_cast<USHORT>(nSubstitute) ];
+ nId = pSubUndo->GetEffectiveId();
+ sStr = pSubUndo->GetComment();
+ }
}
}
else
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index ec62ab78de79..ffc831fe16e5 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -352,7 +352,7 @@ void SwHistorySetRefMark::SetInDoc( SwDoc* pDoc, bool )
// if a reference mark without an end already exists here: must not insert!
if ( m_nStart != m_nEnd ||
- !pTxtNd->GetTxtAttr( m_nStart, RES_TXTATR_REFMARK ) )
+ !pTxtNd->GetTxtAttrForCharAt( m_nStart, RES_TXTATR_REFMARK ) )
{
pTxtNd->InsertItem( aRefMark, m_nStart, m_nEnd,
nsSetAttrMode::SETATTR_NOTXTATRCHR );
@@ -433,7 +433,7 @@ void SwHistoryResetTxt::SetInDoc( SwDoc* pDoc, bool )
ASSERT( pTxtNd, "SwHistoryResetTxt: no TextNode" );
if ( pTxtNd )
{
- pTxtNd->Delete( m_nAttr, m_nStart, m_nEnd );
+ pTxtNd->DeleteAttributes( m_nAttr, m_nStart, m_nEnd );
}
}
@@ -514,12 +514,13 @@ void SwHistorySetFootnote::SetInDoc( SwDoc* pDoc, bool )
m_pUndo->GetHistory()->Rollback( pDoc );
}
- pTxtNd->Insert( pTxtFtn );
+ pTxtNd->InsertHint( pTxtFtn );
}
else
{
- SwTxtFtn *pFtn = const_cast<SwTxtFtn*>(
- static_cast<const SwTxtFtn*>(pTxtNd->GetTxtAttr( m_nStart )));
+ SwTxtFtn * const pFtn =
+ const_cast<SwTxtFtn*>( static_cast<const SwTxtFtn*>(
+ pTxtNd->GetTxtAttrForCharAt( m_nStart )));
SwFmtFtn &rFtn = const_cast<SwFmtFtn&>(pFtn->GetFtn());
rFtn.SetNumStr( m_FootnoteNumber );
if ( rFtn.IsEndNote() != m_bEndNote )
@@ -615,6 +616,14 @@ SwHistoryBookmark::SwHistoryBookmark(
{
m_aKeycode = pBookmark->GetKeyCode();
m_aShortName = pBookmark->GetShortName();
+
+ ::sfx2::Metadatable * const pMetadatable(
+ const_cast< ::sfx2::Metadatable * >( // CreateUndo should be const?
+ dynamic_cast< ::sfx2::Metadatable const* >(pBookmark)));
+ if (pMetadatable)
+ {
+ m_pMetadataUndo = pMetadatable->CreateUndo();
+ }
}
}
@@ -681,6 +690,16 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool )
{
pBookmark->SetKeyCode(m_aKeycode);
pBookmark->SetShortName(m_aShortName);
+ if (m_pMetadataUndo)
+ {
+ ::sfx2::Metadatable * const pMeta(
+ dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
+ OSL_ENSURE(pMeta, "metadata undo, but not metadatable?");
+ if (pMeta)
+ {
+ pMeta->RestoreMetadata(m_pMetadataUndo);
+ }
+ }
}
}
pDoc->DoUndo(bDoesUndo);
@@ -819,6 +838,25 @@ SwHistoryResetAttrSet::SwHistoryResetAttrSet( const SfxItemSet& rSet,
while( TRUE )
{
const USHORT nWhich = aIter.GetCurItem()->Which();
+
+#ifndef PRODUCT
+ switch (nWhich)
+ {
+ case RES_TXTATR_REFMARK:
+ case RES_TXTATR_TOXMARK:
+ if (m_nStart != m_nEnd) break; // else: fall through!
+ case RES_TXTATR_FIELD:
+ case RES_TXTATR_FLYCNT:
+ case RES_TXTATR_FTN:
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ ASSERT(rSet.Count() == 1,
+ "text attribute with CH_TXTATR, but not the only one:"
+ "\nnot such a good idea");
+ break;
+ }
+#endif
+
// Character attribute cannot be inserted into the hints array
// anymore. Therefore we have to treat them as one RES_TXTATR_AUTOFMT:
if (isCHRATR(nWhich))
@@ -868,7 +906,7 @@ void SwHistoryResetAttrSet::SetInDoc( SwDoc* pDoc, bool )
for ( USHORT n = m_Array.Count(); n; --n, ++pArr )
{
static_cast<SwTxtNode*>(pCntntNd)->
- Delete( *pArr, m_nStart, m_nEnd );
+ DeleteAttributes( *pArr, m_nStart, m_nEnd );
}
}
}
@@ -1292,7 +1330,6 @@ void SwHistory::CopyAttr( SwpHints* pHts, ULONG nNodeIdx,
switch( pHt->Which() )
{
case RES_TXTATR_FIELD:
- case RES_TXTATR_HARDBLANK:
// keine Felder, .. kopieren ??
if( !bFields )
bNextAttr = TRUE;
@@ -1397,40 +1434,45 @@ void SwRegHistory::AddHint( SwTxtAttr* pHt, const bool bNew )
}
-SwRegHistory::SwRegHistory( SwTxtNode* pTxtNode, const SfxItemSet& rSet,
- xub_StrLen nStart, xub_StrLen nEnd, USHORT nFlags,
- SwHistory* pHst )
- : SwClient( pTxtNode )
- , m_pHistory( pHst )
- , m_nNodeIndex( pTxtNode->GetIndex() )
+bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
+ xub_StrLen const nStart, xub_StrLen const nEnd, SetAttrMode const nFlags )
{
if( !rSet.Count() )
- return;
+ return false;
- BOOL bInsert;
+ SwTxtNode * const pTxtNode =
+ dynamic_cast<SwTxtNode *>(const_cast<SwModify *>(GetRegisteredIn()));
- if( pTxtNode->GetpSwpHints() && pHst )
+ ASSERT(pTxtNode, "SwRegHistory not registered at text node?");
+ if (!pTxtNode)
+ return false;
+
+ if ( pTxtNode->GetpSwpHints() && m_pHistory )
{
pTxtNode->GetpSwpHints()->Register( this );
- bInsert = pTxtNode->SetAttr( rSet, nStart, nEnd, nFlags );
+ }
+
+ const bool bInserted = pTxtNode->SetAttr( rSet, nStart, nEnd, nFlags );
+
// Achtung: Durch das Einfuegen eines Attributs kann das Array
// geloescht werden!!! Wenn das einzufuegende zunaechst ein vorhandenes
// loescht, selbst aber nicht eingefuegt werden braucht, weil die
// Absatzattribute identisch sind( -> bForgetAttr in SwpHints::Insert )
- if ( pTxtNode->GetpSwpHints() )
- pTxtNode->GetpSwpHints()->DeRegister();
+ if ( pTxtNode->GetpSwpHints() && m_pHistory )
+ {
+ pTxtNode->GetpSwpHints()->DeRegister();
}
- else
- bInsert = pTxtNode->SetAttr( rSet, nStart, nEnd, nFlags );
- if( pHst && bInsert )
+ if ( m_pHistory && bInserted )
{
SwHistoryHint* pNewHstr = new SwHistoryResetAttrSet( rSet,
pTxtNode->GetIndex(), nStart, nEnd );
// der NodeIndex kann verschoben sein !!
- pHst->m_SwpHstry.Insert( pNewHstr, pHst->Count() );
+ m_pHistory->m_SwpHstry.Insert( pNewHstr, m_pHistory->Count() );
}
+
+ return bInserted;
}
void SwRegHistory::RegisterInModify( SwModify* pRegIn, const SwNode& rNd )
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 7177a622e21b..e5312b3cefdd 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -560,18 +560,17 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
SwTxtNode *pTxtNode = (SwTxtNode*)&pPos->nNode.GetNode();
ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
- SwTxtAttr * pHnt = pTxtNode->GetTxtAttr( nIdx, RES_TXTATR_FLYCNT );
-#ifndef PRODUCT
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
"Missing FlyInCnt-Hint." );
ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFrmFmt,
"Wrong TxtFlyCnt-Hint." );
-#endif
const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt();
//Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet
//werden.
- pTxtNode->Delete( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
}
{
@@ -618,8 +617,9 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
{
const SwPosition* pPos = aNewAnchor.GetCntntAnchor();
SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
- ASSERT( pTxtNd, "Kein Textnode an dieser Position" );
- pTxtNd->InsertItem( SwFmtFlyCnt( pFrmFmt ), pPos->nContent.GetIndex(), 0 );
+ ASSERT( pTxtNd, "no Text Node at position." );
+ SwFmtFlyCnt aFmt( pFrmFmt );
+ pTxtNd->InsertItem( aFmt, pPos->nContent.GetIndex(), 0 );
}
@@ -767,7 +767,9 @@ void SwUndoResetAttr::Redo( SwUndoIter& rUndoIter )
}
// gefunden, also loeschen
if( nCnt-- )
- rDoc.Delete( aArr[ nCnt ] );
+ {
+ rDoc.DeleteTOXMark( aArr[ nCnt ] );
+ }
}
}
break;
@@ -815,7 +817,7 @@ void SwUndoResetAttr::SetAttrs( const SvUShortsSort& rArr )
SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr,
- USHORT nFlags )
+ const SetAttrMode nFlags )
: SwUndo( UNDO_INSATTR ), SwUndRng( rRange )
, m_AttrSet( rRange.GetDoc()->GetAttrPool(), rAttr.Which(), rAttr.Which() )
, m_pHistory( new SwHistory )
@@ -828,7 +830,7 @@ SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr,
}
SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxItemSet& rSet,
- USHORT nFlags )
+ const SetAttrMode nFlags )
: SwUndo( UNDO_INSATTR ), SwUndRng( rRange )
, m_AttrSet( rSet )
, m_pHistory( new SwHistory )
@@ -899,7 +901,7 @@ void SwUndoAttr::Undo( SwUndoIter& rUndoIter )
const bool bToLast = (1 == m_AttrSet.Count())
&& (RES_TXTATR_FIELD <= *m_AttrSet.GetRanges())
- && (*m_AttrSet.GetRanges() <= RES_TXTATR_HARDBLANK);
+ && (*m_AttrSet.GetRanges() <= RES_TXTATR_FTN);
// restore old values
m_pHistory->TmpRollback( pDoc, 0, !bToLast );
@@ -948,15 +950,15 @@ void SwUndoAttr::Repeat( SwUndoIter& rUndoIter )
// RefMarks are not repeat capable
if ( SFX_ITEM_SET != m_AttrSet.GetItemState( RES_TXTATR_REFMARK, FALSE ) )
{
- rUndoIter.GetDoc().Insert( *rUndoIter.pAktPam,
- m_AttrSet, m_nInsertFlags );
+ rUndoIter.GetDoc().InsertItemSet( *rUndoIter.pAktPam,
+ m_AttrSet, m_nInsertFlags );
}
else if ( 1 < m_AttrSet.Count() )
{
SfxItemSet aTmpSet( m_AttrSet );
aTmpSet.ClearItem( RES_TXTATR_REFMARK );
- rUndoIter.GetDoc().Insert( *rUndoIter.pAktPam,
- aTmpSet, m_nInsertFlags );
+ rUndoIter.GetDoc().InsertItemSet( *rUndoIter.pAktPam,
+ aTmpSet, m_nInsertFlags );
}
rUndoIter.pLastUndoObj = this;
}
@@ -974,7 +976,7 @@ void SwUndoAttr::Redo( SwUndoIter& rUndoIter )
RedlineMode_t eOld = rDoc.GetRedlineMode();
rDoc.SetRedlineMode_intern(static_cast<RedlineMode_t>(
eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
- rDoc.Insert( rPam, m_AttrSet, m_nInsertFlags );
+ rDoc.InsertItemSet( rPam, m_AttrSet, m_nInsertFlags );
if ( ULONG_MAX != m_nNodeIndex )
{
@@ -995,7 +997,7 @@ void SwUndoAttr::Redo( SwUndoIter& rUndoIter )
}
else
{
- rDoc.Insert( rPam, m_AttrSet, m_nInsertFlags );
+ rDoc.InsertItemSet( rPam, m_AttrSet, m_nInsertFlags );
}
rUndoIter.pLastUndoObj = 0;
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 0ed447d8204f..d9a2e6e8486c 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -386,7 +386,7 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
// loesche jetzt noch den Text (alle Attribut-Aenderungen kommen in
// die Undo-History
pSttStr = (String*)new String( pSttTxtNd->GetTxt().Copy( nSttCntnt, nLen ));
- pSttTxtNd->Erase( pStt->nContent, nLen );
+ pSttTxtNd->EraseText( pStt->nContent, nLen );
if( pSttTxtNd->GetpSwpHints() )
pSttTxtNd->GetpSwpHints()->DeRegister();
@@ -422,7 +422,7 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
// die Undo-History
pEndStr = (String*)new String( pEndTxtNd->GetTxt().Copy( 0,
pEnd->nContent.GetIndex() ));
- pEndTxtNd->Erase( aEndIdx, pEnd->nContent.GetIndex() );
+ pEndTxtNd->EraseText( aEndIdx, pEnd->nContent.GetIndex() );
if( pEndTxtNd->GetpSwpHints() )
pEndTxtNd->GetpSwpHints()->DeRegister();
@@ -511,7 +511,7 @@ BOOL SwUndoDelete::CanGrouping( SwDoc* pDoc, const SwPaM& rDelPam )
nUChrPos++;
}
pSttStr->Insert( cDelChar, nUChrPos );
- pDelTxtNd->Erase( pStt->nContent, 1 );
+ pDelTxtNd->EraseText( pStt->nContent, 1 );
bGroup = TRUE;
return TRUE;
@@ -711,7 +711,8 @@ void SwUndoDelete::Undo( SwUndoIter& rUndoIter )
}
if( pTxtNd )
{
- pTxtNd->Insert( *pEndStr, aPos.nContent, INS_NOHINTEXPAND );
+ pTxtNd->InsertText( *pEndStr, aPos.nContent,
+ IDocumentContentOperations::INS_NOHINTEXPAND );
// METADATA: restore
pTxtNd->RestoreMetadata(m_pMetadataUndoEnd);
}
@@ -804,7 +805,8 @@ void SwUndoDelete::Undo( SwUndoIter& rUndoIter )
// SectionNode-Modus und von oben nach unten selektiert:
// -> im StartNode steht noch der Rest vom Join => loeschen
aPos.nContent.Assign( pTxtNd, nSttCntnt );
- pTxtNd->Insert( *pSttStr, aPos.nContent, INS_NOHINTEXPAND );
+ pTxtNd->InsertText( *pSttStr, aPos.nContent,
+ IDocumentContentOperations::INS_NOHINTEXPAND );
// METADATA: restore
pTxtNd->RestoreMetadata(m_pMetadataUndoStart);
}
diff --git a/sw/source/core/undo/undo.src b/sw/source/core/undo/undo.src
index 6437d9f60306..2cf91da28ba3 100644
--- a/sw/source/core/undo/undo.src
+++ b/sw/source/core/undo/undo.src
@@ -54,7 +54,7 @@ String STR_SPLITNODE_UNDO
};
String STR_MOVE_UNDO
{
- Text [ en-US ] = "Move: $1" ;
+ Text [ en-US ] = "Move" ;
};
String STR_INSATTR_UNDO
{
@@ -612,7 +612,7 @@ String STR_CHART
};
String STR_NOTE
{
- Text [ en-US ] = "note";
+ Text [ en-US ] = "comment";
};
String STR_REFERENCE
{
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index d84b12ba5bda..87522d4d59f8 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -330,7 +330,7 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
}
else
{
- rDoc.GetNodes().Move( rPaM, aPos, rNds, FALSE );
+ rDoc.GetNodes().MoveRange( rPaM, aPos, rNds );
SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode();
if( pTxtNd ) // fuege einen Trenner fuer die Attribute ein !
@@ -350,7 +350,10 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
++aPos.nContent;
}
else
- pTxtNd->Insert( ' ', aPos.nContent, INS_NOHINTEXPAND);
+ {
+ pTxtNd->InsertText( sal_Unicode(' '), aPos.nContent,
+ IDocumentContentOperations::INS_NOHINTEXPAND );
+ }
}
}
if( pEndNdIdx )
@@ -404,7 +407,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, ULONG nNodeIdx,
if( pTxtNd->GetTxt().Len() )
{
GoInCntnt( aPaM, fnMoveBackward );
- pTxtNd->Erase( aPaM.GetPoint()->nContent, 1 );
+ pTxtNd->EraseText( aPaM.GetPoint()->nContent, 1 );
}
aPaM.SetMark();
@@ -413,7 +416,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, ULONG nNodeIdx,
_SaveRedlEndPosForRestore aRedlRest( rInsPos.nNode, rInsPos.nContent.GetIndex() );
- rNds.Move( aPaM, rInsPos, rDoc.GetNodes() );
+ rNds.MoveRange( aPaM, rInsPos, rDoc.GetNodes() );
// noch den letzen Node loeschen.
if( !aPaM.GetPoint()->nContent.GetIndex() ||
@@ -537,11 +540,12 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
SwTxtNode* pTxtNd = (SwTxtNode*)pFtnNd;
if( !pHistory )
pHistory = new SwHistory;
- SwTxtAttr* pFtnHnt = pTxtNd->GetTxtAttr( nFtnSttIdx );
+ SwTxtAttr* const pFtnHnt =
+ pTxtNd->GetTxtAttrForCharAt( nFtnSttIdx );
ASSERT( pFtnHnt, "kein FtnAttribut" );
SwIndex aIdx( pTxtNd, nFtnSttIdx );
pHistory->Add( pFtnHnt, pTxtNd->GetIndex(), false );
- pTxtNd->Erase( aIdx, 1 );
+ pTxtNd->EraseText( aIdx, 1 );
}
while( nPos-- && ( pFtnNd = &( pSrch = rFtnArr[ nPos ] )->
@@ -560,11 +564,12 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
SwTxtNode* pTxtNd = (SwTxtNode*)pFtnNd;
if( !pHistory )
pHistory = new SwHistory;
- SwTxtAttr* pFtnHnt = pTxtNd->GetTxtAttr( nFtnSttIdx );
+ SwTxtAttr* const pFtnHnt =
+ pTxtNd->GetTxtAttrForCharAt( nFtnSttIdx );
ASSERT( pFtnHnt, "kein FtnAttribut" );
SwIndex aIdx( pTxtNd, nFtnSttIdx );
pHistory->Add( pFtnHnt, pTxtNd->GetIndex(), false );
- pTxtNd->Erase( aIdx, 1 );
+ pTxtNd->EraseText( aIdx, 1 );
}
}
}
@@ -598,7 +603,8 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
if( !pHistory )
pHistory = new SwHistory;
SwTxtNode* pTxtNd = pDoc->GetNodes()[ pAPos->nNode]->GetTxtNode();
- SwTxtAttr* pFlyHnt = pTxtNd->GetTxtAttr( pAPos->nContent.GetIndex());
+ SwTxtAttr* const pFlyHnt = pTxtNd->GetTxtAttrForCharAt(
+ pAPos->nContent.GetIndex());
ASSERT( pFlyHnt, "kein FlyAttribut" );
pHistory->Add( pFlyHnt, 0, false );
// n wieder zurueck, damit nicht ein Format uebesprungen wird !
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index baff3c0d5ce6..dd261282e5c7 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -123,9 +123,9 @@ void SwUndoFlyBase::InsFly( SwUndoIter& rUndoIter, BOOL bShowSelFrm )
{
// es muss mindestens das Attribut im TextNode stehen
SwCntntNode* pCNd = aAnchor.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
- ASSERT( pCNd->IsTxtNode(), "Kein Textnode an dieser Position" );
- ((SwTxtNode*)pCNd)->InsertItem( SwFmtFlyCnt(
- (SwFlyFrmFmt*)pFrmFmt ), nCntPos, nCntPos );
+ ASSERT( pCNd->IsTxtNode(), "no Text Node at position." );
+ SwFmtFlyCnt aFmt( pFrmFmt );
+ static_cast<SwTxtNode*>(pCNd)->InsertItem( aFmt, nCntPos, nCntPos );
}
pFrmFmt->MakeFrms();
@@ -199,14 +199,15 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc )
nCntPos = pPos->nContent.GetIndex();
SwTxtNode *pTxtNd = pDoc->GetNodes()[ pPos->nNode ]->GetTxtNode();
ASSERT( pTxtNd, "Kein Textnode gefunden" );
- SwTxtFlyCnt* pAttr = (SwTxtFlyCnt*)pTxtNd->GetTxtAttr( nCntPos );
+ SwTxtFlyCnt* const pAttr = static_cast<SwTxtFlyCnt*>(
+ pTxtNd->GetTxtAttrForCharAt( nCntPos, RES_TXTATR_FLYCNT ) );
// Attribut steht noch im TextNode, loeschen
if( pAttr && pAttr->GetFlyCnt().GetFrmFmt() == pFrmFmt )
{
// Pointer auf 0, nicht loeschen
((SwFmtFlyCnt&)pAttr->GetFlyCnt()).SetFlyFmt();
SwIndex aIdx( pPos->nContent );
- pTxtNd->Erase( aIdx, 1 );
+ pTxtNd->EraseText( aIdx, 1 );
}
}
else if( FLY_AUTO_CNTNT == nRndId )
@@ -558,18 +559,17 @@ void SwUndoSetFlyFmt::Undo( SwUndoIter& rIter )
SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
- SwTxtAttr * pHnt = pTxtNode->GetTxtAttr( nIdx, RES_TXTATR_FLYCNT );
-#ifndef PRODUCT
+ SwTxtAttr * pHnt = pTxtNode->GetTxtAttrForCharAt(
+ nIdx, RES_TXTATR_FLYCNT );
ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
"Missing FlyInCnt-Hint." );
ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFrmFmt,
"Wrong TxtFlyCnt-Hint." );
-#endif
- ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt();
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt();
// Die Verbindung ist geloest, jetzt muss noch das Attribut
// vernichtet werden.
- pTxtNode->Delete( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
}
// Anker umsetzen
@@ -580,8 +580,9 @@ void SwUndoSetFlyFmt::Undo( SwUndoIter& rIter )
if( FLY_IN_CNTNT == aNewAnchor.GetAnchorId() )
{
SwPosition* pPos = (SwPosition*)aNewAnchor.GetCntntAnchor();
- pPos->nNode.GetNode().GetTxtNode()->InsertItem(
- SwFmtFlyCnt( (SwFlyFrmFmt*)pFrmFmt ), nOldCntnt, 0 );
+ SwFmtFlyCnt aFmt( pFrmFmt );
+ pPos->nNode.GetNode().GetTxtNode()->InsertItem( aFmt,
+ nOldCntnt, 0 );
}
pFrmFmt->MakeFrms();
diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx
index cdfc9c1142ee..54ed7ea8421d 100644
--- a/sw/source/core/undo/undraw.cxx
+++ b/sw/source/core/undo/undraw.cxx
@@ -157,14 +157,15 @@ void lcl_SaveAnchor( SwFrmFmt* pFmt, ULONG& rNodePos )
// TextAttribut zerstoeren
SwTxtNode *pTxtNd = pFmt->GetDoc()->GetNodes()[ rNodePos ]->GetTxtNode();
ASSERT( pTxtNd, "Kein Textnode gefunden" );
- SwTxtFlyCnt* pAttr = (SwTxtFlyCnt*)pTxtNd->GetTxtAttr( nCntntPos );
+ SwTxtFlyCnt* pAttr = static_cast<SwTxtFlyCnt*>(
+ pTxtNd->GetTxtAttrForCharAt( nCntntPos, RES_TXTATR_FLYCNT ));
// Attribut steht noch im TextNode, loeschen
if( pAttr && pAttr->GetFlyCnt().GetFrmFmt() == pFmt )
{
// Pointer auf 0, nicht loeschen
((SwFmtFlyCnt&)pAttr->GetFlyCnt()).SetFlyFmt();
SwIndex aIdx( pTxtNd, nCntntPos );
- pTxtNd->Erase( aIdx, 1 );
+ pTxtNd->EraseText( aIdx, 1 );
}
}
else if( FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
@@ -198,9 +199,9 @@ void lcl_RestoreAnchor( SwFrmFmt* pFmt, ULONG& rNodePos )
if( FLY_IN_CNTNT == rAnchor.GetAnchorId() )
{
SwTxtNode *pTxtNd = aIdx.GetNode().GetTxtNode();
- ASSERT( pTxtNd, "Kein Textnode gefunden" );
- pTxtNd->InsertItem( SwFmtFlyCnt( (SwFrmFmt*)pFmt ),
- nCntntPos, nCntntPos );
+ ASSERT( pTxtNd, "no Text Node" );
+ SwFmtFlyCnt aFmt( pFmt );
+ pTxtNd->InsertItem( aFmt, nCntntPos, nCntntPos );
}
}
}
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 1335844c7ff9..85db90c85701 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -142,10 +142,13 @@ void SwUndoInsert::Init(const SwNodeIndex & rNd)
// #111827#
SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, xub_StrLen nCnt,
- xub_StrLen nL, BOOL bWDelim )
+ xub_StrLen nL,
+ const IDocumentContentOperations::InsertFlags nInsertFlags,
+ BOOL bWDelim )
: SwUndo(UNDO_TYPING), pPos( 0 ), pTxt( 0 ), pRedlData( 0 ),
nNode( rNd.GetIndex() ), nCntnt(nCnt), nLen(nL),
bIsWordDelim( bWDelim ), bIsAppend( FALSE )
+ , m_nInsertFlags(nInsertFlags)
{
Init(rNd);
}
@@ -155,6 +158,7 @@ SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd )
: SwUndo(UNDO_SPLITNODE), pPos( 0 ), pTxt( 0 ),
pRedlData( 0 ), nNode( rNd.GetIndex() ), nCntnt(0), nLen(1),
bIsWordDelim( FALSE ), bIsAppend( TRUE )
+ , m_nInsertFlags(IDocumentContentOperations::INS_EMPTYEXPAND)
{
Init(rNd);
}
@@ -247,7 +251,7 @@ SwUndoInsert::~SwUndoInsert()
{
SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pTxtNd, "kein TextNode, aus dem geloescht werden soll" );
- pTxtNd->Erase( pPos->nContent );
+ pTxtNd->EraseText( pPos->nContent );
pPos->nNode++;
}
pPos->nContent.Assign( 0, 0 );
@@ -295,15 +299,15 @@ void SwUndoInsert::Undo( SwUndoIter& rUndoIter )
aPaM.SetMark();
- if( pCNd->IsTxtNode() ) // Text !!
+ SwTxtNode * const pTxtNode( pCNd->GetTxtNode() );
+ if ( pTxtNode )
{
aPaM.GetPoint()->nContent -= nLen;
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
pTmpDoc->DeleteRedline( aPaM, true, USHRT_MAX );
RemoveIdxFromRange( aPaM, FALSE );
- pTxt = new String( ((SwTxtNode*)pCNd)->GetTxt().Copy(
- nCntnt-nLen, nLen ) );
- ((SwTxtNode*)pCNd)->Erase( aPaM.GetPoint()->nContent, nLen );
+ pTxt = new String( pTxtNode->GetTxt().Copy(nCntnt-nLen, nLen) );
+ pTxtNode->EraseText( aPaM.GetPoint()->nContent, nLen );
}
else // ansonsten Grafik/OLE/Text/...
{
@@ -379,9 +383,10 @@ void SwUndoInsert::Redo( SwUndoIter& rUndoIter )
if( pTxt )
{
- ASSERT( pCNd->IsTxtNode(), "wo ist mein Textnode ??" );
- ((SwTxtNode*)pCNd)->Insert( *pTxt, pPam->GetMark()->nContent,
- INS_EMPTYEXPAND );
+ SwTxtNode *const pTxtNode = pCNd->GetTxtNode();
+ ASSERT( pTxtNode, "where is my textnode ?" );
+ pTxtNode->InsertText( *pTxt, pPam->GetMark()->nContent,
+ m_nInsertFlags );
DELETEZ( pTxt );
}
else
@@ -445,7 +450,8 @@ void SwUndoInsert::Repeat( SwUndoIter& rUndoIter )
String aTxt( ((SwTxtNode*)pCNd)->GetTxt() );
BOOL bGroupUndo = rDoc.DoesGroupUndo();
rDoc.DoGroupUndo( FALSE );
- rDoc.Insert( *rUndoIter.pAktPam, aTxt.Copy( nCntnt - nLen, nLen ), true);
+ rDoc.InsertString( *rUndoIter.pAktPam,
+ aTxt.Copy( nCntnt - nLen, nLen ) );
rDoc.DoGroupUndo( bGroupUndo );
}
break;
@@ -712,7 +718,7 @@ void _UnReplaceData::Undo( SwUndoIter& rIter )
SwIndex aIdx( pNd, m_nSttCnt );
if( m_nSttNd == m_nEndNd )
{
- pNd->Erase( aIdx, m_sIns.Len() );
+ pNd->EraseText( aIdx, m_sIns.Len() );
}
else
{
@@ -741,7 +747,9 @@ void _UnReplaceData::Undo( SwUndoIter& rIter )
}
if( m_sOld.Len() )
- pNd->Insert( m_sOld, aIdx );
+ {
+ pNd->InsertText( m_sOld, aIdx );
+ }
if( pHistory )
{
@@ -813,7 +821,7 @@ void _UnReplaceData::Redo( SwUndoIter& rIter )
delete pHistory, pHistory = 0;
}
- rDoc.Replace( rPam, m_sIns, m_bRegExp );
+ rDoc.ReplaceRange( rPam, m_sIns, m_bRegExp );
rPam.DeleteMark();
rDoc.DoUndo( bUndo );
}
diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx
index 269f8de3cd63..ac318b2aab6d 100644
--- a/sw/source/core/undo/unmove.cxx
+++ b/sw/source/core/undo/unmove.cxx
@@ -207,7 +207,9 @@ void SwUndoMove::Undo( SwUndoIter& rUndoIter )
SwNodeRange aRg( aIdx, aIdx );
aRg.aEnd = nDestEndNode;
aIdx = nInsPosNode;
- if( !pDoc->Move( aRg, aIdx, IDocumentContentOperations::DOC_MOVEDEFAULT ) )
+ bool bSuccess = pDoc->MoveNodeRange( aRg, aIdx,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
+ if (!bSuccess)
break;
}
else
@@ -231,7 +233,10 @@ void SwUndoMove::Undo( SwUndoIter& rUndoIter )
((SwTxtNode*)pCNd)->ClearSwpHintsArr( false );
// an der InsertPos erstmal alle Attribute entfernen,
- if( !pDoc->Move( aPam, aPos, ( bMoveRedlines ? IDocumentContentOperations::DOC_MOVEREDLINES : IDocumentContentOperations::DOC_MOVEDEFAULT ) ) )
+ const bool bSuccess = pDoc->MoveRange( aPam, aPos, (bMoveRedlines)
+ ? IDocumentContentOperations::DOC_MOVEREDLINES
+ : IDocumentContentOperations::DOC_MOVEDEFAULT );
+ if (!bSuccess)
break;
aPam.Exchange();
@@ -294,7 +299,9 @@ void SwUndoMove::Redo( SwUndoIter& rUndoIter )
{
// nur ein Move mit SwRange
SwNodeRange aRg( rNds, nSttNode, rNds, nEndNode );
- rDoc.Move( aRg, aIdx, ( bMoveRedlines ? IDocumentContentOperations::DOC_MOVEREDLINES : IDocumentContentOperations::DOC_MOVEDEFAULT ) );
+ rDoc.MoveNodeRange( aRg, aIdx, (bMoveRedlines)
+ ? IDocumentContentOperations::DOC_MOVEREDLINES
+ : IDocumentContentOperations::DOC_MOVEDEFAULT );
}
else
{
@@ -310,7 +317,8 @@ void SwUndoMove::Redo( SwUndoIter& rUndoIter )
BOOL bJoinTxt = aIdx.GetNode().IsTxtNode();
aIdx--;
- rDoc.Move( aPam, aMvPos, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ rDoc.MoveRange( aPam, aMvPos,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
if( nSttNode != nEndNode && bJoinTxt )
{
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index e01c2debaf56..54997a43a15b 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -105,13 +105,14 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos,
BOOL bOldExpFlg = pTxtNd->IsIgnoreDontExpand();
pTxtNd->SetIgnoreDontExpand( TRUE );
- pTxtNd->Insert( cIns, rPos.nContent );
+ pTxtNd->InsertText( cIns, rPos.nContent,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
aInsStr.Insert( cIns );
if( !bInsChar )
{
const SwIndex aTmpIndex( rPos.nContent, -2 );
- pTxtNd->Erase( aTmpIndex, 1 );
+ pTxtNd->EraseText( aTmpIndex, 1 );
}
pTxtNd->SetIgnoreDontExpand( bOldExpFlg );
@@ -143,7 +144,7 @@ BOOL SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos,
CharClass& rCC = GetAppCharClass();
// befrage das einzufuegende Charakter
- if( ( CH_TXTATR_BREAKWORD == cIns && CH_TXTATR_INWORD == cIns ) ||
+ if (( CH_TXTATR_BREAKWORD == cIns || CH_TXTATR_INWORD == cIns ) ||
rCC.isLetterNumeric( String( cIns ), 0 ) !=
rCC.isLetterNumeric( aInsStr, aInsStr.Len()-1 ) )
return FALSE;
@@ -183,13 +184,14 @@ BOOL SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos,
BOOL bOldExpFlg = pDelTxtNd->IsIgnoreDontExpand();
pDelTxtNd->SetIgnoreDontExpand( TRUE );
- pDelTxtNd->Insert( cIns, rPos.nContent );
+ pDelTxtNd->InsertText( cIns, rPos.nContent,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
aInsStr.Insert( cIns );
if( !bInsChar )
{
const SwIndex aTmpIndex( rPos.nContent, -2 );
- pDelTxtNd->Erase( aTmpIndex, 1 );
+ pDelTxtNd->EraseText( aTmpIndex, 1 );
}
pDelTxtNd->SetIgnoreDontExpand( bOldExpFlg );
@@ -225,7 +227,7 @@ void SwUndoOverwrite::Undo( SwUndoIter& rUndoIter )
if( aInsStr.Len() > aDelStr.Len() )
{
rIdx += aDelStr.Len();
- pTxtNd->Erase( rIdx, aInsStr.Len() - aDelStr.Len() );
+ pTxtNd->EraseText( rIdx, aInsStr.Len() - aDelStr.Len() );
rIdx = nSttCntnt;
}
@@ -242,9 +244,9 @@ void SwUndoOverwrite::Undo( SwUndoIter& rUndoIter )
{
// einzeln, damit die Attribute stehen bleiben !!!
*pTmpStr = aDelStr.GetChar( n );
- pTxtNd->Insert( aTmpStr, rIdx /*???, SETATTR_NOTXTATRCHR*/ );
+ pTxtNd->InsertText( aTmpStr, rIdx /*???, SETATTR_NOTXTATRCHR*/ );
rIdx -= 2;
- pTxtNd->Erase( rIdx, 1 );
+ pTxtNd->EraseText( rIdx, 1 );
rIdx += 2;
}
pTxtNd->SetIgnoreDontExpand( bOldExpFlg );
@@ -312,11 +314,12 @@ void SwUndoOverwrite::Redo( SwUndoIter& rUndoIter )
for( xub_StrLen n = 0; n < aInsStr.Len(); n++ )
{
// einzeln, damit die Attribute stehen bleiben !!!
- pTxtNd->Insert( aInsStr.GetChar( n ), rIdx );
+ pTxtNd->InsertText( aInsStr.GetChar( n ), rIdx,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
if( n < aDelStr.Len() )
{
rIdx -= 2;
- pTxtNd->Erase( rIdx, 1 );
+ pTxtNd->EraseText( rIdx, 1 );
rIdx += n+1 < aDelStr.Len() ? 2 : 1;
}
}
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index f26643a09352..e688cb7dea68 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -192,7 +192,9 @@ void SwUndoInsSection::Redo( SwUndoIter& rUndoIter )
rBase, pAttr, TRUE );
}
else
- rDoc.Insert( *rUndoIter.pAktPam, *pSection, pAttr, TRUE );
+ {
+ rDoc.InsertSwSection( *rUndoIter.pAktPam, *pSection, pAttr, true );
+ }
if( pHistory )
pHistory->SetTmpEnd( pHistory->Count() );
@@ -236,7 +238,10 @@ void SwUndoInsSection::Repeat( SwUndoIter& rUndoIter )
rBase, pAttr, TRUE );
}
else
- rUndoIter.GetDoc().Insert( *rUndoIter.pAktPam, *pSection, pAttr );
+ {
+ rUndoIter.GetDoc().InsertSwSection( *rUndoIter.pAktPam,
+ *pSection, pAttr );
+ }
}
@@ -255,7 +260,7 @@ void SwUndoInsSection::Join( SwDoc& rDoc, ULONG nNode )
if( pHistory )
{
SwIndex aCntIdx( pTxtNd, 0 );
- pTxtNd->RstAttr( aCntIdx, pTxtNd->GetTxt().Len() );
+ pTxtNd->RstAttr( aCntIdx, pTxtNd->Len(), 0, 0, true );
}
}
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index cd257d6453bc..71902ec81611 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -166,7 +166,8 @@ void SwUndoSort::Undo( SwUndoIter& rIter)
{
SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode + i );
SwNodeRange aRg( *aIdxList[i], 0, *aIdxList[i], 1 );
- rDoc.Move(aRg, aIdx, IDocumentContentOperations::DOC_MOVEDEFAULT);
+ rDoc.MoveNodeRange(aRg, aIdx,
+ IDocumentContentOperations::DOC_MOVEDEFAULT);
}
// Indixes loeschen
aIdxList.DeleteAndDestroy(0, aIdxList.Count());
@@ -238,7 +239,8 @@ void SwUndoSort::Redo( SwUndoIter& rIter)
{
SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode + i);
SwNodeRange aRg( *aIdxList[i], 0, *aIdxList[i], 1 );
- rDoc.Move(aRg, aIdx, IDocumentContentOperations::DOC_MOVEDEFAULT);
+ rDoc.MoveNodeRange(aRg, aIdx,
+ IDocumentContentOperations::DOC_MOVEDEFAULT);
}
// Indixes loeschen
aIdxList.DeleteAndDestroy(0, aIdxList.Count());
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 93f6daf2c445..3d5dbd429e49 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -591,7 +591,7 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd,
ASSERT( pTxtNd, "Wo ist der TextNode geblieben?" );
SwIndex aCntPos( pTxtNd, pSave->m_nCntnt - 1 );
- pTxtNd->Erase( aCntPos, 1 );
+ pTxtNd->EraseText( aCntPos, 1 );
SwCntntNode* pNewNd = pTxtNd->SplitCntntNode(
SwPosition( aSttIdx, aCntPos ));
if( aBkmkArr.Count() )
@@ -2121,7 +2121,7 @@ CHECKTABLE(pTblNd->GetTable())
pTxtNd->RstAttr( aTmpIdx, pTxtNd->GetTxt().Len() -
nDelPos + 1 );
// das Trennzeichen loeschen
- pTxtNd->Erase( aTmpIdx, 1 );
+ pTxtNd->EraseText( aTmpIdx, 1 );
}
// delete pUndo;
DUMPDOC( &rDoc, String( "d:\\tmp\\tab_") + String( aNewSttNds.Count() - i ) +
@@ -2198,7 +2198,7 @@ void SwUndoTblMerge::MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& r
SwUndoMove* pUndo = new SwUndoMove( pDoc, rRg, rPos );
sal_Bool bDoesUndo = pDoc->DoesUndo();
pDoc->DoUndo( sal_False );
- pDoc->Move( rRg, rPos, pSaveTbl->IsNewModel() ?
+ pDoc->MoveNodeRange( rRg, rPos, (pSaveTbl->IsNewModel()) ?
IDocumentContentOperations::DOC_NO_DELFRMS :
IDocumentContentOperations::DOC_MOVEDEFAULT );
if( bDoesUndo )
@@ -2349,8 +2349,9 @@ void SwUndoTblNumFmt::Undo( SwUndoIter& rIter )
SwIndex aIdx( pTxtNd, 0 );
if( aStr.Len() )
{
- pTxtNd->Erase( aIdx );
- pTxtNd->Insert( aStr, aIdx, INS_NOHINTEXPAND );
+ pTxtNd->EraseText( aIdx );
+ pTxtNd->InsertText( aStr, aIdx,
+ IDocumentContentOperations::INS_NOHINTEXPAND );
}
}
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 581e2185907e..1c076a05dcce 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -158,7 +158,9 @@ SwUndoInserts::~SwUndoInserts()
SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pTxtNd, "kein TextNode, aus dem geloescht werden soll" );
if( pTxtNd ) // Robust
- pTxtNd->Erase( pPos->nContent );
+ {
+ pTxtNd->EraseText( pPos->nContent );
+ }
pPos->nNode++;
}
pPos->nContent.Assign( 0, 0 );
@@ -247,7 +249,6 @@ void SwUndoInserts::Undo( SwUndoIter& rUndoIter )
}
else
{
- pDoc->RstTxtAttrs( *pPam, TRUE );
if( bJoinNext && pTxtNode->CanJoinNext())
{
{
@@ -256,6 +257,9 @@ void SwUndoInserts::Undo( SwUndoIter& rUndoIter )
}
pTxtNode->JoinNext();
}
+ // reset all text attributes in the paragraph!
+ pTxtNode->RstAttr( SwIndex(pTxtNode, 0), pTxtNode->Len(),
+ 0, 0, true );
// setze alle Attribute im Node zurueck
pTxtNode->ResetAllAttr();
@@ -288,7 +292,6 @@ void SwUndoInserts::Redo( SwUndoIter& rUndoIter )
pSavTxtFmtColl = ((SwTxtNode*)pCNd)->GetTxtColl();
pHistory->SetTmpEnd( nSetPos );
- pHistory->TmpRollback( pDoc, 0, false );
// alte Anfangs-Position fuers Rollback zurueckholen
if( ( nSttNode != nEndNode || nSttCntnt != nEndCntnt ) && pPos )
@@ -346,7 +349,7 @@ void SwUndoInserts::Repeat( SwUndoIter& rUndoIter )
SwPaM aPam( *rUndoIter.pAktPam->GetPoint() );
SetPaM( aPam );
- aPam.GetDoc()->Copy( aPam, *rUndoIter.pAktPam->GetPoint(), false );
+ aPam.GetDoc()->CopyRange( aPam, *rUndoIter.pAktPam->GetPoint(), false );
rUndoIter.pLastUndoObj = this;
}
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index a922c5334f3e..0a9528823689 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -46,6 +46,8 @@
#include <comcore.hrc>
#endif
#include <undobj.hxx>
+#include <docsh.hxx>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::lang;
@@ -280,6 +282,23 @@ void SwXBookmark::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
}
}
+// MetadatableMixin
+::sfx2::Metadatable* SwXBookmark::GetCoreObject()
+{
+ return dynamic_cast< ::sfx2::Metadatable* >( GetBookmark() );
+}
+
+uno::Reference<frame::XModel> SwXBookmark::GetModel()
+{
+ if (GetDoc())
+ {
+ SwDocShell const * const pShell( GetDoc()->GetDocShell() );
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ return 0;
+}
+
+
uno::Reference< beans::XPropertySetInfo > SwXBookmark::getPropertySetInfo(void)
throw( uno::RuntimeException )
{
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index b09f4196d396..8103b924ae98 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -2061,6 +2061,7 @@ SwChartDataSequence::SwChartDataSequence(
// which is required for some functions
SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
DBG_ASSERT(pUnoTblCrsr, "SwChartDataSequence: cursor not SwUnoTableCrsr");
+ (void) pUnoTblCrsr;
#endif
}
@@ -2111,6 +2112,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
// which is required for some functions
SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
DBG_ASSERT(pUnoTblCrsr, "SwChartDataSequence: cursor not SwUnoTableCrsr");
+ (void) pUnoTblCrsr;
#endif
}
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 4890f8c62920..0a95eee00bcd 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -76,8 +76,10 @@
#include <slist>
#include <iterator>
+#include "unometa.hxx"
#include "docsh.hxx"
+
using ::rtl::OUString;
using namespace ::com::sun::star;
using namespace ::com::sun::star::document;
@@ -174,11 +176,11 @@ const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
{ "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 },
+ { "com.sun.star.text.textfield.MetadataField", SW_SERVICE_FIELDTYPE_METAFIELD },
{ "", 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 },
@@ -207,6 +209,7 @@ const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
{ "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER },
{ "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK },
{ "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK },
+ { "com.sun.star.text.InContentMetadata", SW_SERVICE_TYPE_META },
// case-correct versions of the service names (see #i67811)
{ CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME },
@@ -604,6 +607,12 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16
if( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
xRet = (cppu::OWeakObject*) pDoc->GetChartDataProvider( true /* create - if not yet available */ );
break;
+ case SW_SERVICE_TYPE_META:
+ xRet = static_cast< ::cppu::OWeakObject* >( new SwXMeta(pDoc) );
+ break;
+ case SW_SERVICE_FIELDTYPE_METAFIELD:
+ xRet = static_cast< ::cppu::OWeakObject* >(new SwXMetaField(pDoc));
+ break;
default:
throw uno::RuntimeException();
}
@@ -889,10 +898,20 @@ SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc)
const SwSpzFrmFmts* const pFmts = pDoc->GetSpzFrmFmts();
if(!pFmts->Count())
return;
- const SwFrmFmt* const pFmtsEnd = (*pFmts)[pFmts->Count()];
+ // --> OD 2009-09-10 #i104937#
+// const SwFrmFmt* const pFmtsEnd = (*pFmts)[pFmts->Count()];
+ const USHORT nSize = pFmts->Count();
+ // <--
::std::insert_iterator<frmcontainer_t> pInserter = ::std::insert_iterator<frmcontainer_t>(m_aFrames, m_aFrames.begin());
- for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
+ // --> OD 2009-09-10 #i104937#
+ SwFrmFmt* pFmt( 0 );
+ for( USHORT i = 0; i < nSize; ++i )
+// for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
+ // <--
{
+ // --> OD 2009-09-10 #i104937#
+ pFmt = (*pFmts)[i];
+ // <--
if(pFmt->Which() != RES_FLYFRMFMT)
continue;
const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
@@ -1008,6 +1027,7 @@ uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
throw IndexOutOfBoundsException();
return lcl_UnoWrapFrame(pFmt, eType);
}
+
uno::Any SwXFrames::getByName(const OUString& rName)
throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException )
{
@@ -1019,10 +1039,13 @@ uno::Any SwXFrames::getByName(const OUString& rName)
{
case FLYCNTTYPE_GRF:
pFmt = GetDoc()->FindFlyByName(rName, ND_GRFNODE);
+ break;
case FLYCNTTYPE_OLE:
pFmt = GetDoc()->FindFlyByName(rName, ND_OLENODE);
+ break;
default:
pFmt = GetDoc()->FindFlyByName(rName, ND_TEXTNODE);
+ break;
}
if(!pFmt)
throw NoSuchElementException();
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 0db5039f6a31..8c84dce7948a 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -343,20 +343,9 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
{
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());
- uno::Reference< XTextField > xRet = pFld;
- pAny->setValue(&xRet, ::getCppuType((uno::Reference<XTextField>*)0));
+ SwXTextField* pField = CreateSwXTextField(*rPam.GetDoc(),
+ pTxtAttr->GetFld());
+ *pAny <<= uno::Reference< XTextField >( pField );
}
}
else
@@ -943,25 +932,37 @@ void InsertFile(SwUnoCrsr* pUnoCrsr,
// paragraph breaks at those positions by calling SplitNode
sal_Bool DocInsertStringSplitCR(
SwDoc &rDoc,
- const SwPaM &rNewCursor, const String &rText )
+ const SwPaM &rNewCursor, const String &rText,
+ const bool bForceExpandHints )
{
sal_Bool bOK = sal_True;
+ const enum IDocumentContentOperations::InsertFlags nInsertFlags =
+ (bForceExpandHints)
+ ? static_cast<IDocumentContentOperations::InsertFlags>(
+ IDocumentContentOperations::INS_FORCEHINTEXPAND |
+ IDocumentContentOperations::INS_EMPTYEXPAND)
+ : IDocumentContentOperations::INS_EMPTYEXPAND;
+
OUString aTxt;
xub_StrLen nStartIdx = 0;
- xub_StrLen nMaxLength = STRING_LEN;
- SwTxtNode* pTxtNd = rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode();
- if( pTxtNd )
- nMaxLength = STRING_LEN - pTxtNd->GetTxt().Len();
+ SwTxtNode* const pTxtNd =
+ rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode();
+ const xub_StrLen nMaxLength = ( pTxtNd )
+ ? STRING_LEN - pTxtNd->GetTxt().Len()
+ : STRING_LEN;
xub_StrLen nIdx = rText.Search( '\r', nStartIdx );
if( ( nIdx == STRING_NOTFOUND && nMaxLength < rText.Len() ) ||
( nIdx != STRING_NOTFOUND && nMaxLength < nIdx ) )
+ {
nIdx = nMaxLength;
+ }
while (nIdx != STRING_NOTFOUND )
{
DBG_ASSERT( nIdx - nStartIdx >= 0, "index negative!" );
aTxt = rText.Copy( nStartIdx, nIdx - nStartIdx );
- if (aTxt.getLength() && !rDoc.Insert( rNewCursor, aTxt, true ))
+ if (aTxt.getLength() &&
+ !rDoc.InsertString( rNewCursor, aTxt, nInsertFlags ))
{
DBG_ERROR( "Doc->Insert(Str) failed." );
bOK = sal_False;
@@ -975,7 +976,8 @@ sal_Bool DocInsertStringSplitCR(
nIdx = rText.Search( '\r', nStartIdx );
}
aTxt = rText.Copy( nStartIdx );
- if (aTxt.getLength() && !rDoc.Insert( rNewCursor, aTxt, true ))
+ if (aTxt.getLength() &&
+ !rDoc.InsertString( rNewCursor, aTxt, nInsertFlags ))
{
DBG_ERROR( "Doc->Insert(Str) failed." );
bOK = sal_False;
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index c75e4b691b51..f0addeed003f 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1290,20 +1290,25 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
- SwTxtAttr * pHnt = pTxtNode->GetTxtAttr( nIdx, RES_TXTATR_FLYCNT );
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt(
+ nIdx, RES_TXTATR_FLYCNT );
DBG_ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
"Missing FlyInCnt-Hint." );
DBG_ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFmt,
"Wrong TxtFlyCnt-Hint." );
- ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt();
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt())
+ .SetFlyFmt();
//The connection is removed now the attribute can be deleted.
- pTxtNode->Delete( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ pTxtNode->DeleteAttributes(
+ RES_TXTATR_FLYCNT, nIdx );
//create a new one
SwTxtNode *pNd = pInternalPam->GetNode()->GetTxtNode();
- DBG_ASSERT( pNd, "Crsr steht nicht auf TxtNode." );
- pNd->InsertItem( SwFmtFlyCnt( pFmt ),
- pInternalPam->GetPoint()->nContent.GetIndex(), 0 );
+ DBG_ASSERT( pNd, "Cursor not at TxtNode." );
+ SwFmtFlyCnt aFmt( pFmt );
+ pNd->InsertItem(aFmt, pInternalPam->GetPoint()
+ ->nContent.GetIndex(), 0 );
}
else
{
@@ -1372,15 +1377,18 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
- SwTxtAttr * pHnt = pTxtNode->GetTxtAttr( nIdx, RES_TXTATR_FLYCNT );
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt(
+ nIdx, RES_TXTATR_FLYCNT );
DBG_ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
"Missing FlyInCnt-Hint." );
DBG_ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFlyFmt,
"Wrong TxtFlyCnt-Hint." );
- ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt();
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt())
+ .SetFlyFmt();
//The connection is removed now the attribute can be deleted.
- pTxtNode->Delete( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ pTxtNode->DeleteAttributes(RES_TXTATR_FLYCNT, nIdx);
}
else if( text::TextContentAnchorType_AT_PAGE != eNewAnchor &&
FLY_PAGE == eOldAnchorId )
@@ -1411,8 +1419,9 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
//the RES_TXTATR_FLYCNT needs to be added now
SwTxtNode *pNd = aPam.GetNode()->GetTxtNode();
DBG_ASSERT( pNd, "Crsr is not in a TxtNode." );
- pNd->InsertItem( SwFmtFlyCnt( pFlyFmt ),
- aPam.GetPoint()->nContent.GetIndex(), 0 );
+ SwFmtFlyCnt aFmt( pFlyFmt );
+ pNd->InsertItem(aFmt,
+ aPam.GetPoint()->nContent.GetIndex(), 0 );
//aPam.GetPoint()->nContent--;
}
@@ -2117,8 +2126,10 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
pDoc = pText->GetDoc();
else if (!pDoc && pCursor)
pDoc = pCursor->GetDoc();
- else if ( !pDoc && pPortion && pPortion->GetCrsr() )
- pDoc = pPortion->GetCrsr()->GetDoc();
+ else if ( !pDoc && pPortion && pPortion->GetCursor() )
+ {
+ pDoc = pPortion->GetCursor()->GetDoc();
+ }
}
@@ -2206,7 +2217,7 @@ void SwXShape::dispose(void) throw( uno::RuntimeException )
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 );
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
}
else
pFmt->GetDoc()->DelLayoutFmt( pFmt );
diff --git a/sw/source/core/unocore/unoevent.cxx b/sw/source/core/unocore/unoevent.cxx
index 339ef87c1ace..26486cb255dc 100644
--- a/sw/source/core/unocore/unoevent.cxx
+++ b/sw/source/core/unocore/unoevent.cxx
@@ -73,93 +73,6 @@ const sal_Char sAPI_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
//
@@ -229,40 +142,6 @@ const struct SvEventDescription aFrameStyleEvents[] =
{ 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" },
- { SW_EVENT_FIELD_MERGE, "OnFieldMerge" },
- { SW_EVENT_FIELD_MERGE_FINISHED, "OnFieldMergeFinished" },
-// SFX_EVENT_LOADFINISHED,
-// SFX_EVENT_MODIFYCHANGED,
-// SFX_EVENT_PREPARECLOSEDOC,
-// SFX_EVENT_TOGGLEFULLSCREENMODE,
-// SFX_EVENT_SAVEDOCDONE,
-// SFX_EVENT_SAVEASDOCDONE,
-
- { 0, NULL }
-};
-
-
-
-
-
//
// SwHyperlinkEventDescriptor
//
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 1a14b5441eb6..f8de0eb39691 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -94,6 +94,7 @@
#include <textapi.hxx>
#include <svx/outliner.hxx>
#include <docsh.hxx>
+#include <fmtmeta.hxx> // MetaFieldManager
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -371,7 +372,7 @@ USHORT lcl_GetPropertyMapOfService( USHORT nServiceId )
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;
+ 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;
@@ -784,24 +785,12 @@ uno::Any SwXFieldMaster::getPropertyValue(const OUString& rPropertyName)
}
uno::Sequence<uno::Reference <text::XDependentTextField> > aRetSeq(aFldArr.Count());
uno::Reference<text::XDependentTextField>* pRetSeq = aRetSeq.getArray();
- SwXTextField* pInsert = 0;
for(USHORT 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());
+ SwXTextField * pInsert = CreateSwXTextField(*GetDoc(), *pFld);
+
pRetSeq[i] = uno::Reference<text::XDependentTextField>(pInsert);
- pInsert = 0;
}
aRet <<= aRetSeq;
}
@@ -1079,6 +1068,26 @@ OUString SwXFieldMaster::LocalizeFormula(
}
return rFormula;
}
+
+
+SwXTextField * CreateSwXTextField(SwDoc & rDoc, SwFmtFld const& rFmt)
+{
+ SwClientIter aIter(*rFmt.GetFld()->GetTyp());
+ SwXTextField * pField = 0;
+ SwXTextField * pTemp =
+ static_cast<SwXTextField*>(aIter.First( TYPE(SwXTextField) ));
+ while (pTemp)
+ {
+ if (pTemp->GetFldFmt() == &rFmt)
+ {
+ pField = pTemp;
+ break;
+ }
+ pTemp = static_cast<SwXTextField*>(aIter.Next());
+ }
+ return pField ? pField : new SwXTextField( rFmt, &rDoc );
+}
+
/******************************************************************
*
******************************************************************/
@@ -1809,8 +1818,18 @@ void SwXTextField::attachToRange(
SwTxtAttr* pTxtAttr = 0;
if(aPam.HasMark())
pDoc->DeleteAndJoin(aPam);
- pDoc->Insert(aPam, aFmt, 10000);
- pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
+
+ SwXTextCursor const*const pTextCursor(
+ dynamic_cast<SwXTextCursor*>(pCursor));
+ const bool bForceExpandHints( (pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta() : false );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ : nsSetAttrMode::SETATTR_DEFAULT;
+
+ pDoc->InsertPoolItem(aPam, aFmt, nInsertFlags);
+
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FIELD);
// was passiert mit dem Update der Felder ? (siehe fldmgr.cxx)
@@ -2915,6 +2934,22 @@ SwXFieldEnumeration::SwXFieldEnumeration(SwDoc* pDc) :
}
}
}
+ // now handle meta-fields, which are not SwFields
+ const ::std::vector< uno::Reference<text::XTextField> > MetaFields(
+ pDc->GetMetaFieldManager().getMetaFields() );
+ for (size_t i = 0; i < MetaFields.size(); ++i)
+ {
+ pItems[ nFillPos ] = MetaFields[i];
+ nFillPos++;
+
+ //FIXME UGLY
+ // 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 );
}
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index fcfb8eb135fd..ae773f389f30 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -228,7 +228,7 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, c
mpTxtNode = pOldTxtNode; // setPropertyValue() modifies this. We restore the old state.
IDocumentContentOperations* pIDCO = mpTxtNode->getIDocumentContentOperations();
- pIDCO->Replace( aPaM, aNewText, false );
+ pIDCO->ReplaceRange( aPaM, aNewText, false );
mpTxtNode = 0;
}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 7237cb59ed02..09066c447546 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2028,7 +2028,7 @@ void SwXFrame::dispose(void) throw( uno::RuntimeException )
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 );
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
}
else
pFmt->GetDoc()->DelLayoutFmt(pFmt);
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index aea52396f366..98ee87c2ae33 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -254,11 +254,18 @@ void SwXFootnote::attachToRange(const uno::Reference< text::XTextRange > & xText
SwFmtFtn aFootNote(m_bIsEndnote);
if(m_sLabel.Len())
aFootNote.SetNumStr(m_sLabel);
- SfxItemSet aSet(pNewDoc->GetAttrPool(), RES_TXTATR_FTN, RES_TXTATR_FTN, 0L);
- aSet.Put(aFootNote);
- SwXTextCursor::SetCrsrAttr(aPam, aSet, 0);
- pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ SwXTextCursor const*const pTextCursor(
+ dynamic_cast<SwXTextCursor*>(pCursor));
+ const bool bForceExpandHints( (pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta() : false );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ : nsSetAttrMode::SETATTR_DEFAULT;
+
+ pNewDoc->InsertPoolItem(aPam, aFootNote, nInsertFlags);
+
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FTN );
if(pTxtAttr)
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 5fbec1e277a1..5633ca1f0661 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1369,7 +1369,7 @@ void SwXDocumentIndexMark::setMarkEntry(const OUString& rIndexEntry) throw( uno:
aPam.GetPoint()->nContent++;
//die alte Marke loeschen
- m_pDoc->Delete(m_pTOXMark);
+ m_pDoc->DeleteTOXMark(m_pTOXMark);
m_pTOXMark = 0;
SwTxtAttr* pTxtAttr = 0;
@@ -1379,13 +1379,14 @@ void SwXDocumentIndexMark::setMarkEntry(const OUString& rIndexEntry) throw( uno:
if( bInsAtPos )
{
SwPaM aTmp( *pStt );
- m_pDoc->Insert( aTmp, aMark, 0 );
- pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
+ m_pDoc->InsertPoolItem( aTmp, aMark, 0 );
+ pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttrForCharAt(
pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK);
}
else if( *pEnd != *pStt )
{
- m_pDoc->Insert( aPam, aMark, nsSetAttrMode::SETATTR_DONTEXPAND );
+ m_pDoc->InsertPoolItem( aPam, aMark,
+ nsSetAttrMode::SETATTR_DONTEXPAND );
pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
pStt->nContent, RES_TXTATR_TOXMARK);
}
@@ -1501,7 +1502,17 @@ void SwXDocumentIndexMark::attachToRange(const uno::Reference< text::XTextRange
// deshalb hier ein Leerzeichen - ob das die ideale Loesung ist?
if(!bMark && !aMark.GetAlternativeText().Len())
aMark.SetAlternativeText( String(' ') );
- pDoc->Insert(aPam, aMark, nsSetAttrMode::SETATTR_DONTEXPAND);
+
+ SwXTextCursor const*const pTextCursor(
+ dynamic_cast<SwXTextCursor*>(pCursor));
+ const bool bForceExpandHints( (!bMark && pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta() : false );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? ( nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ | nsSetAttrMode::SETATTR_DONTEXPAND)
+ : nsSetAttrMode::SETATTR_DONTEXPAND;
+
+ pDoc->InsertPoolItem(aPam, aMark, nInsertFlags);
if( bMark && *aPam.GetPoint() > *aPam.GetMark())
aPam.Exchange();
@@ -1510,8 +1521,10 @@ void SwXDocumentIndexMark::attachToRange(const uno::Reference< text::XTextRange
pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
aPam.GetPoint()->nContent, RES_TXTATR_TOXMARK );
else
- pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ {
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
+ }
if(pTxtAttr)
{
@@ -1571,7 +1584,7 @@ void SwXDocumentIndexMark::dispose(void) throw( uno::RuntimeException )
SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
if(pType && m_pTOXMark)
{
- m_pDoc->Delete(m_pTOXMark);
+ m_pDoc->DeleteTOXMark(m_pTOXMark);
}
else
throw uno::RuntimeException();
@@ -1681,7 +1694,7 @@ void SwXDocumentIndexMark::setPropertyValue(const OUString& rPropertyName,
aPam.GetPoint()->nContent++;
//delete the old mark
- pLocalDoc->Delete(m_pTOXMark);
+ pLocalDoc->DeleteTOXMark(m_pTOXMark);
m_pTOXMark = 0;
sal_Bool bInsAtPos = aMark.IsAlternativeText();
@@ -1692,13 +1705,14 @@ void SwXDocumentIndexMark::setPropertyValue(const OUString& rPropertyName,
if( bInsAtPos )
{
SwPaM aTmp( *pStt );
- pLocalDoc->Insert( aTmp, aMark, 0 );
- pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
+ pLocalDoc->InsertPoolItem( aTmp, aMark, 0 );
+ pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttrForCharAt(
pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
}
else if( *pEnd != *pStt )
{
- pLocalDoc->Insert( aPam, aMark, nsSetAttrMode::SETATTR_DONTEXPAND );
+ pLocalDoc->InsertPoolItem( aPam, aMark,
+ nsSetAttrMode::SETATTR_DONTEXPAND );
pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
pStt->nContent, RES_TXTATR_TOXMARK );
}
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 3730da041f90..f2f48e382508 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1649,6 +1649,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{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},
+ {SW_PROP_NMID(UNO_NAME_META), FN_UNO_META, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
{0,0,0,0,0,0}
};
aMapEntriesArr[nPropertyId] = aTextPortionExtensionMap_Impl;
@@ -2484,6 +2485,19 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
aMapEntriesArr[nPropertyId] = aChart2DataSequenceMap;
}
break;
+ case PROPERTY_MAP_METAFIELD:
+ {
+ static SfxItemPropertyMapEntry aMetaFieldMap[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), 0,
+ CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), 0,
+ CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aMetaFieldMap;
+ }
+ break;
default:
DBG_ERROR( "unexpected property map ID" );
@@ -3091,6 +3105,12 @@ const SfxItemPropertySet* SwUnoPropertyMapProvider::GetPropertySet( sal_uInt16
aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM;
}
break;
+ case PROPERTY_MAP_METAFIELD:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_METAFIELD(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_METAFIELD;
+ }
+ break;
}
}
return aPropertySetArr[nPropertyId];
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 9b2bebb67977..3f07ccf66b62 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -59,7 +59,6 @@
#include <swerror.h>
#include <swtblfmt.hxx>
#include <fmtruby.hxx>
-#include <fmthbsh.hxx>
#include <docsh.hxx>
#include <docstyle.hxx>
#include <charfmt.hxx>
@@ -92,6 +91,7 @@
#include <unocoll.hxx>
#include <unostyle.hxx>
#include <unofield.hxx>
+#include <unometa.hxx>
#include <fmtanchr.hxx>
#include <svx/flstitem.hxx>
#include <svtools/ctrltool.hxx>
@@ -118,11 +118,10 @@
#include <dcontact.hxx>
#include <SwStyleNameMapper.hxx>
#include <crsskip.hxx>
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
#include <memory>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -378,9 +377,11 @@ void lcl_SetTxtFmtColl(const uno::Any& rAny, SwPaM& rPaM)
SwTxtFmtColl *pLocal = pStyle->GetCollection();
UnoActionContext aAction(pDoc);
pDoc->StartUndo( UNDO_START, NULL );
- FOREACHUNOPAM_START(&rPaM)
- pDoc->SetTxtFmtColl(*PUNOPAM, pLocal);
- FOREACHUNOPAM_END()
+ SwPaM *pTmpCrsr = &rPaM;
+ do {
+ pDoc->SetTxtFmtColl(*pTmpCrsr, pLocal);
+ pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext());
+ } while ( pTmpCrsr != &rPaM );
pDoc->EndUndo( UNDO_END, NULL );
}
else
@@ -653,7 +654,7 @@ return bRet;
/* -----------------30.06.98 08:39-------------------
*
* --------------------------------------------------*/
-SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPam, BOOL bConditional)
+SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPaM, BOOL bConditional)
{
static const sal_uInt16 nMaxLookup = 1000;
SwFmtColl *pFmt = 0;
@@ -661,12 +662,13 @@ SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPam, BOOL bConditional)
// if ( GetCrsrCnt() > nMaxLookup )
// return 0;
sal_Bool bError = sal_False;
- FOREACHUNOPAM_START(&rPam)
+ SwPaM *pTmpCrsr = &rPaM;
+ do {
- ULONG nSttNd = PUNOPAM->GetMark()->nNode.GetIndex(),
- nEndNd = PUNOPAM->GetPoint()->nNode.GetIndex();
- xub_StrLen nSttCnt = PUNOPAM->GetMark()->nContent.GetIndex(),
- nEndCnt = PUNOPAM->GetPoint()->nContent.GetIndex();
+ ULONG nSttNd = pTmpCrsr->GetMark()->nNode.GetIndex();
+ ULONG nEndNd = pTmpCrsr->GetPoint()->nNode.GetIndex();
+ xub_StrLen nSttCnt = pTmpCrsr->GetMark()->nContent.GetIndex();
+ xub_StrLen nEndCnt = pTmpCrsr->GetPoint()->nContent.GetIndex();
if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
{
@@ -680,7 +682,7 @@ SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPam, BOOL bConditional)
break;
}
- const SwNodes& rNds = rPam.GetDoc()->GetNodes();
+ const SwNodes& rNds = rPaM.GetDoc()->GetNodes();
for( ULONG n = nSttNd; n <= nEndNd; ++n )
{
const SwTxtNode* pNd = rNds[ n ]->GetTxtNode();
@@ -699,7 +701,9 @@ SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPam, BOOL bConditional)
}
if(bError)
break;
- FOREACHUNOPAM_END()
+
+ pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext());
+ } while ( pTmpCrsr != &rPaM );
return bError ? 0 : pFmt;
}
@@ -851,7 +855,8 @@ SwXTextCursor::~SwXTextCursor()
/*-- 09.12.98 14:19:18---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextCursor::DeleteAndInsert(const String& rText)
+void SwXTextCursor::DeleteAndInsert(const String& rText,
+ const bool bForceExpandHints)
{
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
@@ -870,10 +875,12 @@ void SwXTextCursor::DeleteAndInsert(const String& rText)
}
if(nTxtLen)
{
- if( !SwUnoCursorHelper::DocInsertStringSplitCR( *pDoc, *_pStartCrsr, rText ) )
- {
- DBG_ASSERT( sal_False, "Doc->Insert(Str) failed." );
- }
+ const bool bSuccess(
+ SwUnoCursorHelper::DocInsertStringSplitCR(
+ *pDoc, *_pStartCrsr, rText, bForceExpandHints ) );
+ DBG_ASSERT( bSuccess, "Doc->Insert(Str) failed." );
+ (void) bSuccess;
+
SwXTextCursor::SelectPam(*pUnoCrsr, sal_True);
_pStartCrsr->Left(rText.Len(), CRSR_SKIP_CHARS, FALSE, FALSE);
}
@@ -881,6 +888,82 @@ void SwXTextCursor::DeleteAndInsert(const String& rText)
pDoc->EndUndo(UNDO_INSERT, NULL);
}
}
+
+
+enum ForceIntoMetaMode { META_CHECK_BOTH, META_INIT_START, META_INIT_END };
+
+sal_Bool lcl_ForceIntoMeta(SwPaM & rCursor,
+ uno::Reference<text::XText> const & xParentText,
+ const enum ForceIntoMetaMode eMode)
+{
+ sal_Bool bRet( sal_True ); // means not forced in META_CHECK_BOTH
+ SwXMeta const * const pXMeta( dynamic_cast<SwXMeta*>(xParentText.get()) );
+ ASSERT(pXMeta, "no parent?");
+ if (!pXMeta)
+ throw uno::RuntimeException();
+ SwTxtNode * pTxtNode;
+ xub_StrLen nStart;
+ xub_StrLen nEnd;
+ const bool bSuccess( pXMeta->SetContentRange(pTxtNode, nStart, nEnd) );
+ ASSERT(bSuccess, "no pam?");
+ if (!bSuccess)
+ throw uno::RuntimeException();
+ // force the cursor back into the meta if it has moved outside
+ SwPosition start(*pTxtNode, nStart);
+ SwPosition end(*pTxtNode, nEnd);
+ switch (eMode)
+ {
+ case META_INIT_START:
+ *rCursor.GetPoint() = start;
+ break;
+ case META_INIT_END:
+ *rCursor.GetPoint() = end;
+ break;
+ case META_CHECK_BOTH:
+ if (*rCursor.Start() < start)
+ {
+ *rCursor.Start() = start;
+ bRet = sal_False;
+ }
+ if (*rCursor.End() > end)
+ {
+ *rCursor.End() = end;
+ bRet = sal_False;
+ }
+ break;
+ }
+ return bRet;
+}
+
+bool SwXTextCursor::IsAtEndOfMeta() const
+{
+ if (CURSOR_META == eType)
+ {
+ SwUnoCrsr const * const pCursor( GetCrsr() );
+ SwXMeta const*const pXMeta( dynamic_cast<SwXMeta*>(xParentText.get()) );
+ ASSERT(pXMeta, "no meta?");
+ if (pCursor && pXMeta)
+ {
+ SwTxtNode * pTxtNode;
+ xub_StrLen nStart;
+ xub_StrLen nEnd;
+ const bool bSuccess(
+ pXMeta->SetContentRange(pTxtNode, nStart, nEnd) );
+ ASSERT(bSuccess, "no pam?");
+ if (bSuccess)
+ {
+ const SwPosition end(*pTxtNode, nEnd);
+ if ( (*pCursor->GetPoint() == end)
+ || (*pCursor->GetMark() == end))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
/* -----------------------------10.03.00 18:02--------------------------------
---------------------------------------------------------------------------*/
@@ -972,6 +1055,11 @@ sal_Bool SwXTextCursor::goLeft(sal_Int16 nCount, sal_Bool Expand) throw( uno::Ru
{
SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
bRet = pUnoCrsr->Left( nCount, CRSR_SKIP_CHARS, FALSE, FALSE);
+ if (CURSOR_META == eType)
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH)
+ && bRet;
+ }
}
else
{
@@ -991,6 +1079,11 @@ sal_Bool SwXTextCursor::goRight(sal_Int16 nCount, sal_Bool Expand) throw( uno::R
{
SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
bRet = pUnoCrsr->Right(nCount, CRSR_SKIP_CHARS, FALSE, FALSE);
+ if (CURSOR_META == eType)
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH)
+ && bRet;
+ }
}
else
{
@@ -1044,6 +1137,10 @@ void SwXTextCursor::gotoStart(sal_Bool Expand) throw( uno::RuntimeException )
{
pUnoCrsr->MoveSection( fnSectionCurr, fnSectionStart);
}
+ else if (CURSOR_META == eType)
+ {
+ lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_INIT_START);
+ }
}
else
{
@@ -1061,7 +1158,9 @@ void SwXTextCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException )
{
SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
if(eType == CURSOR_BODY)
+ {
pUnoCrsr->Move( fnMoveForward, fnGoDoc );
+ }
else if(eType == CURSOR_FRAME ||
eType == CURSOR_TBLTEXT ||
eType == CURSOR_HEADER ||
@@ -1071,6 +1170,10 @@ void SwXTextCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException )
{
pUnoCrsr->MoveSection( fnSectionCurr, fnSectionEnd);
}
+ else if (CURSOR_META == eType)
+ {
+ lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_INIT_END);
+ }
}
else
{
@@ -1099,6 +1202,11 @@ void SwXTextCursor::gotoRange(const uno::Reference< XTextRange > & xRange, sal_B
sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
}
+ if (!pRange && !pCursor)
+ {
+ throw uno::RuntimeException();
+ }
+
SwStartNodeType eSearchNodeType = SwNormalStartNode;
switch(eType)
{
@@ -1141,6 +1249,27 @@ void SwXTextCursor::gotoRange(const uno::Reference< XTextRange > & xRange, sal_B
throw uno::RuntimeException();
}
+ if (CURSOR_META == eType)
+ {
+ const SwPosition & rPoint( (pRange)
+ ? pRange->GetBookmark()->GetMarkPos()
+ : *pCursor->GetPaM()->GetPoint() );
+ const SwPosition & rMark ( (pRange)
+ ? ((pRange->GetBookmark()->IsExpanded())
+ ? pRange->GetBookmark()->GetOtherMarkPos() : rPoint)
+ : *pCursor->GetPaM()->GetMark() );
+ SwPaM aPam(rPoint, rMark);
+ const bool bNotForced(
+ lcl_ForceIntoMeta(aPam, xParentText, META_CHECK_BOTH) );
+ if (!bNotForced)
+ {
+ throw uno::RuntimeException(
+ C2U("gotoRange: parameter range not contained in nesting"
+ " text content for which this cursor was created"),
+ static_cast<text::XWordCursor*>(this));
+ }
+ }
+
//jetzt muss die Selektion erweitert werden
if(bExpand)
{
@@ -1277,7 +1406,9 @@ sal_Bool SwXTextCursor::gotoNextWord(sal_Bool Expand) throw( uno::RuntimeExcepti
//Absatzende?
if(pUnoCrsr->GetCntntNode() &&
pPoint->nContent == pUnoCrsr->GetCntntNode()->Len())
+ {
pUnoCrsr->Right(1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
else
{
sal_Bool bTmp = pUnoCrsr->GoNextWordWT( i18n::WordType::DICTIONARY_WORD );
@@ -1289,6 +1420,10 @@ sal_Bool SwXTextCursor::gotoNextWord(sal_Bool Expand) throw( uno::RuntimeExcepti
// return true if cursor has moved
bRet = &pPoint->nNode.GetNode() != pOldNode ||
pPoint->nContent.GetIndex() != nOldIndex;
+ if (bRet && (CURSOR_META == eType))
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH);
+ }
}
else
{
@@ -1316,7 +1451,9 @@ sal_Bool SwXTextCursor::gotoPreviousWord(sal_Bool Expand) throw( uno::RuntimeExc
SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
//Absatzanfang ?
if(pPoint->nContent == 0)
+ {
pUnoCrsr->Left(1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
else
{
pUnoCrsr->GoPrevWordWT( i18n::WordType::DICTIONARY_WORD );
@@ -1327,6 +1464,10 @@ sal_Bool SwXTextCursor::gotoPreviousWord(sal_Bool Expand) throw( uno::RuntimeExc
// return true if cursor has moved
bRet = &pPoint->nNode.GetNode() != pOldNode ||
pPoint->nContent.GetIndex() != nOldIndex;
+ if (bRet && (CURSOR_META == eType))
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH);
+ }
}
else
{
@@ -1363,6 +1504,10 @@ sal_Bool SwXTextCursor::gotoEndOfWord(sal_Bool Expand) throw( uno::RuntimeExcept
pPoint->nNode = rOldNode;
pPoint->nContent = nOldIndex;
}
+ else if (CURSOR_META == eType)
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH);
+ }
}
else
{
@@ -1399,6 +1544,10 @@ sal_Bool SwXTextCursor::gotoStartOfWord(sal_Bool Expand) throw( uno::RuntimeExce
pPoint->nNode = rOldNode;
pPoint->nContent = nOldIndex;
}
+ else if (CURSOR_META == eType)
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH);
+ }
}
else
{
@@ -1489,6 +1638,11 @@ sal_Bool SwXTextCursor::gotoNextSentence(sal_Bool Expand) throw( uno::RuntimeExc
if (bWasEOS && !bNextWord)
bRet = sal_False;
}
+ if (CURSOR_META == eType)
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH)
+ && bRet;
+ }
}
else
throw uno::RuntimeException();
@@ -1516,6 +1670,11 @@ sal_Bool SwXTextCursor::gotoPreviousSentence(sal_Bool Expand) throw( uno::Runtim
pUnoCrsr->GoSentence(SwCursor::PREV_SENT);
}
}
+ if (CURSOR_META == eType)
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH)
+ && bRet;
+ }
}
else
throw uno::RuntimeException();
@@ -1538,6 +1697,11 @@ sal_Bool SwXTextCursor::gotoStartOfSentence(sal_Bool Expand) throw( uno::Runtime
bRet = SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr)
|| pUnoCrsr->GoSentence(SwCursor::START_SENT) ||
SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr);
+ if (CURSOR_META == eType)
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH)
+ && bRet;
+ }
}
else
throw uno::RuntimeException();
@@ -1561,7 +1725,11 @@ sal_Bool SwXTextCursor::gotoEndOfSentence(sal_Bool Expand) throw( uno::RuntimeEx
bRet = !bAlreadyParaEnd &&
(pUnoCrsr->GoSentence(SwCursor::END_SENT) ||
pUnoCrsr->MovePara(fnParaCurr, fnParaEnd));
-
+ if (CURSOR_META == eType)
+ {
+ bRet = lcl_ForceIntoMeta(*pUnoCrsr, xParentText, META_CHECK_BOTH)
+ && bRet;
+ }
}
else
throw uno::RuntimeException();
@@ -1603,6 +1771,8 @@ sal_Bool SwXTextCursor::gotoStartOfParagraph(sal_Bool Expand) throw( uno::Runtim
{
vos::OGuard aGuard(Application::GetSolarMutex());
sal_Bool bRet = sal_False;
+ if (CURSOR_META == eType)
+ return bRet;
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr )
{
@@ -1627,6 +1797,8 @@ sal_Bool SwXTextCursor::gotoEndOfParagraph(sal_Bool Expand) throw( uno::RuntimeE
{
vos::OGuard aGuard(Application::GetSolarMutex());
sal_Bool bRet = sal_False;
+ if (CURSOR_META == eType)
+ return bRet;
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
@@ -1651,6 +1823,8 @@ sal_Bool SwXTextCursor::gotoNextParagraph(sal_Bool Expand) throw( uno::RuntimeEx
{
vos::OGuard aGuard(Application::GetSolarMutex());
sal_Bool bRet = sal_False;
+ if (CURSOR_META == eType)
+ return bRet;
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
@@ -1668,6 +1842,8 @@ sal_Bool SwXTextCursor::gotoPreviousParagraph(sal_Bool Expand) throw( uno::Runti
{
vos::OGuard aGuard(Application::GetSolarMutex());
sal_Bool bRet = sal_False;
+ if (CURSOR_META == eType)
+ return bRet;
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
@@ -1697,7 +1873,19 @@ uno::Reference< XTextRange > SwXTextCursor::getStart(void) throw( uno::RuntimeE
{
SwPaM aPam(*pUnoCrsr->Start());
uno::Reference< XText > xParent = getText();
- xRet = new SwXTextRange(aPam, xParent);
+ if (CURSOR_META == eType)
+ {
+ // return cursor to prevent modifying SwXTextRange for META
+ SwXTextCursor * const pCursor(
+ new SwXTextCursor(xParent, *pUnoCrsr->GetPoint(),
+ CURSOR_META, pUnoCrsr->GetDoc()) );
+ pCursor->gotoStart(sal_False);
+ xRet = static_cast<text::XWordCursor*>(pCursor);
+ }
+ else
+ {
+ xRet = new SwXTextRange(aPam, xParent);
+ }
}
else
throw uno::RuntimeException();
@@ -1715,7 +1903,19 @@ uno::Reference< XTextRange > SwXTextCursor::getEnd(void) throw( uno::RuntimeExc
{
SwPaM aPam(*pUnoCrsr->End());
uno::Reference< XText > xParent = getText();
- xRet = new SwXTextRange(aPam, xParent);
+ if (CURSOR_META == eType)
+ {
+ // return cursor to prevent modifying SwXTextRange for META
+ SwXTextCursor * const pCursor(
+ new SwXTextCursor(xParent, *pUnoCrsr->GetPoint(),
+ CURSOR_META, pUnoCrsr->GetDoc()) );
+ pCursor->gotoEnd(sal_False);
+ xRet = static_cast<text::XWordCursor*>(pCursor);
+ }
+ else
+ {
+ xRet = new SwXTextRange(aPam, xParent);
+ }
}
else
throw uno::RuntimeException();
@@ -1762,7 +1962,11 @@ void SwXTextCursor::setString(const OUString& aString) throw( uno::RuntimeExcept
if(!pUnoCrsr)
throw uno::RuntimeException();
- DeleteAndInsert(aString);
+ const bool bForceExpandHints( (CURSOR_META != eType)
+ ? false
+ : dynamic_cast<SwXMeta*>(xParentText.get())->CheckForOwnMemberMeta(
+ 0, GetPaM(), true) );
+ DeleteAndInsert(aString, bForceExpandHints);
}
/* -----------------------------03.05.00 12:56--------------------------------
@@ -2183,9 +2387,10 @@ void SAL_CALL SwXTextCursor::setAllPropertiesToDefault()
// selection specific attribut ranges
USHORT aResetableSetRange[] = {
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
- RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
- RES_TXTATR_CJK_RUBY, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
0
};
SvUShortsSort aParaWhichIds;
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 7a27bd597eb0..b7764778d31c 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -57,7 +57,6 @@
#include <shellio.hxx>
#include <swerror.h>
#include <swtblfmt.hxx>
-#include <fmthbsh.hxx>
#include <docsh.hxx>
#include <docstyle.hxx>
#include <charfmt.hxx>
@@ -124,6 +123,11 @@
// OD 2004-05-24 #i28701#
#include <sortedobjs.hxx>
+#include <algorithm>
+#include <iterator>
+#include <boost/bind.hpp>
+
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -135,9 +139,20 @@ using namespace ::com::sun::star::drawing;
using ::rtl::OUString;
+
+struct FrameDependSortListLess
+{
+ bool operator() (FrameDependSortListEntry const& r1,
+ FrameDependSortListEntry const& r2)
+ {
+ return (r1.nIndex < r2.nIndex)
+ || ((r1.nIndex == r2.nIndex) && (r1.nOrder < r2.nOrder));
+ }
+};
+
// OD 2004-05-07 #i28701# - adjust 4th parameter
void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
- SwDependArr& rFrameArr,
+ FrameDependSortList_t & rFrames,
const bool _bAtCharAnchoredObjs )
{
// _bAtCharAnchoredObjs:
@@ -163,21 +178,21 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
if ( rFmt.GetAnchor().GetAnchorId() == nChkType )
{
- //jetzt einen SwDepend anlegen und in das Array einfuegen
+ // create SwDepend and insert into array
SwDepend* pNewDepend = new SwDepend( &rClnt, &rFmt );
+ xub_StrLen idx =
+ rFmt.GetAnchor().GetCntntAnchor()->nContent.GetIndex();
+ sal_uInt32 nOrder = rFmt.GetAnchor().GetOrder();
// OD 2004-05-07 #i28701# - sorting no longer needed,
// because list <SwSortedObjs> is already sorted.
- rFrameArr.C40_INSERT( SwDepend, pNewDepend, rFrameArr.Count() );
+ FrameDependSortListEntry entry(idx, nOrder, pNewDepend);
+ rFrames.push_back(entry);
}
}
}
else
{
- // OD 2004-05-07 #i28701# - helper list to get <rFrameArr> sorted
- std::vector< std::pair< xub_StrLen, sal_uInt32 > > aSortLst;
- typedef std::vector< std::pair< xub_StrLen, sal_uInt32 > >::iterator tSortLstIter;
-
const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
USHORT nSize = rFmts.Count();
for ( USHORT i = 0; i < nSize; i++)
@@ -194,32 +209,14 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
// OD 2004-05-07 #i28701# - determine insert position for
// sorted <rFrameArr>
- USHORT nInsPos = rFrameArr.Count();
- {
- xub_StrLen nCntIndex = pAnchorPos->nContent.GetIndex();
- sal_uInt32 nAnchorOrder = rAnchor.GetOrder();
+ xub_StrLen nIndex = pAnchorPos->nContent.GetIndex();
+ sal_uInt32 nOrder = rAnchor.GetOrder();
- tSortLstIter aInsIter = aSortLst.end();
- for ( tSortLstIter aIter = aSortLst.begin();
- aIter != aSortLst.end();
- ++aIter )
- {
- if ( (*aIter).first > nCntIndex ||
- ( (*aIter).first == nCntIndex &&
- (*aIter).second > nAnchorOrder ) )
- {
- nInsPos = sal::static_int_cast< USHORT >(aIter - aSortLst.begin());
- aInsIter = aIter;
- break;
- }
- }
- std::pair< xub_StrLen, sal_uInt32 > aEntry( nCntIndex,
- nAnchorOrder );
- aSortLst.insert( aInsIter, aEntry );
- }
- rFrameArr.C40_INSERT( SwDepend, pNewDepend, nInsPos );
+ FrameDependSortListEntry entry(nIndex, nOrder, pNewDepend);
+ rFrames.push_back(entry);
}
}
+ ::std::sort(rFrames.begin(), rFrames.end(), FrameDependSortListLess());
}
}
@@ -769,7 +766,9 @@ void SwXTextCursor::SetCrsrAttr(SwPaM& rPam, const SfxItemSet& rSet, USHORT nAtt
{
if( _pStartCrsr->HasMark() && ( (CRSR_ATTR_MODE_TABLE & nAttrMode) ||
*_pStartCrsr->GetPoint() != *_pStartCrsr->GetMark() ))
- pDoc->Insert(*_pStartCrsr, rSet, nFlags );
+ {
+ pDoc->InsertItemSet(*_pStartCrsr, rSet, nFlags);
+ }
} while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rPam );
pDoc->EndUndo(UNDO_INSATTR, NULL);
@@ -778,7 +777,7 @@ void SwXTextCursor::SetCrsrAttr(SwPaM& rPam, const SfxItemSet& rSet, USHORT nAtt
{
// if( !HasSelection() )
// UpdateAttr();
- pDoc->Insert( *pCrsr, rSet, nFlags );
+ pDoc->InsertItemSet( *pCrsr, rSet, nFlags );
}
//#outline level,add by zhaojianwei
if( rSet.GetItemState( RES_PARATR_OUTLINELEVEL, false ) >= SFX_ITEM_AVAILABLE )
@@ -1214,9 +1213,16 @@ void SwXTextRange::_CreateNewBookmark(SwPaM& rPam)
pMark->Add(this);
}
-void SwXTextRange::DeleteAndInsert(const String& rText)
+void SwXTextRange::DeleteAndInsert(
+ const String& rText, const bool bForceExpandHints)
throw(uno::RuntimeException)
{
+ if (RANGE_IS_TABLE == eRangePosition)
+ {
+ // setString on table not allowed
+ throw uno::RuntimeException();
+ }
+
::sw::mark::IMark const * const pBkmk = GetBookmark();
if(pBkmk)
{
@@ -1231,11 +1237,14 @@ void SwXTextRange::DeleteAndInsert(const String& rText)
UnoActionContext aAction(pDoc);
pDoc->StartUndo(UNDO_INSERT, NULL);
if(aNewCrsr.HasMark())
+ {
pDoc->DeleteAndJoin(aNewCrsr);
+ }
if(rText.Len())
{
- SwUnoCursorHelper::DocInsertStringSplitCR(*pDoc, aNewCrsr, rText);
+ SwUnoCursorHelper::DocInsertStringSplitCR(
+ *pDoc, aNewCrsr, rText, bForceExpandHints);
SwXTextCursor::SelectPam(aNewCrsr, sal_True);
aNewCrsr.Left(rText.Len(), CRSR_SKIP_CHARS, FALSE, FALSE);
@@ -1335,13 +1344,7 @@ void SwXTextRange::setString(const OUString& aString)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(RANGE_IS_TABLE == eRangePosition)
- {
- //setString in Tabellen kann nicht erlaubt werden
- throw uno::RuntimeException();
- }
- else
- DeleteAndInsert(aString);
+ DeleteAndInsert(aString, false);
}
void SwXTextRange::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
@@ -1438,12 +1441,10 @@ sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill,
}
else
{
- const SwPaM* pUnoCrsr = 0;
- SwDoc* pDoc = pCursor ? pCursor->GetDoc() : NULL;
-
- if ( !pDoc )
- pDoc = pPortion ? pPortion->GetCrsr()->GetDoc() : NULL;
- pUnoCrsr = pCursor ? pCursor->GetPaM() : pPortion ? pPortion->GetCrsr() : 0;
+ SwDoc* const pDoc = (pCursor) ? pCursor->GetDoc()
+ : ((pPortion) ? pPortion->GetCursor()->GetDoc() : 0);
+ const SwPaM* const pUnoCrsr = (pCursor) ? pCursor->GetPaM()
+ : ((pPortion) ? pPortion->GetCursor() : 0);
if (pUnoCrsr && pDoc == rToFill.GetDoc())
{
DBG_ASSERT((SwPaM*)pUnoCrsr->GetNext() == pUnoCrsr, "was machen wir mit Ringen?" );
@@ -1907,9 +1908,11 @@ sal_Int32 SwXTextRanges::getCount(void) throw( uno::RuntimeException )
SwUnoCrsr* pCrsr = GetCrsr();
if(pCrsr)
{
- FOREACHUNOPAM_START(pCrsr)
+ SwPaM *pTmpCrsr = pCrsr;
+ do {
nRet++;
- FOREACHUNOPAM_END()
+ pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext());
+ } while ( pTmpCrsr != pCrsr );
}
else if(pRangeArr)
nRet = pRangeArr->Count();
@@ -1958,15 +1961,20 @@ XTextRangeArr* SwXTextRanges::GetRangesArray()
if(!pRangeArr && pCrsr)
{
pRangeArr = new XTextRangeArr();
- FOREACHUNOPAM_START(pCrsr)
+ SwPaM *pTmpCrsr = pCrsr;
+ do {
uno::Reference< XTextRange >* pPtr =
- new uno::Reference<XTextRange>( SwXTextRange::CreateTextRangeFromPosition(PUNOPAM->GetDoc(),
- *PUNOPAM->GetPoint(), PUNOPAM->GetMark()));
-// new uno::Reference<XTextRange>( SwXTextRange::createTextRangeFromPaM(*PUNOPAM, xParentText));
+ new uno::Reference<XTextRange>(
+ SwXTextRange::CreateTextRangeFromPosition(
+ pTmpCrsr->GetDoc(),
+ *pTmpCrsr->GetPoint(), pTmpCrsr->GetMark()));
+// new uno::Reference<XTextRange>( SwXTextRange::createTextRangeFromPaM(*pTmpCrsr, xParentText));
if(pPtr->is())
pRangeArr->Insert(pPtr, pRangeArr->Count());
- FOREACHUNOPAM_END()
+
+ pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext());
+ } while ( pTmpCrsr != pCrsr );
pCrsr->Remove( this );
}
return pRangeArr;
@@ -1994,37 +2002,107 @@ void SwXTextCursor::SetString(SwCursor& rCrsr, const OUString& rString)
pDoc->DeleteAndJoin(rCrsr);
if(nTxtLen)
{
- if( !SwUnoCursorHelper::DocInsertStringSplitCR( *pDoc, rCrsr, aText ) )
- {
- DBG_ASSERT( sal_False, "DocInsertStringSplitCR" );
- }
+ const bool bSuccess( SwUnoCursorHelper::DocInsertStringSplitCR(
+ *pDoc, rCrsr, aText, false ) );
+ DBG_ASSERT( bSuccess, "DocInsertStringSplitCR" );
+ (void) bSuccess;
SwXTextCursor::SelectPam(rCrsr, sal_True);
rCrsr.Left(nTxtLen, CRSR_SKIP_CHARS, FALSE, FALSE);
}
pDoc->EndUndo(UNDO_INSERT, NULL);
}
+
/******************************************************************
* SwXParaFrameEnumeration
******************************************************************/
-SV_IMPL_PTRARR(SwDependArr, SwDepend*);
+
+/* -----------------23.03.99 13:38-------------------
+ *
+ * --------------------------------------------------*/
+static sal_Bool
+lcl_CreateNextObject(SwUnoCrsr& i_rUnoCrsr,
+ uno::Reference<text::XTextContent> & o_rNextObject,
+ FrameDependList_t & i_rFrames)
+{
+ if (!i_rFrames.size())
+ return sal_False;
+
+ SwFrmFmt* pFormat = static_cast<SwFrmFmt*>(const_cast<SwModify*>(
+ i_rFrames.front()->GetRegisteredIn()));
+ i_rFrames.pop_front();
+ // the format should be valid here, otherwise the client
+ // would have been removed in ::Modify
+ // check for a shape first
+ SwClientIter aIter(*pFormat);
+ SwDrawContact * const pContact =
+ static_cast<SwDrawContact*>( aIter.First(TYPE(SwDrawContact)) );
+ if (pContact)
+ {
+ SdrObject * const pSdr = pContact->GetMaster();
+ if (pSdr)
+ {
+ o_rNextObject.set(pSdr->getUnoShape(), uno::UNO_QUERY);
+ }
+ }
+ else
+ {
+ const SwNodeIndex* pIdx = pFormat->GetCntnt().GetCntntIdx();
+ DBG_ASSERT(pIdx, "where is the index?");
+ const SwNode* pNd =
+ i_rUnoCrsr.GetDoc()->GetNodes()[ pIdx->GetIndex() + 1 ];
+
+ const FlyCntType eType = (!pNd->IsNoTxtNode()) ? FLYCNTTYPE_FRM
+ : ( (pNd->IsGrfNode()) ? FLYCNTTYPE_GRF : FLYCNTTYPE_OLE );
+
+ const uno::Reference< container::XNamed > xFrame =
+ SwXFrames::GetObject(*pFormat, eType);
+ o_rNextObject.set(xFrame, uno::UNO_QUERY);
+ }
+
+ return o_rNextObject.is();
+}
+
+/* -----------------------------03.04.00 10:15--------------------------------
+ Description: Search for a FLYCNT text attribute at the cursor point
+ and fill the frame into the array
+ ---------------------------------------------------------------------------*/
+static void
+lcl_FillFrame(SwXParaFrameEnumeration & rEnum, SwUnoCrsr& rUnoCrsr,
+ FrameDependList_t & rFrames)
+{
+ // search for objects at the cursor - anchored at/as char
+ const SwTxtAttr * pTxtAttr = rUnoCrsr.GetNode()->GetTxtNode()->GetTxtAttr(
+ rUnoCrsr.GetPoint()->nContent, RES_TXTATR_FLYCNT);
+ if (pTxtAttr)
+ {
+ const SwFmtFlyCnt& rFlyCnt = pTxtAttr->GetFlyCnt();
+ SwFrmFmt * const pFrmFmt = rFlyCnt.GetFrmFmt();
+ SwDepend * const pNewDepend = new SwDepend(&rEnum, pFrmFmt);
+ rFrames.push_back( ::boost::shared_ptr<SwDepend>(pNewDepend) );
+ }
+}
+
/* -----------------------------06.04.00 16:39--------------------------------
---------------------------------------------------------------------------*/
-OUString SwXParaFrameEnumeration::getImplementationName(void) throw( RuntimeException )
+OUString SwXParaFrameEnumeration::getImplementationName()
+throw( RuntimeException )
{
return C2U("SwXParaFrameEnumeration");
}
/* -----------------------------06.04.00 16:39--------------------------------
---------------------------------------------------------------------------*/
-BOOL SwXParaFrameEnumeration::supportsService(const OUString& rServiceName) throw( RuntimeException )
+sal_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 > SwXParaFrameEnumeration::getSupportedServiceNames()
+throw( RuntimeException )
{
Sequence< OUString > aRet(1);
OUString* pArray = aRet.getArray();
@@ -2049,14 +2127,17 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(const SwPaM& rPaM,
if (PARAFRAME_PORTION_PARAGRAPH == nParaFrameMode)
{
- ::CollectFrameAtNode( *this, rPaM.GetPoint()->nNode,
- aFrameArr, FALSE );
+ FrameDependSortList_t frames;
+ ::CollectFrameAtNode( *this, rPaM.GetPoint()->nNode, frames, false );
+ ::std::transform(frames.begin(), frames.end(),
+ ::std::back_inserter(m_Frames),
+ ::boost::bind(&FrameDependSortListEntry::pFrameDepend, _1));
}
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());
+ m_Frames.push_back( ::boost::shared_ptr<SwDepend>(pNewDepend) );
}
else if((PARAFRAME_PORTION_CHAR == nParaFrameMode) ||
(PARAFRAME_PORTION_TEXTRANGE == nParaFrameMode))
@@ -2072,7 +2153,7 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(const SwPaM& rPaM,
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());
+ m_Frames.push_back( ::boost::shared_ptr<SwDepend>(pNewDepend) );
}
//created from any text range
if(pUnoCrsr->HasMark())
@@ -2081,13 +2162,13 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(const SwPaM& rPaM,
pUnoCrsr->Exchange();
do
{
- FillFrame(*pUnoCrsr);
+ lcl_FillFrame(*this, *pUnoCrsr, m_Frames);
pUnoCrsr->Right(1, CRSR_SKIP_CHARS, FALSE, FALSE);
}
while(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark());
}
}
- FillFrame(*pUnoCrsr);
+ lcl_FillFrame(*this, *pUnoCrsr, m_Frames);
}
}
/*-- 23.03.99 13:22:30---------------------------------------------------
@@ -2096,102 +2177,53 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration(const SwPaM& rPaM,
SwXParaFrameEnumeration::~SwXParaFrameEnumeration()
{
vos::OGuard aGuard(Application::GetSolarMutex());
- aFrameArr.DeleteAndDestroy(0, aFrameArr.Count());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
+
+ SwUnoCrsr* pUnoCrsr = GetCursor();
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 )
+sal_Bool SwXParaFrameEnumeration::hasMoreElements()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!GetCrsr())
+
+ if (!GetCursor())
throw uno::RuntimeException();
- return xNextObject.is() ? sal_True : CreateNextObject();
+
+ return m_xNextObject.is() ? sal_True :
+ lcl_CreateNextObject(*GetCursor(), m_xNextObject, m_Frames);
}
/*-- 23.03.99 13:22:33---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Any SwXParaFrameEnumeration::nextElement(void)
- throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+uno::Any SwXParaFrameEnumeration::nextElement()
+ throw( container::NoSuchElementException,
+ lang::WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!GetCrsr())
+
+ if (!GetCursor())
throw uno::RuntimeException();
- if(!xNextObject.is() && aFrameArr.Count())
+
+ if (!m_xNextObject.is() && m_Frames.size())
{
- CreateNextObject();
+ lcl_CreateNextObject(*GetCursor(), m_xNextObject, m_Frames);
}
- if(!xNextObject.is())
+ if(!m_xNextObject.is())
throw container::NoSuchElementException();
- uno::Any aRet(&xNextObject, ::getCppuType((uno::Reference<XTextContent>*)0));
- xNextObject = 0;
+ uno::Any aRet(&m_xNextObject,
+ ::getCppuType((uno::Reference<XTextContent>*)0));
+ m_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();
-}
+struct InvalidFrameDepend {
+ bool operator() (::boost::shared_ptr<SwDepend> const & rEntry)
+ { return !rEntry->GetRegisteredIn(); }
+};
/*-- 23.03.99 13:22:37---------------------------------------------------
@@ -2215,21 +2247,16 @@ void SwXParaFrameEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
}
if(!GetRegisteredIn())
{
- aFrameArr.DeleteAndDestroy(0, aFrameArr.Count());
- xNextObject = 0;
+ m_Frames.clear();
+ m_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);
- }
- }
+ // check if any frame went away...
+ FrameDependList_t::iterator iter =
+ ::std::remove_if(m_Frames.begin(), m_Frames.end(),
+ InvalidFrameDepend());
+ m_Frames.erase(iter, m_Frames.end());
}
}
// -----------------------------------------------------------------------------
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index d21439ff120e..227b8cf58e42 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -35,6 +35,7 @@
#include <cmdid.h>
#include <unomid.h>
#include <unoobj.hxx>
+#include <unoport.hxx>
#include <unomap.hxx>
#include <unocrsr.hxx>
#include <unoprnms.hxx>
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 4aa2d1a27d6f..04d073a09df3 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -41,20 +41,20 @@
#include <unoobj.hxx>
#include <unomap.hxx>
#include <unoprnms.hxx>
-#ifndef _UNOMID_H
#include <unomid.h>
-#endif
#include <txtatr.hxx>
#include <txtfld.hxx>
#include <ndtxt.hxx>
#include <doc.hxx>
#include <fmtflcnt.hxx>
#include <fmtfld.hxx>
+
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
#include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
+
using namespace ::com::sun::star;
using ::rtl::OUString;
@@ -63,88 +63,95 @@ using ::rtl::OUString;
* SwXTextPortion
******************************************************************/
-/*-- 11.12.98 09:56:52---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SwFmtFld* SwXTextPortion::GetFldFmt(sal_Bool bInit)
+static void init(SwXTextPortion & rPortion, const SwUnoCrsr* pPortionCursor)
{
- SwFmtFld* pRet = 0;
- // initial wird es immer gesucht, danach nur noch, wenn es bereits existierte
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr && (bInit || pFmtFld))
+ SwUnoCrsr* pUnoCursor =
+ pPortionCursor->GetDoc()->CreateUnoCrsr(*pPortionCursor->GetPoint());
+ if (pPortionCursor->HasMark())
{
- 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();
+ pUnoCursor->SetMark();
+ *pUnoCursor->GetMark() = *pPortionCursor->GetMark();
}
- return pRet;
+ pUnoCursor->Add(& rPortion);
}
+
/*-- 11.12.98 09:56:55---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
uno::Reference< text::XText > const& rParent,
- SwTextPortionType eType) :
- aLstnrCntnr( (text::XTextRange*)this),
- m_pPropSet(aSwMapProvider.GetPropertySet(
- (PORTION_REDLINE_START == eType ||
- PORTION_REDLINE_END == eType) ?
- PROPERTY_MAP_REDLINE_PORTION : PROPERTY_MAP_TEXTPORTION_EXTENSIONS)),
- xParentText(rParent),
- pRubyText(0),
- pRubyStyle(0),
- pRubyAdjust(0),
- pRubyIsAbove(0),
- pFmtFld(0),
- aFrameDepend(this, 0),
- pFrameFmt(0),
- ePortionType(eType),
- nControlChar(0),
- bIsCollapsed(FALSE)
+ SwTextPortionType eType)
+ : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ , m_pPropSet(aSwMapProvider.GetPropertySet(
+ (PORTION_REDLINE_START == eType ||
+ PORTION_REDLINE_END == eType)
+ ? PROPERTY_MAP_REDLINE_PORTION
+ : PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
+ , m_xParentText(rParent)
+ , m_pRubyText(0)
+ , m_pRubyStyle(0)
+ , m_pRubyAdjust(0)
+ , m_pRubyIsAbove(0)
+ , m_FrameDepend(this, 0)
+ , m_pFrameFmt(0)
+ , m_ePortionType(eType)
+ , m_bIsCollapsed(false)
{
- 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)
-// ...;
+ init(*this, pPortionCrsr);
}
+
/* -----------------24.03.99 16:30-------------------
*
* --------------------------------------------------*/
SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
uno::Reference< text::XText > const& rParent,
- SwFrmFmt& rFmt ) :
- aLstnrCntnr( (text::XTextRange*)this),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXTPORTION_EXTENSIONS)),
- xParentText(rParent),
- pRubyText(0),
- pRubyStyle(0),
- pRubyAdjust(0),
- pRubyIsAbove(0),
- pFmtFld(0),
- aFrameDepend(this, &rFmt),
- pFrameFmt(&rFmt),
- ePortionType(PORTION_FRAME),
- nControlChar(0),
- bIsCollapsed(FALSE)
+ SwFrmFmt& rFmt )
+ : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ , m_pPropSet(aSwMapProvider.GetPropertySet(
+ PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
+ , m_xParentText(rParent)
+ , m_pRubyText(0)
+ , m_pRubyStyle(0)
+ , m_pRubyAdjust(0)
+ , m_pRubyIsAbove(0)
+ , m_FrameDepend(this, &rFmt)
+ , m_pFrameFmt(&rFmt)
+ , m_ePortionType(PORTION_FRAME)
+ , m_bIsCollapsed(false)
{
- SwUnoCrsr* pUnoCrsr = pPortionCrsr->GetDoc()->CreateUnoCrsr(*pPortionCrsr->GetPoint());
- if(pPortionCrsr->HasMark())
+ init(*this, pPortionCrsr);
+}
+
+/* -----------------------------19.02.01 10:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
+ SwTxtRuby const& rAttr,
+ uno::Reference< text::XText > const& xParent,
+ sal_Bool bIsEnd )
+ : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ , m_pPropSet(aSwMapProvider.GetPropertySet(
+ PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
+ , m_xParentText(xParent)
+ , m_pRubyText ( bIsEnd ? 0 : new uno::Any )
+ , m_pRubyStyle ( bIsEnd ? 0 : new uno::Any )
+ , m_pRubyAdjust ( bIsEnd ? 0 : new uno::Any )
+ , m_pRubyIsAbove( bIsEnd ? 0 : new uno::Any )
+ , m_FrameDepend(this, 0)
+ , m_pFrameFmt(0)
+ , m_ePortionType( bIsEnd ? PORTION_RUBY_END : PORTION_RUBY_START )
+ , m_bIsCollapsed(false)
+{
+ init(*this, pPortionCrsr);
+
+ if (!bIsEnd)
{
- pUnoCrsr->SetMark();
- *pUnoCrsr->GetMark() = *pPortionCrsr->GetMark();
+ const SfxPoolItem& rItem = rAttr.GetAttr();
+ rItem.QueryValue(*m_pRubyText, MID_RUBY_TEXT);
+ rItem.QueryValue(*m_pRubyStyle, MID_RUBY_CHARSTYLE);
+ rItem.QueryValue(*m_pRubyAdjust, MID_RUBY_ADJUST);
+ rItem.QueryValue(*m_pRubyIsAbove, MID_RUBY_ABOVE);
}
- pUnoCrsr->Add(this);
}
/*-- 11.12.98 09:56:55---------------------------------------------------
@@ -153,77 +160,71 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
SwXTextPortion::~SwXTextPortion()
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
+ SwUnoCrsr* pUnoCrsr = GetCursor();
delete pUnoCrsr;
- delete pRubyText;
- delete pRubyStyle;
- delete pRubyAdjust;
- delete pRubyIsAbove;
}
/*-- 11.12.98 09:56:56---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Reference< text::XText > SwXTextPortion::getText(void) throw( uno::RuntimeException )
+uno::Reference< text::XText > SwXTextPortion::getText()
+throw( uno::RuntimeException )
{
- return xParentText;
+ return m_xParentText;
}
/*-- 11.12.98 09:56:56---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Reference< text::XTextRange > SwXTextPortion::getStart(void) throw( uno::RuntimeException )
+uno::Reference< text::XTextRange > SwXTextPortion::getStart()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< text::XTextRange > xRet;
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
- {
- SwPaM aPam(*pUnoCrsr->Start());
- uno::Reference< text::XText > xParent = getText();
- xRet = new SwXTextRange(aPam, xParent);
- }
- else
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
+
+ SwPaM aPam(*pUnoCrsr->Start());
+ uno::Reference< text::XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
return xRet;
}
/*-- 11.12.98 09:56:57---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Reference< text::XTextRange > SwXTextPortion::getEnd(void) throw( uno::RuntimeException )
+uno::Reference< text::XTextRange > SwXTextPortion::getEnd()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< text::XTextRange > xRet;
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
- {
- SwPaM aPam(*pUnoCrsr->End());
- uno::Reference< text::XText > xParent = getText();
- xRet = new SwXTextRange(aPam, xParent);
- }
- else
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
+
+ SwPaM aPam(*pUnoCrsr->End());
+ uno::Reference< text::XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
return xRet;
}
/*-- 11.12.98 09:56:57---------------------------------------------------
-----------------------------------------------------------------------*/
-OUString SwXTextPortion::getString(void) throw( uno::RuntimeException )
+OUString SwXTextPortion::getString()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- String aTxt;
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
+ OUString aTxt;
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ // TextPortions are always within a paragraph
+ SwTxtNode* pTxtNd = pUnoCrsr->GetNode()->GetTxtNode();
+ if ( pTxtNd )
{
- //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 );
- }
+ 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---------------------------------------------------
@@ -232,17 +233,19 @@ OUString SwXTextPortion::getString(void) throw( uno::RuntimeException )
void SwXTextPortion::setString(const OUString& aString) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
- SwXTextCursor::SetString(*pUnoCrsr, aString);
- else
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
+
+ SwXTextCursor::SetString(*pUnoCrsr, aString);
}
/*-- 11.12.98 09:56:57---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Reference< beans::XPropertySetInfo > SwXTextPortion::getPropertySetInfo(void) throw( uno::RuntimeException )
+uno::Reference< beans::XPropertySetInfo > SwXTextPortion::getPropertySetInfo()
+throw( uno::RuntimeException )
{
+ vos::OGuard aGuard(Application::GetSolarMutex());
//! PropertySetInfo for text portion extensions
static uno::Reference< beans::XPropertySetInfo >
xTxtPorExtRef = aSwMapProvider.GetPropertySet(
@@ -252,8 +255,8 @@ uno::Reference< beans::XPropertySetInfo > SwXTextPortion::getPropertySetInfo(vo
xRedlPorRef = aSwMapProvider.GetPropertySet(
PROPERTY_MAP_REDLINE_PORTION)->getPropertySetInfo();
- return (PORTION_REDLINE_START == ePortionType ||
- PORTION_REDLINE_END == ePortionType) ? xRedlPorRef : xTxtPorExtRef;
+ return (PORTION_REDLINE_START == m_ePortionType ||
+ PORTION_REDLINE_END == m_ePortionType) ? xRedlPorRef : xTxtPorExtRef;
}
/*-- 11.12.98 09:56:57---------------------------------------------------
@@ -264,13 +267,12 @@ void SwXTextPortion::setPropertyValue(const OUString& rPropertyName,
beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
- {
- SwXTextCursor::SetPropertyValue(*pUnoCrsr, *m_pPropSet, rPropertyName, aValue);
- }
- else
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
+
+ SwXTextCursor::SetPropertyValue(*pUnoCrsr, *m_pPropSet,
+ rPropertyName, aValue);
}
/*-- 04.11.03 09:56:58---------------------------------------------------
@@ -291,13 +293,12 @@ void SwXTextPortion::GetPropertyValue(
case FN_UNO_TEXT_PORTION_TYPE:
{
const char* pRet;
- switch (ePortionType)
+ switch (m_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:
@@ -309,6 +310,7 @@ void SwXTextPortion::GetPropertyValue(
case PORTION_RUBY_START:
case PORTION_RUBY_END: pRet = "Ruby";break;
case PORTION_SOFT_PAGEBREAK:pRet = "SoftPageBreak";break;
+ case PORTION_META: pRet = SW_PROP_NAME_STR(UNO_NAME_META); break;
case PORTION_FIELD_START:pRet = "TextFieldStart";break;
case PORTION_FIELD_END:pRet = "TextFieldEnd";break;
case PORTION_FIELD_START_END:pRet = "TextFieldStartEnd";break;
@@ -322,28 +324,29 @@ void SwXTextPortion::GetPropertyValue(
rVal <<= sRet;
}
break;
- case FN_UNO_CONTROL_CHARACTER:
- {
- if(PORTION_CONTROL_CHAR == ePortionType)
- rVal <<= (sal_Int16) nControlChar;
- }
+ case FN_UNO_CONTROL_CHARACTER: // obsolete!
break;
case FN_UNO_DOCUMENT_INDEX_MARK:
- rVal <<= xTOXMark;
+ rVal <<= m_xTOXMark;
break;
case FN_UNO_REFERENCE_MARK:
- rVal <<= xRefMark;
+ rVal <<= m_xRefMark;
break;
case FN_UNO_BOOKMARK:
- rVal <<= xBookmark;
+ rVal <<= m_xBookmark;
break;
case FN_UNO_FOOTNOTE:
- rVal <<= xFootnote;
+ rVal <<= m_xFootnote;
+ break;
+ case FN_UNO_TEXT_FIELD:
+ rVal <<= m_xTextField;
+ break;
+ case FN_UNO_META:
+ rVal <<= m_xMeta;
break;
case FN_UNO_IS_COLLAPSED:
{
- BOOL bPut = TRUE;
- switch (ePortionType)
+ switch (m_ePortionType)
{
case PORTION_REFMARK_START:
case PORTION_BOOKMARK_START :
@@ -357,17 +360,17 @@ void SwXTextPortion::GetPropertyValue(
case PORTION_RUBY_END:
case PORTION_FIELD_START:
case PORTION_FIELD_END:
- rVal.setValue(&bIsCollapsed, ::getBooleanCppuType());
+ rVal.setValue(&m_bIsCollapsed, ::getBooleanCppuType());
break;
default:
- bPut = FALSE;
+ break;
}
}
break;
case FN_UNO_IS_START:
{
BOOL bStart = TRUE, bPut = TRUE;
- switch (ePortionType)
+ switch (m_ePortionType)
{
case PORTION_REFMARK_START:
case PORTION_BOOKMARK_START:
@@ -394,13 +397,13 @@ void SwXTextPortion::GetPropertyValue(
break;
case RES_TXTATR_CJK_RUBY:
{
- uno::Any* pToSet = 0;
+ const uno::Any* pToSet = 0;
switch(rEntry.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;
+ case MID_RUBY_TEXT : pToSet = m_pRubyText.get(); break;
+ case MID_RUBY_ADJUST : pToSet = m_pRubyAdjust.get(); break;
+ case MID_RUBY_CHARSTYLE:pToSet = m_pRubyStyle.get(); break;
+ case MID_RUBY_ABOVE : pToSet = m_pRubyIsAbove.get();break;
}
if(pToSet)
rVal = *pToSet;
@@ -436,8 +439,10 @@ uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl(
const OUString *pPropertyNames = rPropertyNames.getConstArray();
uno::Sequence< uno::Any > aValues(rPropertyNames.getLength());
uno::Any *pValues = aValues.getArray();
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
{
SfxItemSet *pSet = 0;
// get startting pount fo the look-up, either the provided one or else
@@ -455,8 +460,6 @@ uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl(
}
delete pSet;
}
- else
- throw uno::RuntimeException();
return aValues;
}
/*-- 11.12.98 09:56:58---------------------------------------------------
@@ -480,8 +483,10 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl(
throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException)
{
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
{
const OUString* pPropertyNames = rPropertyNames.getConstArray();
const uno::Any* pValues = rValues.getConstArray();
@@ -494,11 +499,10 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl(
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
- SwXTextCursor::SetPropertyValue( *pUnoCrsr, *m_pPropSet, pPropertyNames[nProp], pValues[nProp]);
+ SwXTextCursor::SetPropertyValue( *pUnoCrsr, *m_pPropSet,
+ pPropertyNames[nProp], pValues[nProp]);
}
}
- else
- throw uno::RuntimeException();
}
void SwXTextPortion::setPropertyValues(
@@ -564,7 +568,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPr
if (rPropertyNames.getLength() != rValues.getLength())
throw lang::IllegalArgumentException();
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ SwUnoCrsr* pUnoCrsr = this->GetCursor();
if (!pUnoCrsr)
throw uno::RuntimeException();
@@ -664,7 +668,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion:
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ SwUnoCrsr* pUnoCrsr = this->GetCursor();
if(!pUnoCrsr)
throw uno::RuntimeException();
@@ -701,6 +705,12 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion:
aResult.State = pPropertyStates[i];
aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
+ //#i104499# ruby portion attributes need special handling:
+ if( pEntry->nWID == RES_TXTATR_CJK_RUBY &&
+ m_ePortionType == PORTION_RUBY_START )
+ {
+ aResult.State = beans::PropertyState_DIRECT_VALUE;
+ }
if (!bDirectValuesOnly || beans::PropertyState_DIRECT_VALUE == aResult.State)
{
// get property value
@@ -811,17 +821,20 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN
{
vos::OGuard aGuard(Application::GetSolarMutex());
beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ if (GetTextPortionType() == PORTION_RUBY_START &&
+ !rPropertyName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") ))
{
- if(GetTextPortionType() == PORTION_RUBY_START &&
- !rPropertyName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") ))
- eRet = beans::PropertyState_DIRECT_VALUE;
- else
- eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, *m_pPropSet, rPropertyName);
+ eRet = beans::PropertyState_DIRECT_VALUE;
}
else
- throw uno::RuntimeException();
+ {
+ eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, *m_pPropSet,
+ rPropertyName);
+ }
return eRet;
}
/*-- 08.03.99 09:41:47---------------------------------------------------
@@ -832,10 +845,13 @@ uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates(
throw( beans::UnknownPropertyException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ SwUnoCrsr* pUnoCrsr = GetCursor();
if(!pUnoCrsr)
throw uno::RuntimeException();
- uno::Sequence< beans::PropertyState > aRet = SwXTextCursor::GetPropertyStates(*pUnoCrsr, *m_pPropSet, rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION);
+
+ uno::Sequence< beans::PropertyState > aRet =
+ SwXTextCursor::GetPropertyStates(*pUnoCrsr, *m_pPropSet,
+ rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION);
if(GetTextPortionType() == PORTION_RUBY_START)
{
@@ -856,13 +872,11 @@ void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName)
throw( beans::UnknownPropertyException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
- {
- SwXTextCursor::SetPropertyToDefault(*pUnoCrsr, *m_pPropSet, rPropertyName);
- }
- else
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
+
+ SwXTextCursor::SetPropertyToDefault(*pUnoCrsr, *m_pPropSet, rPropertyName);
}
/*-- 08.03.99 09:41:48---------------------------------------------------
@@ -870,33 +884,17 @@ void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName)
uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName)
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
+ vos::OGuard aGuard(Application::GetSolarMutex());
uno::Any aRet;
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
- {
- aRet = SwXTextCursor::GetPropertyDefault(*pUnoCrsr, *m_pPropSet, rPropertyName);
- }
- else
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
+
+ aRet = SwXTextCursor::GetPropertyDefault(*pUnoCrsr, *m_pPropSet,
+ rPropertyName);
return aRet;
}
-/*-- 11.12.98 09:56:59---------------------------------------------------
- -----------------------------------------------------------------------*/
-OUString SwXTextPortion::getPresentation(sal_Bool /*bShowCommand*/) throw( uno::RuntimeException )
-{
- vos::OGuard aGuard(Application::GetSolarMutex());
- 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---------------------------------------------------
-----------------------------------------------------------------------*/
@@ -911,31 +909,31 @@ void SwXTextPortion::attach(const uno::Reference< text::XTextRange > & /*xTextRa
/*-- 11.12.98 09:57:00---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Reference< text::XTextRange > SwXTextPortion::getAnchor(void) throw( uno::RuntimeException )
+uno::Reference< text::XTextRange > SwXTextPortion::getAnchor()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< text::XTextRange > aRet;
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
- aRet = new SwXTextRange(*pUnoCrsr, xParentText);
- else
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
+
+ aRet = new SwXTextRange(*pUnoCrsr, m_xParentText);
return aRet;
}
/*-- 11.12.98 09:57:00---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextPortion::dispose(void) throw( uno::RuntimeException )
+void SwXTextPortion::dispose()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
- if(pUnoCrsr)
- {
- setString(aEmptyStr);
- pUnoCrsr->Remove(this);
- }
- else
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
+
+ setString(aEmptyStr);
+ pUnoCrsr->Remove(this);
}
/*-- 11.12.98 09:57:00---------------------------------------------------
@@ -945,7 +943,8 @@ void SwXTextPortion::addEventListener(const uno::Reference< lang::XEventListener
vos::OGuard aGuard(Application::GetSolarMutex());
if(!GetRegisteredIn())
throw uno::RuntimeException();
- aLstnrCntnr.AddListener(aListener);
+
+ m_ListenerContainer.AddListener(aListener);
}
/*-- 11.12.98 09:57:01---------------------------------------------------
@@ -953,7 +952,7 @@ void SwXTextPortion::addEventListener(const uno::Reference< lang::XEventListener
void SwXTextPortion::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ if (!GetRegisteredIn() || !m_ListenerContainer.RemoveListener(aListener))
throw uno::RuntimeException();
}
/* -----------------24.03.99 13:30-------------------
@@ -963,10 +962,13 @@ uno::Reference< container::XEnumeration > SwXTextPortion::createContentEnumerat
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
+ SwUnoCrsr* pUnoCrsr = GetCursor();
if(!pUnoCrsr)
throw uno::RuntimeException();
- uno::Reference< container::XEnumeration > xRet = new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_CHAR, pFrameFmt);
+
+ uno::Reference< container::XEnumeration > xRet =
+ new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_CHAR,
+ m_pFrameFmt);
return xRet;
}
@@ -995,7 +997,8 @@ sal_Int64 SwXTextPortion::getSomething( const uno::Sequence< sal_Int8 >& rId )
/* -----------------24.03.99 13:30-------------------
*
* --------------------------------------------------*/
-uno::Sequence< OUString > SwXTextPortion::getAvailableServiceNames(void) throw( uno::RuntimeException )
+uno::Sequence< OUString > SwXTextPortion::getAvailableServiceNames()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Sequence< OUString > aRet(1);
@@ -1006,7 +1009,8 @@ uno::Sequence< OUString > SwXTextPortion::getAvailableServiceNames(void) throw(
/* -----------------25.03.99 10:30-------------------
*
* --------------------------------------------------*/
-OUString SwXTextPortion::getImplementationName(void) throw( uno::RuntimeException )
+OUString SwXTextPortion::getImplementationName()
+throw( uno::RuntimeException )
{
return C2U("SwXTextPortion");
}
@@ -1016,7 +1020,7 @@ OUString SwXTextPortion::getImplementationName(void) throw( uno::RuntimeExceptio
sal_Bool SwXTextPortion::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
+ SwUnoCrsr* pUnoCrsr = GetCursor();
if(!pUnoCrsr)
throw uno::RuntimeException();
@@ -1028,25 +1032,24 @@ sal_Bool SwXTextPortion::supportsService(const OUString& rServiceName) throw( un
!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();
+ }
return bRet;
}
/* ---------------------------------------------------------------------------
---------------------------------------------------------------------------*/
-uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames(void)
- throw( uno::RuntimeException )
+uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(!pUnoCrsr)
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
throw uno::RuntimeException();
- sal_Bool bField = 0 != GetFldFmt();
- sal_uInt16 nCount = bField ? 8 : 7;
- uno::Sequence< OUString > aRet(nCount);
+
+ uno::Sequence< OUString > aRet(7);
OUString* pArray = aRet.getArray();
pArray[0] = C2U("com.sun.star.text.TextPortion");
pArray[1] = C2U("com.sun.star.style.CharacterProperties");
@@ -1055,8 +1058,6 @@ uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames(void)
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");
return aRet;
}
/*-- 11.12.98 09:57:01---------------------------------------------------
@@ -1065,35 +1066,9 @@ uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames(void)
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,
- uno::Reference< text::XText > const& rParent,
- sal_Bool bEnd ) :
- SwXTextPortion(pPortionCrsr, rParent, bEnd ? PORTION_RUBY_END : PORTION_RUBY_START )
-{
- if(!bEnd)
+ if (!m_FrameDepend.GetRegisteredIn())
{
- const SfxPoolItem& rItem = rAttr.GetAttr();
- pRubyText = new uno::Any;
- pRubyStyle = new uno::Any;
- pRubyAdjust = new uno::Any;
- pRubyIsAbove = new uno::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);
+ m_pFrameFmt = 0;
}
}
-/* -----------------------------19.02.01 10:52--------------------------------
-
- ---------------------------------------------------------------------------*/
-SwXRubyPortion::~SwXRubyPortion()
-{
-}
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index d972329b0f52..b49816d9c9e3 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -32,30 +32,37 @@
#include "precompiled_sw.hxx"
+#include <unoport.hxx>
#include <IMark.hxx>
// --> OD 2007-10-23 #i81002#
#include <crossrefbookmark.hxx>
// <--
#include <doc.hxx>
#include <txatbase.hxx>
+#include <txtatr.hxx>
#include <ndhints.hxx>
#include <ndtxt.hxx>
#include <unocrsr.hxx>
#include <docary.hxx>
-#include <fmthbsh.hxx>
#include <tox.hxx>
#include <unoclbck.hxx>
#include <unoobj.hxx>
#include <unoredline.hxx>
+#include <unofield.hxx>
+#include <unometa.hxx>
#include <fmtanchr.hxx>
+#include <fmtrfmrk.hxx>
#include <unoidx.hxx>
#include <redline.hxx>
#include <crsskip.hxx>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
#include <set>
+
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
+#include <algorithm>
+#include <stack>
using namespace ::com::sun::star;
@@ -64,6 +71,16 @@ using namespace ::com::sun::star::text;
using ::rtl::OUString;
using namespace ::std;
+typedef ::std::pair< TextRangeList_t * const, SwTxtAttr const * const > PortionList_t;
+typedef ::std::stack< PortionList_t > PortionStack_t;
+
+static void lcl_CreatePortions(
+ TextRangeList_t & i_rPortions,
+ uno::Reference< text::XText > const& i_xParentText,
+ SwUnoCrsr* pUnoCrsr,
+ FrameDependSortList_t & i_rFrames,
+ const sal_Int32 i_nStartPos, const sal_Int32 i_nEndPos );
+
namespace
{
@@ -182,8 +199,9 @@ const uno::Sequence< sal_Int8 > & SwXTextPortionEnumeration::getUnoTunnelId()
/* -----------------------------10.03.00 18:04--------------------------------
---------------------------------------------------------------------------*/
-sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething( const uno::Sequence< sal_Int8 >& rId )
- throw(uno::RuntimeException)
+sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
+throw(uno::RuntimeException)
{
if( rId.getLength() == 16
&& 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
@@ -196,167 +214,286 @@ sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething( const uno::Sequence<
/* -----------------------------06.04.00 16:39--------------------------------
---------------------------------------------------------------------------*/
-OUString SwXTextPortionEnumeration::getImplementationName(void) throw( RuntimeException )
+OUString SwXTextPortionEnumeration::getImplementationName()
+throw( RuntimeException )
{
return C2U("SwXTextPortionEnumeration");
}
/* -----------------------------06.04.00 16:39--------------------------------
---------------------------------------------------------------------------*/
-BOOL SwXTextPortionEnumeration::supportsService(const OUString& rServiceName) throw( RuntimeException )
+sal_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 > SwXTextPortionEnumeration::getSupportedServiceNames()
+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)
+ SwPaM& rParaCrsr,
+ uno::Reference< XText > const & xParentText,
+ const sal_Int32 nStart,
+ const sal_Int32 nEnd )
+ : m_Portions()
{
- SwUnoCrsr* pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), sal_False);
+ 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
- ::CollectFrameAtNode( *this, pUnoCrsr->GetPoint()->nNode,
- aFrameArr, TRUE );
- CreatePortions();
+
+ // find all frames, graphics and OLEs that are bound AT character in para
+ FrameDependSortList_t frames;
+ ::CollectFrameAtNode(*this, pUnoCrsr->GetPoint()->nNode, frames, true);
+ lcl_CreatePortions(m_Portions, xParentText, pUnoCrsr, frames, nStart, nEnd);
+}
+
+SwXTextPortionEnumeration::SwXTextPortionEnumeration(
+ SwPaM& rParaCrsr,
+ TextRangeList_t const & rPortions )
+ : m_Portions( rPortions )
+{
+ SwUnoCrsr* const pUnoCrsr =
+ rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), sal_False);
+ pUnoCrsr->Add(this);
}
+
/*-- 27.01.99 10:44:44---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
{
vos::OGuard aGuard(Application::GetSolarMutex());
- 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();
+ SwUnoCrsr* pUnoCrsr = GetCursor();
delete pUnoCrsr;
}
/*-- 27.01.99 10:44:44---------------------------------------------------
-----------------------------------------------------------------------*/
-sal_Bool SwXTextPortionEnumeration::hasMoreElements(void) throw( uno::RuntimeException )
+sal_Bool SwXTextPortionEnumeration::hasMoreElements()
+throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- return aPortionArr.Count() > 0;
+
+ return (m_Portions.size() > 0) ? sal_True : sal_False;
}
/*-- 27.01.99 10:44:45---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Any SwXTextPortionEnumeration::nextElement(void)
- throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+uno::Any SwXTextPortionEnumeration::nextElement()
+throw( container::NoSuchElementException, lang::WrappedTargetException,
+ uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!aPortionArr.Count())
+
+ if (!m_Portions.size())
throw container::NoSuchElementException();
- XTextRangeRefPtr pPortion = aPortionArr.GetObject(0);
- Any aRet(pPortion, ::getCppuType((uno::Reference<XTextRange>*)0));
- aPortionArr.Remove(0);
- delete pPortion;
- return aRet;
+
+ Any any;
+ any <<= m_Portions.front();
+ m_Portions.pop_front();
+ return any;
+}
+
+//======================================================================
+
+typedef ::std::deque< xub_StrLen > FieldMarks_t;
+
+static void
+lcl_FillFieldMarkArray(FieldMarks_t & rFieldMarks, SwUnoCrsr const & rUnoCrsr,
+ const sal_Int32 i_nStartPos)
+{
+ const SwTxtNode * const pTxtNode =
+ rUnoCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
+ if (!pTxtNode) return;
+
+ const sal_Unicode fld[] = {
+ CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, CH_TXT_ATR_FORMELEMENT, 0 };
+ xub_StrLen pos = ::std::max(static_cast<const sal_Int32>(0), i_nStartPos);
+ while ((pos = pTxtNode->GetTxt().SearchChar(fld, pos)) != STRING_NOTFOUND)
+ {
+ rFieldMarks.push_back(pos);
+ ++pos;
+ }
}
+
+static uno::Reference<text::XTextRange>
+lcl_ExportFieldMark(
+ uno::Reference< text::XText > const & i_xParentText,
+ SwUnoCrsr * const pUnoCrsr,
+ const SwTxtNode * const pTxtNode )
+{
+ uno::Reference<text::XTextRange> xRef;
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ //flr: maybe its a good idea to add a special hint to the hints array and rely on the hint segmentation....
+ const xub_StrLen start = pUnoCrsr->Start()->nContent.GetIndex();
+ ASSERT(pUnoCrsr->End()->nContent.GetIndex() == start,
+ "hmm --- why is this different");
+
+ pUnoCrsr->Right(1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ if ( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
+ {
+ ASSERT(false, "cannot move cursor?");
+ return 0;
+ }
+
+ const sal_Unicode Char = pTxtNode->GetTxt().GetChar(start);
+ if (CH_TXT_ATR_FIELDSTART == Char)
+ {
+ ::sw::mark::IFieldmark* pFieldmark = NULL;
+ if (pDoc)
+ {
+ pFieldmark = pDoc->getIDocumentMarkAccess()->
+ getFieldmarkFor(*pUnoCrsr->GetMark());
+ }
+ SwXTextPortion* pPortion = new SwXTextPortion(
+ pUnoCrsr, i_xParentText, PORTION_FIELD_START);
+ xRef = pPortion;
+ if (pPortion && pFieldmark && pDoc)
+ pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
+ }
+ else if (CH_TXT_ATR_FIELDEND == Char)
+ {
+ ::sw::mark::IFieldmark* pFieldmark = NULL;
+ if (pDoc)
+ {
+ pFieldmark = pDoc->getIDocumentMarkAccess()->
+ getFieldmarkFor(*pUnoCrsr->GetMark());
+ }
+ SwXTextPortion* pPortion = new SwXTextPortion(
+ pUnoCrsr, i_xParentText, PORTION_FIELD_END);
+ xRef = pPortion;
+ if (pPortion && pFieldmark && pDoc)
+ pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
+ }
+ else if (CH_TXT_ATR_FORMELEMENT == Char)
+ {
+ ::sw::mark::IFieldmark* pFieldmark = NULL;
+ if (pDoc)
+ {
+ pFieldmark = pDoc->getIDocumentMarkAccess()->
+ getFieldmarkFor(*pUnoCrsr->GetMark());
+ }
+ SwXTextPortion* pPortion = new SwXTextPortion(
+ pUnoCrsr, i_xParentText, PORTION_FIELD_START_END);
+ xRef = pPortion;
+ if (pPortion && pFieldmark && pDoc)
+ pPortion->SetBookmark(new SwXFieldmark(true, pFieldmark, pDoc));
+ }
+ else
+ {
+ ASSERT(false, "no fieldmark found?");
+ }
+ return xRef;
+}
+
/* -----------------------------31.08.00 14:28--------------------------------
---------------------------------------------------------------------------*/
-void lcl_InsertRefMarkPortion(
- XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr,
- Reference<XText> const& rParent, SwTxtAttr* pAttr, BOOL bEnd)
+static Reference<XTextRange>
+lcl_CreateRefMarkPortion(
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ const SwTxtAttr & rAttr, const bool bEnd)
{
SwDoc* pDoc = pUnoCrsr->GetDoc();
- SwFmtRefMark& rRefMark = ((SwFmtRefMark&)pAttr->GetAttr());
- Reference<XTextContent> xContent = ((SwUnoCallBack*)pDoc->GetUnoCallBack())->GetRefMark(rRefMark);
- if(!xContent.is())
+ const SwFmtRefMark& rRefMark =
+ static_cast<const SwFmtRefMark&>(rAttr.GetAttr());
+ Reference<XTextContent> xContent =
+ static_cast<SwUnoCallBack*>(pDoc->GetUnoCallBack())
+ ->GetRefMark(rRefMark);
+ if (!xContent.is())
+ {
xContent = new SwXReferenceMark(pDoc, &rRefMark);
+ }
SwXTextPortion* pPortion = 0;
- if(!bEnd)
+ if (!bEnd)
{
- rArr.Insert(
- new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_REFMARK_START)),
- rArr.Count());
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_REFMARK_START);
pPortion->SetRefMark(xContent);
- pPortion->SetCollapsed(pAttr->GetEnd() ? FALSE : TRUE);
+ pPortion->SetCollapsed(rAttr.GetEnd() ? false : true);
}
else
{
- rArr.Insert(
- new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_REFMARK_END)),
- rArr.Count());
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_REFMARK_END);
pPortion->SetRefMark(xContent);
}
+ return pPortion;
}
+
//-----------------------------------------------------------------------------
-void lcl_InsertRubyPortion( XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr,
- Reference<XText> const& rParent, SwTxtAttr* pAttr, BOOL bEnd)
+static void
+lcl_InsertRubyPortion(
+ TextRangeList_t & rPortions,
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ const SwTxtAttr & rAttr, const sal_Bool bEnd)
{
- SwXRubyPortion* pPortion =
- new SwXRubyPortion(pUnoCrsr, *(SwTxtRuby*)pAttr, rParent, bEnd);
- rArr.Insert( new Reference< XTextRange >(pPortion), rArr.Count() );
- pPortion->SetCollapsed(pAttr->GetEnd() ? FALSE : TRUE);
+ SwXTextPortion* pPortion = new SwXTextPortion(pUnoCrsr,
+ static_cast<const SwTxtRuby&>(rAttr), xParent, bEnd);
+ rPortions.push_back(pPortion);
+ pPortion->SetCollapsed(rAttr.GetEnd() ? false : true);
}
+
//-----------------------------------------------------------------------------
-void lcl_InsertTOXMarkPortion(
- XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr, Reference<XText> const& rParent,
- SwTxtAttr* pAttr, BOOL bEnd)
+static Reference<XTextRange>
+lcl_CreateTOXMarkPortion(
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ const SwTxtAttr & rAttr, const bool bEnd)
{
SwDoc* pDoc = pUnoCrsr->GetDoc();
- SwTOXMark& rTOXMark = ((SwTOXMark&)pAttr->GetAttr());
+ const SwTOXMark& rTOXMark = static_cast<const SwTOXMark&>(rAttr.GetAttr());
Reference<XTextContent> xContent =
- ((SwUnoCallBack*)pDoc->GetUnoCallBack())->GetTOXMark(rTOXMark);
- if(!xContent.is())
- xContent = new SwXDocumentIndexMark(rTOXMark.GetTOXType(), &rTOXMark, pDoc);
+ static_cast<SwUnoCallBack*>(pDoc->GetUnoCallBack())
+ ->GetTOXMark(rTOXMark);
+ if (!xContent.is())
+ {
+ xContent = new SwXDocumentIndexMark(rTOXMark.GetTOXType(),
+ &rTOXMark, pDoc);
+ }
SwXTextPortion* pPortion = 0;
- if(!bEnd)
+ if (!bEnd)
{
- rArr.Insert(
- new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_TOXMARK_START)),
- rArr.Count());
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_TOXMARK_START);
pPortion->SetTOXMark(xContent);
- pPortion->SetCollapsed(pAttr->GetEnd() ? FALSE : TRUE);
+ pPortion->SetCollapsed(rAttr.GetEnd() ? false : true);
}
- if(bEnd)
+ else
{
- rArr.Insert(
- new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_TOXMARK_END)),
- rArr.Count());
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_TOXMARK_END);
pPortion->SetTOXMark(xContent);
}
+ return pPortion;
}
//-----------------------------------------------------------------------------
-void lcl_ExportBookmark(
- SwXBookmarkPortion_ImplList& rBkmArr, ULONG nIndex,
- SwUnoCrsr* pUnoCrsr, Reference<XText> & rParent, XTextRangeArr& rPortionArr)
+static void
+lcl_ExportBookmark(
+ TextRangeList_t & rPortions,
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwXBookmarkPortion_ImplList& rBkmArr, const ULONG nIndex)
{
for ( SwXBookmarkPortion_ImplList::iterator aIter = rBkmArr.begin(), aEnd = rBkmArr.end();
aIter != aEnd; )
@@ -371,31 +508,37 @@ void lcl_ExportBookmark(
break;
SwXTextPortion* pPortion = 0;
- if(BKM_TYPE_START == pPtr->nBkmType || BKM_TYPE_START_END == pPtr->nBkmType)
+ 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 =
+ new SwXTextPortion(pUnoCrsr, xParent, PORTION_BOOKMARK_START);
+ rPortions.push_back(pPortion);
pPortion->SetBookmark(pPtr->xBookmark);
- pPortion->SetCollapsed(BKM_TYPE_START_END == pPtr->nBkmType ? TRUE : FALSE);
+ pPortion->SetCollapsed( (BKM_TYPE_START_END == pPtr->nBkmType)
+ ? true : false);
}
- if(BKM_TYPE_END == pPtr->nBkmType)
+ if (BKM_TYPE_END == pPtr->nBkmType)
{
- rPortionArr.Insert(
- new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_BOOKMARK_END)),
- rPortionArr.Count());
+ pPortion =
+ new SwXTextPortion(pUnoCrsr, xParent, PORTION_BOOKMARK_END);
+ rPortions.push_back(pPortion);
pPortion->SetBookmark(pPtr->xBookmark);
}
rBkmArr.erase( aIter++ );
}
}
-void lcl_ExportSoftPageBreak(
- SwSoftPageBreakList& rBreakArr, ULONG nIndex,
- SwUnoCrsr* pUnoCrsr, Reference<XText> & rParent, XTextRangeArr& rPortionArr)
+static void
+lcl_ExportSoftPageBreak(
+ TextRangeList_t & rPortions,
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwSoftPageBreakList& rBreakArr, const ULONG nIndex)
{
- for ( SwSoftPageBreakList::iterator aIter = rBreakArr.begin(), aEnd = rBreakArr.end();
+ for ( SwSoftPageBreakList::iterator aIter = rBreakArr.begin(),
+ aEnd = rBreakArr.end();
aIter != aEnd; )
{
if ( nIndex > *aIter )
@@ -406,9 +549,8 @@ void lcl_ExportSoftPageBreak(
if ( nIndex < *aIter )
break;
- rPortionArr.Insert(
- new Reference< XTextRange >(new SwXTextPortion(pUnoCrsr, rParent, PORTION_SOFT_PAGEBREAK)),
- rPortionArr.Count());
+ rPortions.push_back(
+ new SwXTextPortion(pUnoCrsr, xParent, PORTION_SOFT_PAGEBREAK) );
rBreakArr.erase( aIter++ );
}
}
@@ -426,49 +568,60 @@ void lcl_ExportSoftPageBreak(
struct SwXRedlinePortion_Impl
{
- const SwRedline* pRedline;
- sal_Bool bStart;
+ const SwRedline* m_pRedline;
+ const bool m_bStart;
- SwXRedlinePortion_Impl ( const SwRedline* pRed, sal_Bool bIsStart )
- : pRedline(pRed)
- , bStart(bIsStart)
+ SwXRedlinePortion_Impl ( const SwRedline* pRed, const bool bIsStart )
+ : m_pRedline(pRed)
+ , m_bStart(bIsStart)
{
}
+
ULONG getRealIndex ()
{
- return bStart ? pRedline->Start()->nContent.GetIndex() :
- pRedline->End() ->nContent.GetIndex();
+ return m_bStart ? m_pRedline->Start()->nContent.GetIndex()
+ : m_pRedline->End() ->nContent.GetIndex();
}
};
-typedef boost::shared_ptr < SwXRedlinePortion_Impl > SwXRedlinePortion_ImplSharedPtr;
+typedef boost::shared_ptr < SwXRedlinePortion_Impl >
+ SwXRedlinePortion_ImplSharedPtr;
+
struct RedlineCompareStruct
{
const SwPosition& getPosition ( const SwXRedlinePortion_ImplSharedPtr &r )
{
- return *(r->bStart ? r->pRedline->Start() : r->pRedline->End());
+ return *(r->m_bStart ? r->m_pRedline->Start() : r->m_pRedline->End());
}
+
bool operator () ( const SwXRedlinePortion_ImplSharedPtr &r1,
const SwXRedlinePortion_ImplSharedPtr &r2 )
{
return getPosition ( r1 ) < getPosition ( r2 );
}
};
-typedef std::multiset < SwXRedlinePortion_ImplSharedPtr, RedlineCompareStruct > SwXRedlinePortion_ImplList;
+
+typedef std::multiset < SwXRedlinePortion_ImplSharedPtr, RedlineCompareStruct >
+SwXRedlinePortion_ImplList;
//-----------------------------------------------------------------------------
-Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
- XTextRangeArr& rPortionArr,
- SwUnoCrsr* pUnoCrsr,
- const Reference<XText> & rParent,
+static Reference<XTextRange>
+lcl_ExportHints(
+ PortionStack_t & rPortionStack,
+ const Reference<XText> & xParent,
+ SwUnoCrsr * const pUnoCrsr,
+ SwpHints * const pHints,
+ const sal_Int32 i_nStartPos,
+ const sal_Int32 i_nEndPos,
const xub_StrLen nCurrentIndex,
- SwTextPortionType & rePortionType,
- bool & io_rbRightMoveForbidden,
+ const bool bRightMoveForbidden,
+ bool & o_rbCursorMoved,
sal_Int32 & o_rNextAttrPosition )
{
+ // if the attribute has a dummy character, then xRef is set (except META)
+ // otherwise, the portion for the attribute is inserted into rPortions!
Reference<XTextRange> xRef;
SwDoc* pDoc = pUnoCrsr->GetDoc();
- bool bAlreadyMoved = false;
//search for special text attributes - first some ends
sal_uInt16 nEndIndex = 0;
sal_uInt16 nNextEnd = 0;
@@ -478,35 +631,88 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
{
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))
+ SwTxtAttr * const pAttr = pHints->GetEnd(nEndIndex);
+ if (nNextEnd == nCurrentIndex)
{
- switch( nAttrWhich )
+ const USHORT nWhich( pAttr->Which() );
+ switch (nWhich)
{
case RES_TXTATR_TOXMARK:
- lcl_InsertTOXMarkPortion(
- rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
- rePortionType = PORTION_TEXT;
+ {
+ Reference<XTextRange> xTmp = lcl_CreateTOXMarkPortion(
+ xParent, pUnoCrsr, *pAttr, true);
+ rPortionStack.top().first->push_back(xTmp);
+ }
break;
case RES_TXTATR_REFMARK:
- lcl_InsertRefMarkPortion(
- rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
- rePortionType = PORTION_TEXT;
+ {
+ Reference<XTextRange> xTmp = lcl_CreateRefMarkPortion(
+ xParent, pUnoCrsr, *pAttr, true);
+ rPortionStack.top().first->push_back(xTmp);
+ }
break;
case RES_TXTATR_CJK_RUBY:
//#i91534# GetEnd() == 0 mixes the order of ruby start/end
if( *pAttr->GetEnd() == *pAttr->GetStart())
{
- lcl_InsertRubyPortion(
- rPortionArr, pUnoCrsr, rParent, pAttr, sal_False);
+ lcl_InsertRubyPortion( *rPortionStack.top().first,
+ xParent, pUnoCrsr, *pAttr, sal_False);
}
- lcl_InsertRubyPortion(
- rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
- rePortionType = PORTION_TEXT;
+ lcl_InsertRubyPortion( *rPortionStack.top().first,
+ xParent, pUnoCrsr, *pAttr, sal_True);
+ break;
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ {
+ ASSERT(*pAttr->GetStart() != *pAttr->GetEnd(),
+ "empty meta?");
+ if ((i_nStartPos > 0) &&
+ (*pAttr->GetStart() < i_nStartPos))
+ {
+ // force skip pAttr and rest of attribute ends
+ // at nCurrentIndex
+ // because they are not contained in the meta pAttr
+ // and the meta pAttr itself is outside selection!
+ // (necessary for SwXMeta::createEnumeration)
+ if (*pAttr->GetStart() + 1 == i_nStartPos)
+ {
+ nEndIndex = pHints->GetEndCount() - 1;
+ }
+ break;
+ }
+ PortionList_t Top = rPortionStack.top();
+ if (Top.second != pAttr)
+ {
+ ASSERT(false, "ExportHints: stack error" );
+ }
+ else
+ {
+ TextRangeList_t *const pCurrentPortions(Top.first);
+ rPortionStack.pop();
+ SwXTextPortion * pPortion;
+ if (RES_TXTATR_META == nWhich)
+ {
+ SwXMeta * const pMeta =
+ new SwXMeta(pDoc, xParent,
+ pCurrentPortions,
+ static_cast<SwTxtMeta * const>(pAttr));
+ pPortion = new SwXTextPortion(
+ pUnoCrsr, xParent, PORTION_META);
+ pPortion->SetMeta(pMeta);
+ }
+ else
+ {
+ SwXMetaField * const pMeta =
+ new SwXMetaField(pDoc, xParent,
+ pCurrentPortions,
+ static_cast<SwTxtMeta * const>(pAttr));
+ pPortion = new SwXTextPortion(
+ pUnoCrsr, xParent, PORTION_FIELD);
+ pPortion->SetTextField(pMeta);
+ }
+ rPortionStack.top().first->push_back(pPortion);
+ }
+ }
break;
}
}
@@ -520,128 +726,126 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
while(nStartIndex < pHints->GetStartCount() &&
nCurrentIndex >= (nNextStart = (*pHints->GetStart(nStartIndex)->GetStart())))
{
- SwTxtAttr* pAttr = pHints->GetStart(nStartIndex);
+ const SwTxtAttr * const 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))
+ if (nNextStart == nCurrentIndex)
{
switch( nAttrWhich )
{
case RES_TXTATR_FIELD:
- if(!io_rbRightMoveForbidden)
+ if(!bRightMoveForbidden)
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
break;
- bAlreadyMoved = true;
- rePortionType = PORTION_FIELD;
+ SwXTextPortion* pPortion;
+ xRef = pPortion = new SwXTextPortion(
+ pUnoCrsr, xParent, PORTION_FIELD);
+ Reference<XTextField> xField =
+ CreateSwXTextField(*pDoc, pAttr->GetFld());
+ pPortion->SetTextField(xField);
}
break;
case RES_TXTATR_FLYCNT :
- if(!io_rbRightMoveForbidden)
+ if(!bRightMoveForbidden)
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
break; // Robust #i81708 content in covered cells
pUnoCrsr->Exchange();
- bAlreadyMoved = true;
- rePortionType = PORTION_FRAME;
+ xRef = new SwXTextPortion(
+ pUnoCrsr, xParent, PORTION_FRAME);
}
break;
case RES_TXTATR_FTN :
{
- if(!io_rbRightMoveForbidden)
+ if(!bRightMoveForbidden)
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
break;
SwXTextPortion* pPortion;
- xRef = pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_FOOTNOTE);
- Reference<XTextContent> xContent =
- Reference<XTextContent>(
- SwXFootnotes::GetObject(*pDoc, pAttr->SwTxtAttr::GetFtn()),
- UNO_QUERY);
+ xRef = pPortion = new SwXTextPortion(
+ pUnoCrsr, xParent, PORTION_FOOTNOTE);
+ Reference<XFootnote> xContent =
+ SwXFootnotes::GetObject(*pDoc, pAttr->GetFtn());
pPortion->SetFootnote(xContent);
- bAlreadyMoved = true;
- rePortionType = PORTION_TEXT;
}
}
break;
- case RES_TXTATR_SOFTHYPH :
- {
- SwXTextPortion* pPortion = 0;
- rPortionArr.Insert(
- new Reference< XTextRange >(
- pPortion = new SwXTextPortion(
- pUnoCrsr, rParent, PORTION_CONTROL_CHAR)),
- rPortionArr.Count());
- pPortion->SetControlChar(3);
- rePortionType = PORTION_TEXT;
- }
- break;
- case RES_TXTATR_HARDBLANK:
- {
- rePortionType = PORTION_CONTROL_CHAR;
- SwXTextPortion* pPortion = 0;
- 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
- rePortionType = PORTION_TEXT;
- }
- break;
case RES_TXTATR_TOXMARK:
- lcl_InsertTOXMarkPortion(
- rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
- rePortionType = PORTION_TEXT;
- break;
case RES_TXTATR_REFMARK:
-
- if(!io_rbRightMoveForbidden || pAttr->GetEnd())
+ {
+ bool bIsPoint = !(pAttr->GetEnd());
+ if (!bRightMoveForbidden || !bIsPoint)
{
- if(!pAttr->GetEnd())
+ if (bIsPoint)
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
- bAlreadyMoved = true;
}
- lcl_InsertRefMarkPortion(
- rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
- rePortionType = PORTION_TEXT;
- if(!pAttr->GetEnd())
+ Reference<XTextRange> xTmp =
+ (RES_TXTATR_REFMARK == nAttrWhich)
+ ? lcl_CreateRefMarkPortion(
+ xParent, pUnoCrsr, *pAttr, false)
+ : lcl_CreateTOXMarkPortion(
+ xParent, pUnoCrsr, *pAttr, false);
+ if (bIsPoint) // consume CH_TXTATR!
{
- if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark())
- pUnoCrsr->Exchange();
+ pUnoCrsr->Normalize(FALSE);
pUnoCrsr->DeleteMark();
+ xRef = xTmp;
+ }
+ else // just insert it
+ {
+ rPortionStack.top().first->push_back(xTmp);
}
}
+ }
break;
case RES_TXTATR_CJK_RUBY:
//#i91534# GetEnd() == 0 mixes the order of ruby start/end
if(pAttr->GetEnd() && (*pAttr->GetEnd() != *pAttr->GetStart()))
{
- lcl_InsertRubyPortion(
- rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
- rePortionType = PORTION_TEXT;
+ lcl_InsertRubyPortion( *rPortionStack.top().first,
+ xParent, pUnoCrsr, *pAttr, sal_False);
}
break;
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ if (*pAttr->GetStart() != *pAttr->GetEnd())
+ {
+ if (!bRightMoveForbidden)
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
+ o_rbCursorMoved = true;
+ // only if the end is included in selection!
+ if ((i_nEndPos < 0) ||
+ (*pAttr->GetEnd() <= i_nEndPos))
+ {
+ rPortionStack.push( ::std::make_pair(
+ new TextRangeList_t, pAttr ));
+ }
+ }
+ }
+ break;
+ case RES_TXTATR_AUTOFMT:
+ case RES_TXTATR_INETFMT:
+ case RES_TXTATR_CHARFMT:
+ case RES_TXTATR_UNKNOWN_CONTAINER:
+ break; // these are handled as properties of a "Text" portion
default:
- DBG_ERROR("was fuer ein Attribut?");
+ DBG_ERROR("unknown attribute");
+ break;
}
-
}
nStartIndex++;
}
- if (!bAlreadyMoved)
+ if (xRef.is()) // implies that we have moved the cursor
+ {
+ o_rbCursorMoved = true;
+ }
+ if (!o_rbCursorMoved)
{
// search for attribute changes behind the current cursor position
// break up at frames, bookmarks, redlines
@@ -666,17 +870,15 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
o_rNextAttrPosition = nNextPos;
}
}
- else
- {
- io_rbRightMoveForbidden = true;
- }
return xRef;
}
-void lcl_MoveCursor( SwUnoCrsr* pUnoCrsr,
+//-----------------------------------------------------------------------------
+void lcl_MoveCursor( SwUnoCrsr * const pUnoCrsr,
const xub_StrLen nCurrentIndex,
const sal_Int32 nNextFrameIndex, const sal_Int32 nNextPortionIndex,
- const sal_Int32 nNextAttrIndex, const sal_Int32 nEndPos )
+ const sal_Int32 nNextAttrIndex, const sal_Int32 nNextFieldMarkIndex,
+ const sal_Int32 nEndPos )
{
sal_Int32 nMovePos = pUnoCrsr->GetCntntNode()->Len();
@@ -700,26 +902,22 @@ void lcl_MoveCursor( SwUnoCrsr* pUnoCrsr,
nMovePos = nNextAttrIndex;
}
+ if ((nNextFieldMarkIndex >= 0) && (nNextFieldMarkIndex < nMovePos))
+ {
+ nMovePos = nNextFieldMarkIndex;
+ }
+
if (nMovePos > nCurrentIndex)
{
// pUnoCrsr->Right(nMovePos - nCurrentIndex);
pUnoCrsr->GetPoint()->nContent = static_cast<USHORT>(nMovePos);
}
- else if(nEndPos < 0 || nCurrentIndex < nEndPos)
- {
- // 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);
- }
}
//-----------------------------------------------------------------------------
-void lcl_FillRedlineArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXRedlinePortion_ImplList& rRedArr )
+static void
+lcl_FillRedlineArray(SwDoc const & rDoc, SwUnoCrsr const & rUnoCrsr,
+ SwXRedlinePortion_ImplList& rRedArr )
{
const SwRedlineTbl& rRedTbl = rDoc.GetRedlineTbl();
USHORT nRedTblCount = rRedTbl.Count();
@@ -736,18 +934,21 @@ void lcl_FillRedlineArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXRedlinePortion_Imp
const SwNodeIndex nRedNode = pRedStart->nNode;
if ( nOwnNode == nRedNode )
rRedArr.insert( SwXRedlinePortion_ImplSharedPtr (
- new SwXRedlinePortion_Impl ( pRedline, TRUE) ) );
+ new SwXRedlinePortion_Impl ( pRedline, true ) ) );
if( pRedline->HasMark() && pRedline->End()->nNode == nOwnNode )
rRedArr.insert( SwXRedlinePortion_ImplSharedPtr (
- new SwXRedlinePortion_Impl ( pRedline, FALSE) ) );
+ new SwXRedlinePortion_Impl ( pRedline, false) ) );
}
}
}
//-----------------------------------------------------------------------------
-void lcl_FillSoftPageBreakArray( SwUnoCrsr& rUnoCrsr, SwSoftPageBreakList& rBreakArr )
+static void
+lcl_FillSoftPageBreakArray(
+ SwUnoCrsr const & rUnoCrsr, SwSoftPageBreakList& rBreakArr )
{
- const SwTxtNode *pTxtNode = rUnoCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
+ const SwTxtNode *pTxtNode =
+ rUnoCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
if( pTxtNode )
pTxtNode->fillSoftPageBreakList( rBreakArr );
}
@@ -755,9 +956,12 @@ void lcl_FillSoftPageBreakArray( SwUnoCrsr& rUnoCrsr, SwSoftPageBreakList& rBrea
/* -----------------------------19.12.00 12:25--------------------------------
---------------------------------------------------------------------------*/
-void lcl_ExportRedline(
- SwXRedlinePortion_ImplList& rRedlineArr, ULONG nIndex,
- SwUnoCrsr* pUnoCrsr, Reference<XText> & rParent, XTextRangeArr& rPortionArr)
+static void
+lcl_ExportRedline(
+ TextRangeList_t & rPortions,
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwXRedlinePortion_ImplList& rRedlineArr, const ULONG nIndex)
{
// MTG: 23/11/05: We want this loop to iterate over all red lines in this
@@ -773,10 +977,8 @@ void lcl_ExportRedline(
// MTG: 23/11/05: If the elements match, and them to the list
else if ( nIndex == nRealIndex )
{
- rPortionArr.Insert(
- new Reference< XTextRange >( new SwXRedlinePortion(
- pPtr->pRedline, pUnoCrsr, rParent, pPtr->bStart)),
- rPortionArr.Count());
+ rPortions.push_back( new SwXRedlinePortion(
+ pPtr->m_pRedline, pUnoCrsr, xParent, pPtr->m_bStart) );
rRedlineArr.erase ( aIter++ );
}
// MTG: 23/11/05: If we've iterated past nIndex, exit the loop
@@ -784,29 +986,63 @@ void lcl_ExportRedline(
break;
}
}
+
/* -----------------------------19.12.00 13:09--------------------------------
---------------------------------------------------------------------------*/
-void lcl_ExportBkmAndRedline(
+static void
+lcl_ExportBkmAndRedline(
+ TextRangeList_t & rPortions,
+ Reference<XText> const & xParent,
+ const SwUnoCrsr * const pUnoCrsr,
SwXBookmarkPortion_ImplList& rBkmArr,
SwXRedlinePortion_ImplList& rRedlineArr,
SwSoftPageBreakList& rBreakArr,
- ULONG nIndex,
- SwUnoCrsr* pUnoCrsr, Reference<XText> & rParent, XTextRangeArr& rPortionArr)
+ const ULONG nIndex)
{
if (rBkmArr.size())
- lcl_ExportBookmark(rBkmArr, nIndex, pUnoCrsr, rParent, rPortionArr);
+ lcl_ExportBookmark(rPortions, xParent, pUnoCrsr, rBkmArr, nIndex);
if (rRedlineArr.size())
- lcl_ExportRedline(rRedlineArr, nIndex, pUnoCrsr, rParent, rPortionArr);
+ lcl_ExportRedline(rPortions, xParent, pUnoCrsr, rRedlineArr, nIndex);
if (rBreakArr.size())
- lcl_ExportSoftPageBreak(rBreakArr, nIndex, pUnoCrsr, rParent, rPortionArr);
+ lcl_ExportSoftPageBreak(rPortions, xParent, pUnoCrsr, rBreakArr, nIndex);
}
+
//-----------------------------------------------------------------------------
-sal_Int32 lcl_GetNextIndex(SwXBookmarkPortion_ImplList& rBkmArr,
- SwXRedlinePortion_ImplList& rRedlineArr,
- SwSoftPageBreakList& rBreakArr )
+static sal_Int32
+lcl_ExportFrames(
+ TextRangeList_t & rPortions,
+ Reference<XText> const & i_xParent,
+ SwUnoCrsr * const i_pUnoCrsr,
+ FrameDependSortList_t & i_rFrames,
+ xub_StrLen const i_nCurrentIndex)
+{
+ // find first Frame in (sorted) i_rFrames at current position
+ while (i_rFrames.size() && (i_rFrames.front().nIndex == i_nCurrentIndex))
+ // do not check for i_nEnd here; this is done implicity by lcl_MoveCursor
+ {
+ const SwModify * const pFrame =
+ i_rFrames.front().pFrameDepend->GetRegisteredIn();
+ if (pFrame) // Frame could be disposed
+ {
+ SwXTextPortion* pPortion = new SwXTextPortion(i_pUnoCrsr, i_xParent,
+ *static_cast<SwFrmFmt*>( const_cast<SwModify*>( pFrame ) ) );
+ rPortions.push_back(pPortion);
+ }
+ i_rFrames.pop_front();
+ }
+
+ return i_rFrames.size() ? i_rFrames.front().nIndex : -1;
+}
+
+//-----------------------------------------------------------------------------
+static sal_Int32
+lcl_GetNextIndex(
+ SwXBookmarkPortion_ImplList const & rBkmArr,
+ SwXRedlinePortion_ImplList const & rRedlineArr,
+ SwSoftPageBreakList const & rBreakArr )
{
sal_Int32 nRet = -1;
if(rBkmArr.size())
@@ -828,284 +1064,146 @@ sal_Int32 lcl_GetNextIndex(SwXBookmarkPortion_ImplList& rBkmArr,
}
return nRet;
};
+
//-----------------------------------------------------------------------------
-void SwXTextPortionEnumeration::CreatePortions()
+static void
+lcl_CreatePortions(
+ TextRangeList_t & i_rPortions,
+ uno::Reference< text::XText > const & i_xParentText,
+ SwUnoCrsr * const pUnoCrsr,
+ FrameDependSortList_t & i_rFrames,
+ const sal_Int32 i_nStartPos,
+ const sal_Int32 i_nEndPos )
{
- SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if (!pUnoCrsr)
+ return;
+
// set the start if a selection should be exported
- if(nStartPos > 0 && pUnoCrsr->Start()->nContent.GetIndex() != nStartPos)
+ if ((i_nStartPos > 0) &&
+ (pUnoCrsr->Start()->nContent.GetIndex() != i_nStartPos))
{
- if(pUnoCrsr->HasMark())
- pUnoCrsr->DeleteMark();
+ pUnoCrsr->DeleteMark();
DBG_ASSERT(pUnoCrsr->Start()->nNode.GetNode().GetTxtNode() &&
- nStartPos <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->GetTxt().Len(),
- "Incorrect start position" );
- // ??? should this be nStartPos - current position ?
- pUnoCrsr->Right((xub_StrLen)nStartPos,CRSR_SKIP_CHARS,FALSE,FALSE);
+ (i_nStartPos <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->
+ GetTxt().Len()), "Incorrect start position" );
+ // ??? should this be i_nStartPos - current position ?
+ pUnoCrsr->Right(static_cast<xub_StrLen>(i_nStartPos),
+ CRSR_SKIP_CHARS, FALSE, FALSE);
}
- if(pUnoCrsr /*&& !bAtEnd*/)
+
+ FieldMarks_t FieldMarks;
+ SwXBookmarkPortion_ImplList Bookmarks;
+ SwXRedlinePortion_ImplList Redlines;
+ SwSoftPageBreakList SoftPageBreaks;
+
+ SwDoc * const pDoc = pUnoCrsr->GetDoc();
+ lcl_FillFieldMarkArray(FieldMarks, *pUnoCrsr, i_nStartPos);
+ lcl_FillBookmarkArray(*pDoc, *pUnoCrsr, Bookmarks);
+ lcl_FillRedlineArray(*pDoc, *pUnoCrsr, Redlines);
+ lcl_FillSoftPageBreakArray(*pUnoCrsr, SoftPageBreaks);
+
+ PortionStack_t PortionStack;
+ PortionStack.push( PortionList_t(&i_rPortions, 0) );
+
+ bool bAtEnd( false );
+ while (!bAtEnd) // every iteration consumes at least current character!
{
- SwXBookmarkPortion_ImplList aBkmArr;
- SwXRedlinePortion_ImplList aRedArr;
- SwSoftPageBreakList aBreakArr;
-
- SwDoc* pDoc = pUnoCrsr->GetDoc();
- lcl_FillRedlineArray(*pDoc, *pUnoCrsr, aRedArr);
- lcl_FillBookmarkArray(*pDoc, *pUnoCrsr, aBkmArr );
- lcl_FillSoftPageBreakArray( *pUnoCrsr, aBreakArr );
-#if OSL_DEBUG_LEVEL > 1
- for (SwXBookmarkPortion_ImplList::const_iterator aIter = aBkmArr.begin(), aEnd = aBkmArr.end();
- aIter != aEnd;
- ++aIter )
+ if (pUnoCrsr->HasMark())
{
- SwXBookmarkPortion_ImplSharedPtr pPtr = (*aIter);
+ pUnoCrsr->Normalize(FALSE);
+ pUnoCrsr->DeleteMark();
}
-#endif
- while(!bAtEnd)
+ SwTxtNode * const pTxtNode = pUnoCrsr->GetNode()->GetTxtNode();
+ if (!pTxtNode)
{
- if(pUnoCrsr->HasMark())
+ DBG_ERROR("lcl_CreatePortions: no TextNode - what now ?");
+ return;
+ }
+
+ SwpHints * const pHints = pTxtNode->GetpSwpHints();
+ const xub_StrLen nCurrentIndex =
+ pUnoCrsr->GetPoint()->nContent.GetIndex();
+ // this contains the portion which consumes the character in the
+ // text at nCurrentIndex; i.e. it must be set _once_ per iteration
+ uno::Reference< XTextRange > xRef;
+
+ SwXTextCursor::SelectPam(*pUnoCrsr, sal_True); // set mark
+
+ const sal_Int32 nFirstFrameIndex =
+ lcl_ExportFrames( *PortionStack.top().first,
+ i_xParentText, pUnoCrsr, i_rFrames, nCurrentIndex);
+
+ lcl_ExportBkmAndRedline( *PortionStack.top().first, i_xParentText,
+ pUnoCrsr, Bookmarks, Redlines, SoftPageBreaks, nCurrentIndex );
+
+ bool bCursorMoved( false );
+ sal_Int32 nNextAttrIndex = -1;
+ // #111716# the cursor must not move right at the
+ // end position of a selection!
+ bAtEnd = ((i_nEndPos >= 0) && (nCurrentIndex >= i_nEndPos))
+ || (nCurrentIndex >= pTxtNode->Len());
+ if (pHints)
+ {
+ // N.B.: side-effects nNextAttrIndex, bCursorMoved; may move cursor
+ xRef = lcl_ExportHints(PortionStack, i_xParentText, pUnoCrsr,
+ pHints, i_nStartPos, i_nEndPos, nCurrentIndex, bAtEnd,
+ bCursorMoved, nNextAttrIndex);
+ if (PortionStack.empty())
{
- if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark())
- pUnoCrsr->Exchange();
- pUnoCrsr->DeleteMark();
+ ASSERT(false, "CreatePortions: stack underflow");
+ return;
}
- SwNode* pNode = pUnoCrsr->GetNode();
- SwCntntNode *pCNd = pNode->GetCntntNode();
- if(!bFirstPortion && pCNd &&
- pUnoCrsr->GetPoint()->nContent == pCNd->Len())
+ }
+
+ if (!xRef.is() && !bCursorMoved)
+ {
+ if (!bAtEnd &&
+ FieldMarks.size() && (FieldMarks.front() == nCurrentIndex))
{
- //hier sollte man nie ankommen!
- bAtEnd = sal_True;
+ // moves cursor
+ xRef = lcl_ExportFieldMark(i_xParentText, pUnoCrsr, pTxtNode);
+ FieldMarks.pop_front();
}
- 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, aBreakArr, 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);
- }
- }
+ }
+ else
+ {
+ ASSERT(!FieldMarks.size() ||
+ (FieldMarks.front() != nCurrentIndex),
+ "fieldmark and hint with CH_TXTATR at same pos?");
+ }
- //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;
- }
+ if (!bAtEnd && !xRef.is() && !bCursorMoved)
+ {
+ const sal_Int32 nNextPortionIndex =
+ lcl_GetNextIndex(Bookmarks, Redlines, SoftPageBreaks);
+ const sal_Int32 nNextFieldMarkIndex(
+ FieldMarks.size() ? FieldMarks.front() : -1);
- SwXTextCursor::SelectPam(*pUnoCrsr, sal_True);
+ lcl_MoveCursor(pUnoCrsr, nCurrentIndex,
+ nFirstFrameIndex, nNextPortionIndex, nNextAttrIndex,
+ nNextFieldMarkIndex,
+ i_nEndPos);
- //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, aBreakArr,
- nCurrentIndex, pUnoCrsr, xParent, aPortionArr);
- sal_Int32 nNextAttrIndex = -1;
- sal_Int32 nNextPortionIndex =
- lcl_GetNextIndex(aBkmArr, aRedArr, aBreakArr);
- // #111716# the cursor must not move right at the
- // end position of a selection!
- bool bRightMoveForbidden =
- ((nEndPos > 0) && (nCurrentIndex >= nEndPos));
- if (pHints)
- {
- // N.B.: side-effects bRightMoveForbidden
- // and nNextAttrIndex
- xRef = lcl_ExportHints(pHints, aPortionArr,
- pUnoCrsr, xParent, nCurrentIndex, ePortionType,
- bRightMoveForbidden, nNextAttrIndex);
- }
- if (!bRightMoveForbidden)
- {
- lcl_MoveCursor(pUnoCrsr, nCurrentIndex,
- nFirstFrameIndex, nNextPortionIndex,
- nNextAttrIndex, nEndPos);
- }
- }
- if(!xRef.is() && pUnoCrsr->HasMark() ) {
- //flr: maybe its a good idea to add a special hint to the hints array and rely on the hint segmentation....
- xub_StrLen start=pUnoCrsr->Start()->nContent.GetIndex();
- xub_StrLen end=pUnoCrsr->End()->nContent.GetIndex();
- ASSERT(start<=end, "hmm --- why is this different");
- xub_StrLen startMarkerPos=pTxtNode->GetTxt().Search(CH_TXT_ATR_FIELDSTART, start);
- xub_StrLen endMarkerPos=pTxtNode->GetTxt().Search(CH_TXT_ATR_FIELDEND, start);
- xub_StrLen formMarkerPos=pTxtNode->GetTxt().Search(CH_TXT_ATR_FORMELEMENT, start);
- xub_StrLen markerPos=STRING_LEN;
- if (startMarkerPos>=start && startMarkerPos<end)
- {
- markerPos=startMarkerPos;
- }
- if (endMarkerPos>=start && endMarkerPos<end)
- {
- if (endMarkerPos<markerPos)
- markerPos=endMarkerPos;
- }
- if (formMarkerPos>=start && formMarkerPos<end)
- {
- if (formMarkerPos<markerPos)
- markerPos=formMarkerPos;
- }
- if (markerPos<end)
- {
- if (start==markerPos)
- end = markerPos+1;
- else
- end = markerPos;
- bAtEnd = sal_False;
- pUnoCrsr->GetPoint()->nContent = end;
- }
- if (start+1==end && pTxtNode->GetTxt().GetChar(start)==CH_TXT_ATR_FIELDSTART)
- {
- ::sw::mark::IFieldmark* pFieldmark = NULL;
- if (pDoc && pUnoCrsr->GetPoint())
- pFieldmark = pDoc->getIDocumentMarkAccess()->getFieldmarkFor(*pUnoCrsr->GetPoint());
- SwXTextPortion* pPortion = NULL;
- xRef = (pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_FIELD_START));
- if (pPortion && pFieldmark && pDoc)
- pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
- }
- else if (start+1==end && pTxtNode->GetTxt().GetChar(start)==CH_TXT_ATR_FIELDEND)
- {
- ::sw::mark::IFieldmark* pFieldmark = NULL;
- if (pDoc && pUnoCrsr->GetPoint())
- {
- SwPosition aPos(*pUnoCrsr->GetPoint());
- aPos.nContent = markerPos;
- pFieldmark = pDoc->getIDocumentMarkAccess()->getFieldmarkFor(aPos);
- }
- SwXTextPortion* pPortion = NULL;
- xRef = (pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_FIELD_END));
- if (pPortion && pFieldmark && pDoc)
- pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
- }
- else if (start+1==end && pTxtNode->GetTxt().GetChar(start)==CH_TXT_ATR_FORMELEMENT)
- {
- ::sw::mark::IFieldmark* pFieldmark = NULL;
- if (pDoc && pUnoCrsr->GetPoint())
- {
- SwPosition aPos(*pUnoCrsr->GetPoint());
- aPos.nContent=markerPos;
- pFieldmark = pDoc->getIDocumentMarkAccess()->getFieldmarkFor(aPos);
- }
- SwXTextPortion* pPortion=NULL;
- xRef = (pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_FIELD_START_END));
- if(pPortion && pFieldmark && pDoc)
- pPortion->SetBookmark(new SwXFieldmark(true, pFieldmark, pDoc));
- }
- else
- {
- 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, aBreakArr, nLocalEnd,
- pUnoCrsr, xParent, aPortionArr);
- if(ND_TEXTNODE == pNode->GetNodeType())
- {
- SwTxtNode* pTxtNode = (SwTxtNode*)pNode;
- SwpHints* pHints = pTxtNode->GetpSwpHints();
- if(pHints)
- {
- SwTextPortionType ePortionType = PORTION_TEXT;
- bool bDummy = false;
- sal_Int32 nDummy = -1;
- Reference<XTextRange> xRef = lcl_ExportHints(pHints,
- aPortionArr,
- pUnoCrsr,
- xParent,
- static_cast< xub_StrLen >(nLocalEnd),
- ePortionType,
- bDummy, nDummy);
- 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);
- }
+ xRef = new SwXTextPortion(pUnoCrsr, i_xParentText, PORTION_TEXT);
+ }
+ else if (bAtEnd && !xRef.is() && !pTxtNode->Len())
+ {
+ // special case: for an empty paragraph, we better put out a
+ // text portion because there may be a hyperlink attribute
+ xRef = new SwXTextPortion(pUnoCrsr, i_xParentText, PORTION_TEXT);
+ }
- }
+ if (xRef.is())
+ {
+ PortionStack.top().first->push_back(xRef);
}
}
+
+ ASSERT((PortionStack.size() == 1) && !PortionStack.top().second,
+ "CreatePortions: stack error" );
}
+
/*-- 27.01.99 10:44:45---------------------------------------------------
-----------------------------------------------------------------------*/
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index 7b58a4120de7..edd0721d5b63 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -779,7 +779,8 @@ const SwPropNameTab aPropNameTab = {
/* 0734 CHAR_OVERLINE_COLOR */ {MAP_CHAR_LEN("CharOverlineColor")},
/* 0735 CHAR_OVERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharOverlineHasColor")},
/* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
-/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")}
+/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
+/* 0738 UNO_NAME_META */ {MAP_CHAR_LEN("InContentMetadata")},
};
const SwPropNameLen& SwGetPropName( USHORT nId )
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index b04b8f0fdeaf..b04a7fea1fae 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -295,7 +295,7 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
{
if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
{
- SwUnoCrsr* pUnoCrsr = GetCrsr();
+ SwUnoCrsr* pUnoCrsr = GetCursor();
uno::Reference<text::XText> xRet = new SwXRedlineText(pUnoCrsr->GetDoc(), *pNodeIdx);
aRet <<= xRet;
}
@@ -318,7 +318,7 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
---------------------------------------------------------------------------*/
void SwXRedlinePortion::Validate() throw( uno::RuntimeException )
{
- SwUnoCrsr* pUnoCrsr = GetCrsr();
+ SwUnoCrsr* pUnoCrsr = GetCursor();
if(!pUnoCrsr)
throw uno::RuntimeException();
//search for the redline
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index f0cbd754e02a..6fc3873db49c 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -124,7 +124,7 @@ SwXReferenceMark::~SwXReferenceMark()
/* -----------------03.11.99 14:14-------------------
--------------------------------------------------*/
-void SwXReferenceMark::InsertRefMark( SwPaM& rPam )
+void SwXReferenceMark::InsertRefMark(SwPaM& rPam, SwXTextCursor * pCursor)
{
//! in some cases when this function is called the pDoc pointer member may have become
//! invalid/deleted thus we obtain the document pointer from rPaM where it should always
@@ -134,10 +134,19 @@ void SwXReferenceMark::InsertRefMark( SwPaM& rPam )
UnoActionContext aCont(pDoc2);
SwTxtAttr* pTxtAttr = 0;
SwFmtRefMark aRefMark(sMarkName);
- SfxItemSet aSet(pDoc2->GetAttrPool(), RES_TXTATR_REFMARK, RES_TXTATR_REFMARK, 0L);
- aSet.Put(aRefMark);
+// SfxItemSet aSet(pDoc2->GetAttrPool(), RES_TXTATR_REFMARK, RES_TXTATR_REFMARK, 0L);
+// aSet.Put(aRefMark);
sal_Bool bMark = *rPam.GetPoint() != *rPam.GetMark();
- SwXTextCursor::SetCrsrAttr(rPam, aSet, 0);
+// SwXTextCursor::SetCrsrAttr(rPam, aSet, 0);
+
+ const bool bForceExpandHints( (!bMark && pCursor)
+ ? pCursor->IsAtEndOfMeta() : false );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? ( nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ | nsSetAttrMode::SETATTR_DONTEXPAND)
+ : nsSetAttrMode::SETATTR_DONTEXPAND;
+
+ pDoc2->InsertPoolItem( rPam, aRefMark, nInsertFlags );
if( bMark && *rPam.GetPoint() > *rPam.GetMark())
rPam.Exchange();
@@ -146,8 +155,10 @@ void SwXReferenceMark::InsertRefMark( SwPaM& rPam )
pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttr(
rPam.GetPoint()->nContent, RES_TXTATR_REFMARK );
else
- pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ {
+ pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
rPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_REFMARK );
+ }
if(pTxtAttr)
pMark = &pTxtAttr->GetRefMark();
@@ -179,7 +190,7 @@ void SwXReferenceMark::attachToRange(const uno::Reference< text::XTextRange > &
SwUnoInternalPaM aPam(*pDocument);
//das muss jetzt sal_True liefern
SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
- InsertRefMark(aPam);
+ InsertRefMark(aPam, dynamic_cast<SwXTextCursor*>(pCursor));
m_bIsDescriptor = sal_False;
pDoc = pDocument;
pDoc->GetUnoCallBack()->Add(this);
@@ -318,7 +329,7 @@ void SwXReferenceMark::setName(const OUString& Name_) throw( uno::RuntimeExcepti
sMarkName = sNewName;
//create a new one
- InsertRefMark( aPam );
+ InsertRefMark( aPam, 0 );
pDoc = aPam.GetDoc();
}
}
@@ -424,3 +435,1056 @@ void SwXReferenceMark::removeVetoableChangeListener(
{
}
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <unometa.hxx>
+#include <unoport.hxx>
+#include <txtatr.hxx>
+#include <fmtmeta.hxx>
+#include <docsh.hxx>
+
+//=============================================================================
+
+/******************************************************************
+ * SwXMetaText
+ ******************************************************************/
+
+class SwXMetaText
+ : public SwXText
+{
+private:
+ SwXMeta & m_rMeta;
+
+ virtual void PrepareForAttach(uno::Reference< text::XTextRange > & xRange,
+ const SwXTextRange* const pRange, const SwPaM * const pPam);
+
+ virtual bool CheckForOwnMemberMeta(const SwXTextRange* const pRange,
+ const SwPaM* const pPam, bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual const SwStartNode *GetStartNode() const;
+ virtual uno::Reference< text::XTextCursor >
+ createCursor() throw (uno::RuntimeException);
+
+public:
+ SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta);
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw()
+ { OSL_ENSURE(false, "ERROR: SwXMetaText::acquire"); }
+ virtual void SAL_CALL release() throw()
+ { OSL_ENSURE(false, "ERROR: SwXMetaText::release"); }
+
+ // XTypeProvider
+ virtual uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() throw (uno::RuntimeException);
+
+ // XText
+ virtual uno::Reference< text::XTextCursor > SAL_CALL
+ createTextCursor() throw (uno::RuntimeException);
+ virtual uno::Reference< text::XTextCursor > SAL_CALL
+ createTextCursorByRange(
+ const uno::Reference< text::XTextRange > & xTextPosition)
+ throw (uno::RuntimeException);
+
+};
+
+SwXMetaText::SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta)
+ : SwXText(&rDoc, CURSOR_META)
+ , m_rMeta(rMeta)
+{
+}
+
+const SwStartNode *SwXMetaText::GetStartNode() const
+{
+ SwXText const * const pParent(
+ dynamic_cast<SwXText*>(m_rMeta.GetParentText().get()));
+ return (pParent) ? pParent->GetStartNode() : 0;
+}
+
+void SwXMetaText::PrepareForAttach( uno::Reference<text::XTextRange> & xRange,
+ const SwXTextRange* const pRange, const SwPaM * const pPam)
+{
+ SwPosition const* pPoint(0);
+ SwPosition const* pMark (0);
+ if (pRange)
+ {
+ ::sw::mark::IMark const& rIMark(*pRange->GetBookmark());
+ pMark = &rIMark.GetMarkPos();
+ if (rIMark.IsExpanded())
+ {
+ pMark = &rIMark.GetOtherMarkPos();
+ }
+ }
+ else if (pPam)
+ {
+ pPoint = pPam->GetPoint();
+ if (pPam->HasMark())
+ {
+ pMark = pPam->GetMark();
+ }
+ }
+ // create a new cursor to prevent modifying SwXTextRange
+ if (pPoint)
+ {
+ xRange = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(&m_rMeta, *pPoint, CURSOR_META, GetDoc(), pMark));
+ }
+}
+
+bool SwXMetaText::CheckForOwnMemberMeta(const SwXTextRange* const pRange,
+ const SwPaM* const pPam, bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ return m_rMeta.CheckForOwnMemberMeta(pRange, pPam, bAbsorb);
+}
+
+uno::Reference< text::XTextCursor > SwXMetaText::createCursor()
+throw (uno::RuntimeException)
+{
+ uno::Reference< text::XTextCursor > xRet;
+ if (IsValid())
+ {
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess(
+ m_rMeta.SetContentRange(pTxtNode, nMetaStart, nMetaEnd) );
+ if (bSuccess)
+ {
+ SwPosition aPos(*pTxtNode, nMetaStart);
+ xRet = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(&m_rMeta, aPos, CURSOR_META, GetDoc()));
+ }
+ }
+ return xRet;
+}
+
+uno::Sequence<sal_Int8> SAL_CALL
+SwXMetaText::getImplementationId() throw (uno::RuntimeException)
+{
+ return m_rMeta.getImplementationId();
+}
+
+// XText
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXMetaText::createTextCursor() throw (uno::RuntimeException)
+{
+ return createCursor();
+}
+
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXMetaText::createTextCursorByRange(
+ const uno::Reference<text::XTextRange> & xTextPosition)
+ throw (uno::RuntimeException)
+{
+ const uno::Reference<text::XTextCursor> xCursor( createCursor() );
+ xCursor->gotoRange(xTextPosition, sal_False);
+ return xCursor;
+}
+
+/******************************************************************
+ * SwXMeta
+ ******************************************************************/
+
+// the Meta has a cached list of text portions for its contents
+// this list is created by SwXTextPortionEnumeration
+// the Meta listens at the SwTxtNode and throws away the cache when it changes
+
+struct SwXMeta::Impl
+{
+ SwEventListenerContainer m_ListenerContainer;
+ ::std::auto_ptr<const TextRangeList_t> m_pTextPortions;
+ // 3 possible states: not attached, attached, disposed
+ bool m_bIsDisposed;
+ bool m_bIsDescriptor;
+ uno::Reference<text::XText> m_xParentText;
+ SwXMetaText m_Text;
+
+ Impl(SwXMeta & rThis, SwDoc & rDoc,
+ uno::Reference<text::XText> const& xParentText,
+ TextRangeList_t const * const pPortions,
+ SwTxtMeta const * const pHint)
+ : m_ListenerContainer(
+ static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_pTextPortions( pPortions )
+ , m_bIsDisposed( false )
+ , m_bIsDescriptor( 0 == pHint )
+ , m_xParentText(xParentText)
+ , m_Text(rDoc, rThis)
+ {
+ }
+};
+
+TYPEINIT1(SwXMeta, SwClient);
+
+inline const ::sw::Meta * SwXMeta::GetMeta() const
+{
+ return static_cast< const ::sw::Meta * >(GetRegisteredIn());
+}
+
+uno::Reference<text::XText> SwXMeta::GetParentText() const
+{
+ return m_pImpl->m_xParentText;
+}
+
+bool SwXMeta::SetContentRange(
+ SwTxtNode *& rpNode, xub_StrLen & rStart, xub_StrLen & rEnd ) const
+{
+ ::sw::Meta const * const pMeta( GetMeta() );
+ if (pMeta)
+ {
+ SwTxtMeta const * const pTxtAttr( pMeta->GetTxtAttr() );
+ if (pTxtAttr)
+ {
+ rpNode = pTxtAttr->GetTxtNode();
+ if (rpNode)
+ {
+ // rStart points at the first position _within_ the meta!
+ rStart = *pTxtAttr->GetStart() + 1;
+ rEnd = *pTxtAttr->GetEnd();
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+SwXMeta::SwXMeta(SwDoc *const pDoc,
+ uno::Reference<text::XText> const& xParentText,
+ TextRangeList_t * const pPortions, SwTxtMeta * const pHint)
+ : m_pImpl( new SwXMeta::Impl(*this, *pDoc, xParentText, pPortions, pHint) )
+{
+ if (pHint)
+ {
+ ::sw::Meta * const pMeta(
+ static_cast<SwFmtMeta&>(pHint->GetAttr()).GetMeta() );
+ ASSERT(pMeta, "SwXMeta: no meta?")
+ if (pMeta)
+ {
+ pMeta->Add(this);
+ }
+ }
+}
+
+bool SwXMeta::CheckForOwnMemberMeta(const SwXTextRange* const pRange,
+ const SwPaM* const pPam, bool bAbsorb)
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ ASSERT((pPam && !pRange) || (!pPam && pRange), "ERROR: pam xor range");
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess( SetContentRange(pTxtNode, nMetaStart, nMetaEnd) );
+ ASSERT(bSuccess, "no pam?");
+ if (!bSuccess)
+ throw lang::DisposedException();
+ SwPosition const * const pStartPos( (pPam)
+ ? pPam->Start()
+ : &pRange->GetBookmark()->GetMarkStart() );
+ if (&pStartPos->nNode.GetNode() != pTxtNode)
+ {
+ throw lang::IllegalArgumentException(
+ C2U("trying to insert into a nesting text content, but start "
+ "of text range not in same paragraph as text content"),
+ 0, 0);
+ }
+ bool bForceExpandHints(false);
+ const xub_StrLen nStartPos(pStartPos->nContent.GetIndex());
+ // not <= but < because nMetaStart is behind dummy char!
+ // not >= but > because == means insert at end!
+ if ((nStartPos < nMetaStart) || (nStartPos > nMetaEnd))
+ {
+ throw lang::IllegalArgumentException(
+ C2U("trying to insert into a nesting text content, but start "
+ "of text range not inside text content"),
+ 0, 0);
+ }
+ else if (nStartPos == nMetaEnd)
+ {
+ bForceExpandHints = true;
+ }
+ const bool bHasEnd( (pPam)
+ ? pPam->HasMark()
+ : pRange->GetBookmark()->IsExpanded());
+ if (bHasEnd && bAbsorb)
+ {
+ SwPosition const * const pEndPos( (pPam)
+ ? pPam->End()
+ : &pRange->GetBookmark()->GetMarkEnd() );
+ if (&pEndPos->nNode.GetNode() != pTxtNode)
+ {
+ throw lang::IllegalArgumentException(
+ C2U("trying to insert into a nesting text content, but end "
+ "of text range not in same paragraph as text content"),
+ 0, 0);
+ }
+ const xub_StrLen nEndPos(pEndPos->nContent.GetIndex());
+ // not <= but < because nMetaStart is behind dummy char!
+ // not >= but > because == means insert at end!
+ if ((nEndPos < nMetaStart) || (nEndPos > nMetaEnd))
+ {
+ throw lang::IllegalArgumentException(
+ C2U("trying to insert into a nesting text content, but end "
+ "of text range not inside text content"),
+ 0, 0);
+ }
+ else if (nEndPos == nMetaEnd)
+ {
+ bForceExpandHints = true;
+ }
+ }
+ return bForceExpandHints;
+}
+
+
+SwXMeta::SwXMeta(SwDoc *const pDoc)
+ : m_pImpl( new SwXMeta::Impl(*this, *pDoc, 0, 0, 0) )
+{
+}
+
+SwXMeta::~SwXMeta()
+{
+}
+
+const uno::Sequence< sal_Int8 > & SwXMeta::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq( ::CreateUnoTunnelId() );
+ return aSeq;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL
+SwXMeta::getSomething( const uno::Sequence< sal_Int8 > & i_rId )
+throw (uno::RuntimeException)
+{
+ if ( i_rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ i_rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >(
+ reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL
+SwXMeta::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXMeta");
+}
+
+sal_Bool SAL_CALL
+SwXMeta::supportsService(const ::rtl::OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return rServiceName.equalsAscii("com.sun.star.text.TextContent")
+ || rServiceName.equalsAscii("com.sun.star.text.InContentMetadata");
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL
+SwXMeta::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(2);
+ aRet[0] = C2U("com.sun.star.text.TextContent");
+ aRet[1] = C2U("com.sun.star.text.InContentMetadata");
+ return aRet;
+}
+
+
+// XComponent
+void SAL_CALL
+SwXMeta::addEventListener(
+ uno::Reference< lang::XEventListener> const & xListener )
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+ if (m_pImpl->m_bIsDisposed)
+ {
+ m_pImpl->m_ListenerContainer.Disposing();
+ }
+}
+
+void SAL_CALL
+SwXMeta::removeEventListener(
+ uno::Reference< lang::XEventListener> const & xListener )
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_bIsDisposed)
+ {
+ m_pImpl->m_ListenerContainer.RemoveListener(xListener);
+ }
+}
+
+void SAL_CALL
+SwXMeta::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pTextPortions.reset();
+ m_pImpl->m_ListenerContainer.Disposing();
+ m_pImpl->m_bIsDisposed = true;
+ m_pImpl->m_Text.Invalidate();
+ }
+ else if (!m_pImpl->m_bIsDisposed)
+ {
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd));
+ ASSERT(bSuccess, "no pam?");
+ if (bSuccess)
+ {
+ // -1 because of CH_TXTATR
+ SwPaM aPam( *pTxtNode, nMetaStart - 1, *pTxtNode, nMetaEnd );
+ SwDoc * const pDoc( pTxtNode->GetDoc() );
+ pDoc->DeleteAndJoin( aPam );
+
+ // removal should call Modify and do the dispose
+ OSL_ENSURE(m_pImpl->m_bIsDisposed, "zombie meta");
+ }
+ }
+}
+
+
+void SAL_CALL
+SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange,
+ const USHORT i_nWhich)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bIsDisposed)
+ {
+ throw lang::DisposedException();
+ }
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException(
+ C2S("SwXMeta::attach(): already attached"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel(i_xTextRange, uno::UNO_QUERY);
+ if (!xRangeTunnel.is())
+ {
+ throw lang::IllegalArgumentException(
+ C2S("SwXMeta::attach(): argument is no XUnoTunnel"),
+ static_cast< ::cppu::OWeakObject* >(this), 0);
+ }
+ SwXTextRange * const pRange(
+ reinterpret_cast< SwXTextRange * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId() ))) );
+ OTextCursorHelper * const pCursor( pRange ? 0 :
+ reinterpret_cast< OTextCursorHelper * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId() ))) );
+ if (!pRange && !pCursor)
+ {
+ throw lang::IllegalArgumentException(
+ C2S("SwXMeta::attach(): argument not supported type"),
+ static_cast< ::cppu::OWeakObject* >(this), 0);
+ }
+
+ SwDoc * const pDoc(
+ pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0 );
+ if (!pDoc)
+ {
+ throw lang::IllegalArgumentException(
+ C2S("SwXMeta::attach(): argument has no SwDoc"),
+ static_cast< ::cppu::OWeakObject* >(this), 0);
+ }
+
+ SwUnoInternalPaM aPam(*pDoc);
+ SwXTextRange::XTextRangeToSwPaM(aPam, i_xTextRange);
+
+ UnoActionContext aContext(pDoc);
+
+ SwXTextCursor const*const pTextCursor(
+ dynamic_cast<SwXTextCursor*>(pCursor));
+ const bool bForceExpandHints((pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta() : false);
+ const SetAttrMode nInsertFlags( (bForceExpandHints)
+ ? ( nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ | nsSetAttrMode::SETATTR_DONTEXPAND)
+ : nsSetAttrMode::SETATTR_DONTEXPAND );
+
+ const ::boost::shared_ptr< ::sw::Meta> pMeta( (RES_TXTATR_META == i_nWhich)
+ ? ::boost::shared_ptr< ::sw::Meta>( new ::sw::Meta() )
+ : ::boost::shared_ptr< ::sw::Meta>(
+ pDoc->GetMetaFieldManager().makeMetaField()) );
+ SwFmtMeta meta(pMeta, i_nWhich); // this is cloned by Insert!
+ const bool bSuccess( pDoc->InsertPoolItem( aPam, meta, nInsertFlags ) );
+ SwTxtAttr * const pTxtAttr( pMeta->GetTxtAttr() );
+ if (!bSuccess)
+ {
+ throw lang::IllegalArgumentException(
+ C2S("SwXMeta::attach(): cannot create meta: range invalid?"),
+ static_cast< ::cppu::OWeakObject* >(this), 1);
+ }
+ if (!pTxtAttr)
+ {
+ ASSERT(false, "meta inserted, but has no text attribute?");
+ throw uno::RuntimeException(
+ C2S("SwXMeta::attach(): cannot create meta"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ pMeta->Add(this);
+
+ m_pImpl->m_xParentText =
+ SwXTextRange::CreateParentXText(pDoc, *aPam.GetPoint());
+
+ m_pImpl->m_bIsDescriptor = false;
+}
+
+// XTextContent
+void SAL_CALL
+SwXMeta::attach(const uno::Reference< text::XTextRange > & i_xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ return SwXMeta::AttachImpl(i_xTextRange, RES_TXTATR_META);
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXMeta::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bIsDisposed)
+ {
+ throw lang::DisposedException();
+ }
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException(
+ C2S("SwXMeta::getAnchor(): not inserted"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd));
+ ASSERT(bSuccess, "no pam?");
+ if (!bSuccess)
+ {
+ throw lang::DisposedException(
+ C2S("SwXMeta::getAnchor(): not attached"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ const SwPosition start(*pTxtNode, nMetaStart - 1); // -1 due to CH_TXTATR
+ const SwPosition end(*pTxtNode, nMetaEnd);
+ return SwXTextRange::CreateTextRangeFromPosition(
+ pTxtNode->GetDoc(), start, &end);
+}
+
+// XTextRange
+uno::Reference< text::XText > SAL_CALL
+SwXMeta::getText() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ //TODO probably this should return outer meta in case there is nesting,
+ // but currently that is not done; would need to change at least
+ // SwXTextPortionEnumeration and SwXMeta::attach and other places where
+ // SwXMeta is constructed
+ return GetParentText();
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXMeta::getStart() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.getStart();
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXMeta::getEnd() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.getEnd();
+}
+
+rtl::OUString SAL_CALL
+SwXMeta::getString() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.getString();
+}
+
+void SAL_CALL
+SwXMeta::setString(const rtl::OUString& rString) throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.setString(rString);
+}
+
+// XSimpleText
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXMeta::createTextCursor() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.createTextCursor();
+}
+
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXMeta::createTextCursorByRange(
+ const uno::Reference<text::XTextRange> & xTextPosition)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.createTextCursorByRange(xTextPosition);
+}
+
+void SAL_CALL
+SwXMeta::insertString(const uno::Reference<text::XTextRange> & xRange,
+ const rtl::OUString& rString, sal_Bool bAbsorb)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.insertString(xRange, rString, bAbsorb);
+}
+
+void SAL_CALL
+SwXMeta::insertControlCharacter(const uno::Reference<text::XTextRange> & xRange,
+ sal_Int16 nControlCharacter, sal_Bool bAbsorb)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.insertControlCharacter(xRange, nControlCharacter,
+ bAbsorb);
+}
+
+// XText
+void SAL_CALL
+SwXMeta::insertTextContent( const uno::Reference<text::XTextRange> & xRange,
+ const uno::Reference<text::XTextContent> & xContent, sal_Bool bAbsorb)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.insertTextContent(xRange, xContent, bAbsorb);
+}
+
+void SAL_CALL
+SwXMeta::removeTextContent(
+ const uno::Reference< text::XTextContent > & xContent)
+ throw (container::NoSuchElementException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.removeTextContent(xContent);
+}
+
+// XElementAccess
+uno::Type SAL_CALL
+SwXMeta::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+
+sal_Bool SAL_CALL
+SwXMeta::hasElements() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ return GetRegisteredIn() ? sal_True : sal_False;
+}
+
+// XEnumerationAccess
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXMeta::createEnumeration() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bIsDisposed)
+ {
+ throw lang::DisposedException();
+ }
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException(
+ C2S("getAnchor(): not inserted"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd));
+ ASSERT(bSuccess, "no pam?");
+ if (!bSuccess)
+ throw lang::DisposedException();
+
+ SwPaM aPam(*pTxtNode, nMetaStart);
+
+ if (!m_pImpl->m_pTextPortions.get())
+ {
+ return new SwXTextPortionEnumeration(
+ aPam, GetParentText(), nMetaStart, nMetaEnd);
+ }
+ else // cached!
+ {
+ return new SwXTextPortionEnumeration(aPam, *m_pImpl->m_pTextPortions);
+ }
+}
+
+
+// MetadatableMixin
+::sfx2::Metadatable* SwXMeta::GetCoreObject()
+{
+ return const_cast< ::sw::Meta * >(GetMeta());
+}
+
+uno::Reference<frame::XModel> SwXMeta::GetModel()
+{
+ ::sw::Meta const * const pMeta( GetMeta() );
+ if (pMeta)
+ {
+ SwTxtNode const * const pTxtNode( pMeta->GetTxtNode() );
+ if (pTxtNode)
+ {
+ SwDocShell const * const pShell(pTxtNode->GetDoc()->GetDocShell());
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ }
+ return 0;
+}
+
+// SwModify
+void SwXMeta::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+{
+ m_pImpl->m_pTextPortions.reset(); // throw away cache (SwTxtNode changed)
+
+ ClientModify(this, pOld, pNew);
+
+ if (!GetRegisteredIn()) // removed => dispose
+ {
+ m_pImpl->m_ListenerContainer.Disposing();
+ m_pImpl->m_bIsDisposed = true;
+ m_pImpl->m_Text.Invalidate();
+ }
+}
+
+
+/******************************************************************
+ * SwXMetaField
+ ******************************************************************/
+
+inline const ::sw::MetaField * SwXMetaField::GetMetaField() const
+{
+ return static_cast< const ::sw::MetaField * >(GetRegisteredIn());
+}
+
+SwXMetaField::SwXMetaField(SwDoc *const pDoc,
+ uno::Reference<text::XText> const& xParentText,
+ TextRangeList_t * const pPortions, SwTxtMeta * const pHint)
+ : SwXMetaFieldBaseClass(pDoc, xParentText, pPortions, pHint)
+{
+ ASSERT(!pHint || RES_TXTATR_METAFIELD == pHint->Which(),
+ "SwXMetaField created for wrong hint!");
+}
+
+SwXMetaField::SwXMetaField(SwDoc *const pDoc)
+ : SwXMetaFieldBaseClass(pDoc)
+{
+}
+
+SwXMetaField::~SwXMetaField()
+{
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL
+SwXMetaField::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXMetaField");
+}
+
+sal_Bool SAL_CALL
+SwXMetaField::supportsService(const ::rtl::OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return rServiceName.equalsAscii("com.sun.star.text.TextContent")
+ || rServiceName.equalsAscii("com.sun.star.text.TextField")
+ || rServiceName.equalsAscii("com.sun.star.text.textfield.MetadataField");
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL
+SwXMetaField::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(3);
+ aRet[0] = C2U("com.sun.star.text.TextContent");
+ aRet[1] = C2U("com.sun.star.text.TextField");
+ aRet[2] = C2U("com.sun.star.text.textfield.MetadataField");
+ return aRet;
+}
+
+// XComponent
+void SAL_CALL
+SwXMetaField::addEventListener(
+ uno::Reference< lang::XEventListener> const & xListener )
+throw (uno::RuntimeException)
+{
+ return SwXMeta::addEventListener(xListener);
+}
+
+void SAL_CALL
+SwXMetaField::removeEventListener(
+ uno::Reference< lang::XEventListener> const & xListener )
+throw (uno::RuntimeException)
+{
+ return SwXMeta::removeEventListener(xListener);
+}
+
+void SAL_CALL
+SwXMetaField::dispose() throw (uno::RuntimeException)
+{
+ return SwXMeta::dispose();
+}
+
+// XTextContent
+void SAL_CALL
+SwXMetaField::attach(const uno::Reference< text::XTextRange > & i_xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ return SwXMeta::AttachImpl(i_xTextRange, RES_TXTATR_METAFIELD);
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXMetaField::getAnchor() throw (uno::RuntimeException)
+{
+ return SwXMeta::getAnchor();
+}
+
+// XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXMetaField::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xRef(
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_METAFIELD)
+ ->getPropertySetInfo() );
+ return xRef;
+}
+
+void SAL_CALL
+SwXMetaField::setPropertyValue(
+ const ::rtl::OUString& rPropertyName, const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ ::sw::MetaField * const pMeta(
+ const_cast< ::sw::MetaField * >(GetMetaField()) );
+ if (!pMeta)
+ throw lang::DisposedException();
+
+ if (rPropertyName.equalsAscii("NumberFormat"))
+ {
+ sal_Int32 nNumberFormat(0);
+ if (rValue >>= nNumberFormat)
+ {
+ pMeta->SetNumberFormat(static_cast<sal_uInt32>(nNumberFormat));
+ }
+ }
+ else if (rPropertyName.equalsAscii("IsFixedLanguage"))
+ {
+ bool b(false);
+ if (rValue >>= b)
+ {
+ pMeta->SetIsFixedLanguage(b);
+ }
+ }
+ else
+ {
+ throw beans::UnknownPropertyException();
+ }
+}
+
+uno::Any SAL_CALL
+SwXMetaField::getPropertyValue(const ::rtl::OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ ::sw::MetaField const * const pMeta( GetMetaField() );
+ if (!pMeta)
+ throw lang::DisposedException();
+
+ uno::Any any;
+
+ if (rPropertyName.equalsAscii("NumberFormat"))
+ {
+ const ::rtl::OUString text( getPresentation(sal_False) );
+ any <<= static_cast<sal_Int32>(pMeta->GetNumberFormat(text));
+ }
+ else if (rPropertyName.equalsAscii("IsFixedLanguage"))
+ {
+ any <<= pMeta->IsFixedLanguage();
+ }
+ else
+ {
+ throw beans::UnknownPropertyException();
+ }
+
+ return any;
+}
+
+void SAL_CALL
+SwXMetaField::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXMetaField::addPropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXMetaField::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXMetaField::removePropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXMetaField::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXMetaField::addVetoableChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXMetaField::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXMetaField::removeVetoableChangeListener(): not implemented");
+}
+
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/rdf/Statement.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/URIs.hpp>
+#include <com/sun/star/rdf/XLiteral.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include <comphelper/processfactory.hxx>
+
+static uno::Reference<rdf::XURI> const&
+lcl_getURI(const bool bPrefix)
+{
+ static uno::Reference< uno::XComponentContext > xContext(
+ ::comphelper::getProcessComponentContext());
+ static uno::Reference< rdf::XURI > xOdfPrefix(
+ rdf::URI::createKnown(xContext, rdf::URIs::ODF_PREFIX),
+ uno::UNO_SET_THROW);
+ static uno::Reference< rdf::XURI > xOdfSuffix(
+ rdf::URI::createKnown(xContext, rdf::URIs::ODF_SUFFIX),
+ uno::UNO_SET_THROW);
+ return (bPrefix) ? xOdfPrefix : xOdfSuffix;
+}
+
+static ::rtl::OUString
+lcl_getPrefixOrSuffix(
+ uno::Reference<rdf::XRepository> const & xRepository,
+ uno::Reference<rdf::XResource> const & xMetaField,
+ uno::Reference<rdf::XURI> const & xPredicate)
+{
+ const uno::Reference<container::XEnumeration> xEnum(
+ xRepository->getStatements(xMetaField, xPredicate, 0),
+ uno::UNO_SET_THROW);
+ while (xEnum->hasMoreElements()) {
+ rdf::Statement stmt;
+ if (!(xEnum->nextElement() >>= stmt)) {
+ throw uno::RuntimeException();
+ }
+ const uno::Reference<rdf::XLiteral> xObject(stmt.Object,
+ uno::UNO_QUERY);
+ if (!xObject.is()) continue;
+ if (xEnum->hasMoreElements()) {
+ OSL_TRACE("ignoring other odf:Prefix/odf:Suffix statements");
+ }
+ return xObject->getValue();
+ }
+ return ::rtl::OUString();
+}
+
+void
+getPrefixAndSuffix(
+ const uno::Reference<frame::XModel>& xModel,
+ const uno::Reference<rdf::XMetadatable>& xMetaField,
+ ::rtl::OUString *const o_pPrefix, ::rtl::OUString *const o_pSuffix)
+{
+ try {
+ const uno::Reference<rdf::XRepositorySupplier> xRS(
+ xModel, uno::UNO_QUERY_THROW);
+ const uno::Reference<rdf::XRepository> xRepo(
+ xRS->getRDFRepository(), uno::UNO_SET_THROW);
+ const uno::Reference<rdf::XResource> xMeta(
+ xMetaField, uno::UNO_QUERY_THROW);
+ if (o_pPrefix)
+ {
+ *o_pPrefix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(true));
+ }
+ if (o_pSuffix)
+ {
+ *o_pSuffix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(false));
+ }
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("getPrefixAndSuffix: exception"),
+ 0, uno::makeAny(e));
+ }
+}
+
+// XTextField
+::rtl::OUString SAL_CALL
+SwXMetaField::getPresentation(sal_Bool bShowCommand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (bShowCommand)
+ {
+//FIXME ?
+ return ::rtl::OUString();
+ }
+ else
+ {
+ // getString should check if this is invalid
+ const ::rtl::OUString content( this->getString() );
+ ::rtl::OUString prefix;
+ ::rtl::OUString suffix;
+ getPrefixAndSuffix(GetModel(), this, &prefix, &suffix);
+ return prefix + content + suffix;
+ }
+}
+
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 529f36294fca..1308c6ad7d3e 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -461,7 +461,7 @@ void SwXTextSection::attachToRange(const uno::Reference< text::XTextRange > & xT
if (pProps->aPassword.getLength() > 0)
aSect.SetPasswd(pProps->aPassword);
- pRet = pDoc->Insert( aPam, aSect, aSet.Count() ? &aSet : 0 );
+ pRet = pDoc->InsertSwSection( aPam, aSect, aSet.Count() ? &aSet : 0 );
// now create the client
m_refCount++;
// keep block to remove Reference before the refcount is decremented
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index c00c21f5494e..56e3cbacd822 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -45,6 +45,7 @@
#include <unoidx.hxx>
#include <unoframe.hxx>
#include <unofield.hxx>
+#include <unometa.hxx>
#include <unodraw.hxx>
#include <unoredline.hxx>
#include <unomap.hxx>
@@ -58,7 +59,6 @@
#include <swundo.hxx>
#include <section.hxx>
#include <IMark.hxx>
-#include <fmthbsh.hxx>
#include <fmtanchr.hxx>
#include <crsskip.hxx>
#include <ndtxt.hxx>
@@ -77,6 +77,21 @@ const sal_Char cInvalidObject[] = "this object is invalid";
-----------------------------------------------------------------------*/
+void SwXText::PrepareForAttach( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > &,
+ const SwXTextRange* const, const SwPaM * const)
+{
+}
+
+bool SwXText::CheckForOwnMemberMeta(const SwXTextRange* const,
+ const SwPaM* const, bool)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ASSERT(CURSOR_META != eCrsrType, "should not be called!");
+ return false;
+}
+
const SwStartNode *SwXText::GetStartNode() const
{
return GetDoc()->GetNodes().GetEndOfContent().StartOfSectionNode();
@@ -85,12 +100,12 @@ const SwStartNode *SwXText::GetStartNode() const
uno::Reference< text::XTextCursor > SwXText::createCursor() throw (uno::RuntimeException)
{
uno::Reference< text::XTextCursor > xRet;
- OUString sRet;
if(IsValid())
{
SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
SwPosition aPos(rNode);
- xRet = (text::XWordCursor*)new SwXTextCursor(this, aPos, GetTextType(), GetDoc());
+ xRet = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(this, aPos, GetTextType(), GetDoc()));
xRet->gotoStart(sal_False);
}
return xRet;
@@ -278,12 +293,41 @@ void SwXText::insertString(const uno::Reference< text::XTextRange >& xTextRange,
if(!pOwnStartNode || pOwnStartNode != pTmp)
throw uno::RuntimeException();
}
+ bool bForceExpandHints( false );
+ if (CURSOR_META == eCrsrType)
+ {
+ try
+ {
+ bForceExpandHints = CheckForOwnMemberMeta(
+ pRange, (pCursor) ? pCursor->GetPaM() : 0, bAbsorb);
+ }
+ catch (lang::IllegalArgumentException & iae)
+ {
+ // stupid method not allowed to throw iae
+ throw uno::RuntimeException(iae.Message, 0);
+ }
+ }
if(bAbsorb)
{
//!! scan for CR characters and inserting the paragraph breaks
//!! has to be done in the called function.
//!! Implemented in SwXTextRange::DeleteAndInsert
- xTextRange->setString(aString);
+ if (pCursor)
+ {
+ SwXTextCursor * const pTextCursor( dynamic_cast<SwXTextCursor*>(pCursor) );
+ if (pTextCursor)
+ {
+ pTextCursor->DeleteAndInsert(aString, bForceExpandHints);
+ }
+ else
+ {
+ xTextRange->setString(aString);
+ }
+ }
+ else
+ {
+ pRange->DeleteAndInsert(aString, bForceExpandHints);
+ }
}
else
{
@@ -294,10 +338,11 @@ void SwXText::insertString(const uno::Reference< text::XTextRange >& xTextRange,
? pCursor->GetPaM()->Start()
: &pRange->GetBookmark()->GetMarkStart();
SwPaM aInsertPam(*pPos);
- sal_Bool bGroupUndo = GetDoc()->DoesGroupUndo();
+ const sal_Bool bGroupUndo = GetDoc()->DoesGroupUndo();
GetDoc()->DoGroupUndo(sal_False);
- SwUnoCursorHelper::DocInsertStringSplitCR(*GetDoc(), aInsertPam, aString);
+ SwUnoCursorHelper::DocInsertStringSplitCR(
+ *GetDoc(), aInsertPam, aString, bForceExpandHints );
GetDoc()->DoGroupUndo(bGroupUndo);
}
}
@@ -316,15 +361,29 @@ void SwXText::insertControlCharacter(const uno::Reference< text::XTextRange > &
throw( lang::IllegalArgumentException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(GetDoc() && xTextRange.is())
+ if (!xTextRange.is())
+ throw lang::IllegalArgumentException();
+ if (GetDoc())
{
SwUnoInternalPaM aPam(*GetDoc());
if(SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange))
{
+ const bool bForceExpandHints(
+ CheckForOwnMemberMeta( 0, &aPam, bAbsorb) );
+
+ const enum IDocumentContentOperations::InsertFlags nInsertFlags =
+ (bForceExpandHints)
+ ? static_cast<IDocumentContentOperations::InsertFlags>(
+ IDocumentContentOperations::INS_FORCEHINTEXPAND |
+ IDocumentContentOperations::INS_EMPTYEXPAND)
+ : IDocumentContentOperations::INS_EMPTYEXPAND;
+
//Steuerzeichen einfuegen
SwPaM aTmp(*aPam.Start());
if(bAbsorb && aPam.HasMark())
+ {
pDoc->DeleteAndJoin(aPam);
+ }
sal_Unicode cIns = 0;
switch( nControlCharacter )
@@ -367,7 +426,9 @@ void SwXText::insertControlCharacter(const uno::Reference< text::XTextRange > &
case text::ControlCharacter::HARD_SPACE: cIns = CHAR_HARDBLANK; break;
}
if( cIns )
- pDoc->Insert( aTmp, cIns );
+ {
+ pDoc->InsertString( aTmp, cIns, nInsertFlags );
+ }
if(bAbsorb)
{
@@ -476,9 +537,9 @@ void SwXText::insertTextContent(const uno::Reference< text::XTextRange > & xRang
::sw::mark::IMark const * const pBkmk = pRange->GetBookmark();
pSrcNode = &pBkmk->GetMarkPos().nNode.GetNode();
}
- else if (pPortion && pPortion->GetCrsr())
+ else if (pPortion && pPortion->GetCursor())
{
- pSrcNode = pPortion->GetCrsr()->GetNode();
+ pSrcNode = pPortion->GetCursor()->GetNode();
}
else if (pText)
{
@@ -511,9 +572,12 @@ void SwXText::insertTextContent(const uno::Reference< text::XTextRange > & xRang
aRunException.Message = C2U("text interface and cursor not related");
throw aRunException;
}
+
+ const bool bForceExpandHints( CheckForOwnMemberMeta(
+ pRange, (pCursor) ? pCursor->GetPaM() : 0, bAbsorb) );
+
// 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())
{
@@ -529,8 +593,12 @@ void SwXText::insertTextContent(const uno::Reference< text::XTextRange > & xRang
sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXBookmark::getUnoTunnelId()) ));
SwXReferenceMark* pReferenceMark = reinterpret_cast< SwXReferenceMark * >(
sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXReferenceMark::getUnoTunnelId()) ));
+ SwXMeta *const pMeta = reinterpret_cast< SwXMeta* >(
+ sal::static_int_cast< sal_IntPtr >(
+ xContentTunnel->getSomething( SwXMeta::getUnoTunnelId())));
- bAttribute = pBookmark || pDocumentIndexMark || pSection || pReferenceMark;
+ const bool bAttribute = pBookmark || pDocumentIndexMark
+ || pSection || pReferenceMark || pMeta;
if(bAbsorb && !bAttribute)
{
@@ -542,6 +610,12 @@ void SwXText::insertTextContent(const uno::Reference< text::XTextRange > & xRang
xTempRange = xRange;
else
xTempRange = xRange->getStart();
+ if (bForceExpandHints)
+ {
+ // if necessary, replace xTempRange with a new SwXTextCursor
+ PrepareForAttach(xTempRange, pRange,
+ (pCursor) ? pCursor->GetPaM() : 0);
+ }
xContent->attach(xTempRange);
}
else
@@ -582,7 +656,7 @@ void SwXText::insertTextContentBefore(
if(!pPara || !pPara->IsDescriptor() || !xSuccessor.is())
throw lang::IllegalArgumentException();
- sal_Bool bRet = FALSE;
+ sal_Bool bRet = sal_False;
SwXTextSection* pXSection = SwXTextSection::GetImplementation( xSuccessor );
SwXTextTable* pXTable = SwXTextTable::GetImplementation(xSuccessor );
SwFrmFmt* pTableFmt = pXTable ? pXTable->GetFrmFmt() : 0;
@@ -636,7 +710,7 @@ void SwXText::insertTextContentAfter(
SwXTextSection* pXSection = SwXTextSection::GetImplementation( xPredecessor );
SwXTextTable* pXTable = SwXTextTable::GetImplementation(xPredecessor );
SwFrmFmt* pTableFmt = pXTable ? pXTable->GetFrmFmt() : 0;
- sal_Bool bRet = FALSE;
+ sal_Bool bRet = sal_False;
if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
{
SwTable* pTable = SwTable::FindTable( pTableFmt );
@@ -680,7 +754,7 @@ void SwXText::removeTextContentBefore(
throw aRuntime;
}
- sal_Bool bRet = FALSE;
+ sal_Bool bRet = sal_False;
SwXTextSection* pXSection = SwXTextSection::GetImplementation( xSuccessor );
SwXTextTable* pXTable = SwXTextTable::GetImplementation( xSuccessor );
SwFrmFmt* pTableFmt = pXTable ? pXTable->GetFrmFmt() : 0;
@@ -727,7 +801,7 @@ void SwXText::removeTextContentAfter(const uno::Reference< text::XTextContent>&
throw aRuntime;
}
- sal_Bool bRet = FALSE;
+ sal_Bool bRet = sal_False;
SwXTextSection* pXSection = SwXTextSection::GetImplementation( xPredecessor );
SwXTextTable* pXTable = SwXTextTable::GetImplementation(xPredecessor );
SwFrmFmt* pTableFmt = pXTable ? pXTable->GetFrmFmt() : 0;
@@ -818,10 +892,8 @@ uno::Reference< text::XTextRange > SwXText::getEnd(void) throw( uno::RuntimeExc
aRuntime.Message = C2U(cInvalidObject);
throw aRuntime;
}
- else
- xRef->gotoEnd(sal_False);
- uno::Reference< text::XTextRange > xRet(xRef, uno::UNO_QUERY);;
-
+ xRef->gotoEnd(sal_False);
+ uno::Reference< text::XTextRange > xRet(xRef, uno::UNO_QUERY);
return xRet;
}
/*-- 09.12.98 12:43:29---------------------------------------------------
@@ -856,6 +928,7 @@ void SwXText::setString(const OUString& aString) throw( uno::RuntimeException )
GetDoc()->StartUndo(UNDO_START, NULL);
//insert an empty paragraph at the start and at the end to ensure that
//all tables and sections can be removed by the selecting text::XTextCursor
+ if (CURSOR_META != eCrsrType)
{
SwPosition aStartPos(*pStartNode);
const SwEndNode* pEnd = pStartNode->EndOfSectionNode();
@@ -903,6 +976,7 @@ void SwXText::setString(const OUString& aString) throw( uno::RuntimeException )
GetDoc()->EndUndo(UNDO_END, NULL);
}
+//FIXME why is CheckForOwnMember duplicated in some insert methods?
// 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(
@@ -1361,7 +1435,8 @@ uno::Reference< text::XTextRange > SwXText::appendTextPortion(
if(rText.getLength())
{
xub_StrLen nContentPos = pCursor->GetPoint()->nContent.GetIndex();
- SwUnoCursorHelper::DocInsertStringSplitCR( *pDoc, *pCursor, rText );
+ SwUnoCursorHelper::DocInsertStringSplitCR( *pDoc, *pCursor, rText,
+ false );
SwXTextCursor::SelectPam(*pCursor, sal_True);
pCursor->GetPoint()->nContent = nContentPos;
}
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index dddcd1152fd8..2c25ffbad82a 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2230,12 +2230,12 @@ void ViewShell::ApplyViewOptions( const SwViewOption &rOpt )
{
SwViewOption aOpt( *pSh->GetViewOptions() );
aOpt.SetFldName( rOpt.IsFldName() );
- aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
+ aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
- aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
- aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
- aOpt.SetViewLayoutColumns( rOpt.GetViewLayoutColumns() );
-
+ aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
+ aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
+ aOpt.SetViewLayoutColumns( rOpt.GetViewLayoutColumns() );
+ aOpt.SetPostIts(rOpt.IsPostIts());
if ( !(aOpt == *pSh->GetViewOptions()) )
pSh->ImplApplyViewOptions( aOpt );
pSh = (ViewShell*)pSh->GetNext();
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 6775bf213736..cf72af66d0a8 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -1,4 +1,5 @@
-/*************************************************************************
+/**************************************************************************
+ *
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -44,6 +45,7 @@
#include <svx/pbinitem.hxx>
#include <svx/svdview.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <svtools/syslocale.hxx>
#include <txtfld.hxx>
#include <fmtfld.hxx>
#include <fmtfsize.hxx>
@@ -353,8 +355,8 @@ void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, SwPostItF
aStr.AppendAscii(sTmp);
aStr += pField->GetPar1();
aStr += ' ';
- aStr += GetAppLocaleData().getDate( pField->GetDate() );
- pIDCO->Insert( aPam, aStr, true );
+ aStr += SvtSysLocale().GetLocaleData().getDate( pField->GetDate() );
+ pIDCO->InsertString( aPam, aStr );
pIDCO->SplitNode( *aPam.GetPoint(), false );
aStr = pField->GetPar2();
@@ -362,7 +364,7 @@ void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, SwPostItF
// Bei Windows und Co alle CR rausschmeissen
aStr.EraseAllChars( '\r' );
#endif
- pIDCO->Insert( aPam, aStr, true );
+ pIDCO->InsertString( aPam, aStr );
pIDCO->SplitNode( *aPam.GetPoint(), false );
pIDCO->SplitNode( *aPam.GetPoint(), false );
}
@@ -453,7 +455,7 @@ void lcl_PrintPostItsEndDoc( ViewShell* pPrtShell,
aPam.Move( fnMoveBackward, fnGoDoc );
aPam.SetMark();
aPam.Move( fnMoveForward, fnGoDoc );
- pPrtDoc->Delete( aPam );
+ pPrtDoc->DeleteRange( aPam );
for( USHORT i = 0, nVirtPg, nLineNo; i < nPostIts; ++i )
{
@@ -502,7 +504,7 @@ void lcl_PrintPostItsEndPage( ViewShell* pPrtShell,
aPam.Move( fnMoveBackward, fnGoDoc );
aPam.SetMark();
aPam.Move( fnMoveForward, fnGoDoc );
- pPrtDoc->Delete( aPam );
+ pPrtDoc->DeleteRange( aPam );
while( i < nPostIts )
{
@@ -1516,7 +1518,9 @@ BOOL ViewShell::IsAnyFieldInDoc() const
{
const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
- if( pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+ //#i101026# mod: do not include postits in field check
+ const SwField* pFld = pFmtFld->GetFld();
+ if( pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() && (pFld->Which() != RES_POSTITFLD))
return TRUE;
}
return FALSE;
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index f59ca89a8ce8..22957c9434af 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -88,20 +88,16 @@ xub_StrLen SwASC_AttrIter::SearchNext( xub_StrLen nStartPos )
const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
if( pTxtAttrs )
{
- USHORT i;
- xub_StrLen nPos;
- const xub_StrLen * pPos;
-
// kann noch optimiert werden, wenn ausgenutzt wird, dass die TxtAttrs
// nach der Anfangsposition geordnet sind. Dann muessten
// allerdings noch 2 Indices gemerkt werden
- for( i = 0; i < pTxtAttrs->Count(); i++ )
+ for ( USHORT i = 0; i < pTxtAttrs->Count(); i++ )
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
- nPos = *pHt->GetStart(); // gibt erstes Attr-Zeichen
- pPos = pHt->GetEnd();
- if( !pPos )
+ if (pHt->HasDummyChar())
{
+ xub_StrLen nPos = *pHt->GetStart();
+
if( nPos >= nStartPos && nPos <= nMinPos )
nMinPos = nPos;
@@ -124,8 +120,7 @@ BOOL SwASC_AttrIter::OutAttr( xub_StrLen nSwPos )
for( i = 0; i < pTxtAttrs->Count(); i++ )
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
- const xub_StrLen * pEnd = pHt->GetEnd();
- if( !pEnd && nSwPos == *pHt->GetStart() )
+ if ( pHt->HasDummyChar() && nSwPos == *pHt->GetStart() )
{
bRet = TRUE;
String sOut;
@@ -135,10 +130,6 @@ BOOL SwASC_AttrIter::OutAttr( xub_StrLen nSwPos )
sOut = ((SwTxtFld*)pHt)->GetFld().GetFld()->Expand();
break;
- case RES_TXTATR_HARDBLANK:
- sOut = ((SwTxtHardBlank*)pHt)->GetChar();
- break;
-
case RES_TXTATR_FTN:
{
const SwFmtFtn& rFtn = pHt->GetFtn();
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index 24aa81837d62..50ba611b12e5 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -261,7 +261,7 @@ ULONG SwASCIIParser::CallParser()
// !!!!!
ASSERT( !this, "Have to change - hard attr. to para. style" );
- pDoc->Insert( *pInsPam, *pItemSet, 0 );
+ pDoc->InsertItemSet( *pInsPam, *pItemSet, 0 );
}
}
delete pItemSet, pItemSet = 0;
@@ -467,7 +467,7 @@ ULONG SwASCIIParser::ReadChars()
InsertText( String( pLastStt ));
}
pDoc->SplitNode( *pPam->GetPoint(), false );
- pDoc->Insert( *pPam, SvxFmtBreakItem(
+ pDoc->InsertPoolItem( *pPam, SvxFmtBreakItem(
SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0);
pLastStt = pStt;
nLineLen = 0;
@@ -528,7 +528,7 @@ ULONG SwASCIIParser::ReadChars()
void SwASCIIParser::InsertText( const String& rStr )
{
- pDoc->Insert( *pPam, rStr, true );
+ pDoc->InsertString( *pPam, rStr );
if( pItemSet && pBreakIt && nScript != ( SCRIPTTYPE_LATIN |
SCRIPTTYPE_ASIAN |
SCRIPTTYPE_COMPLEX ) )
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 05b1bb4eb97a..cb31050b02d3 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -670,13 +670,13 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
// if the first node dont contained any content, then
// insert one char in it calc again and delete once again
SwIndex aNdIdx( pFirstTxtNd );
- pFirstTxtNd->Insert( String::CreateFromAscii(
+ pFirstTxtNd->InsertText( String::CreateFromAscii(
RTL_CONSTASCII_STRINGPARAM( "MM" )), aNdIdx );
ULONG nAbsMinCnts;
pFirstTxtNd->GetMinMaxSize( pFirstTxtNd->GetIndex(),
nMinFrm, nMaxFrm, nAbsMinCnts );
aNdIdx -= 2;
- pFirstTxtNd->Erase( aNdIdx, 2 );
+ pFirstTxtNd->EraseText( aNdIdx, 2 );
}
// Umrandung und Abstand zum Inhalt beachten
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 2020efd3288e..01108a0d2567 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -3755,22 +3755,22 @@ SwAttrFnTab aCSS1AttrFnTab = {
/* RES_CHRATR_DUMMY1 */ 0,
/* RES_CHRATR_DUMMY2 */ 0,
-/* RES_TXTATR_NOLINEBREAK */ 0,
-/* RES_TXTATR_NOHYPHEN */ 0,
-/* RES_TXTATR_REFMARK*/ 0,
+/* RES_TXTATR_REFMARK */ 0,
/* RES_TXTATR_TOXMARK */ 0,
-/* RES_TXTATR_CHARFMT */ 0,
-/* RES_TXTATR_TWO_LINES */ 0,
+/* RES_TXTATR_META */ 0,
+/* RES_TXTATR_METAFIELD */ 0,
+/* RES_TXTATR_AUTOFMT */ 0,
+/* RES_TXTATR_INETFMT */ 0,
+/* RES_TXTATR_CHARFMT */ 0,
/* RES_TXTATR_CJK_RUBY */ 0,
/* RES_TXTATR_UNKNOWN_CONTAINER */ 0,
/* RES_TXTATR_DUMMY5 */ 0,
-/* RES_TXTATR_DUMMY6 */ 0,
/* RES_TXTATR_FIELD */ 0,
/* RES_TXTATR_FLYCNT */ 0,
/* RES_TXTATR_FTN */ 0,
-/* RES_TXTATR_SOFTHYPH */ 0,
-/* RES_TXTATR_HARDBLANK*/ 0,
+/* RES_TXTATR_DUMMY4 */ 0,
+/* RES_TXTATR_DUMMY3 */ 0,
/* RES_TXTATR_DUMMY1 */ 0, // Dummy:
/* RES_TXTATR_DUMMY2 */ 0, // Dummy:
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index c4608a4907f2..e788dc5da275 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -81,7 +81,6 @@
#include <txatbase.hxx>
#include <frmatr.hxx>
#include <charfmt.hxx>
-#include <fmthbsh.hxx>
#include <fmtfld.hxx>
#include <doc.hxx>
#include <pam.hxx>
@@ -1801,8 +1800,8 @@ HTMLEndPosLst::HTMLEndPosLst( SwDoc *pD, SwDoc* pTempl,
xub_StrLen nPos = 0;
while( nPos < nEndPos )
{
- sal_uInt16 nScript = pBreakIt->xBreak->getScriptType( rText, nPos );
- nPos = (xub_StrLen)pBreakIt->xBreak->endOfScript( rText, nPos, nScript );
+ sal_uInt16 nScript = pBreakIt->GetBreakIter()->getScriptType( rText, nPos );
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( rText, nPos, nScript );
aScriptChgLst.Insert( nPos, aScriptChgLst.Count() );
aScriptLst.Insert( nScript, aScriptLst.Count() );
}
@@ -2495,7 +2494,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode )
if( RES_TXTATR_FIELD == pHt->Which() ) // Felder nicht
continue; // ausgeben
- if( pHt->GetEnd() )
+ if ( pHt->GetEnd() && !pHt->HasDummyChar() )
{
xub_StrLen nHtEnd = *pHt->GetEnd(),
nHtStt = *pHt->GetStart();
@@ -2555,7 +2554,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode )
&& nStrPos != nEnde )
{
do {
- if( pHt->GetEnd() )
+ if ( pHt->GetEnd() && !pHt->HasDummyChar() )
{
if( RES_CHRATR_KERNING == pHt->Which() &&
rHTMLWrt.IsHTMLMode(HTMLMODE_FIRSTLINE) &&
@@ -3041,15 +3040,6 @@ static Writer& OutHTML_SwFlyCnt( Writer& rWrt, const SfxPoolItem& rHt )
return rWrt;
}
-static Writer& OutHTML_SwHardBlank( Writer& rWrt, const SfxPoolItem& rHt )
-{
- HTMLOutContext aContext ( ((SwHTMLWriter&)rWrt).eDestEnc );
- HTMLOutFuncs::Out_Char( rWrt.Strm(), ((SwFmtHardBlank&)rHt).GetChar(),
- aContext,
- &((SwHTMLWriter&)rWrt).aNonConvertableCharacters);
- HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext );
- return rWrt;
-}
// Das ist jetzt unser Blink-Item. Blinkend wird eingeschaltet, indem man
// das Item auf TRUE setzt!
@@ -3401,22 +3391,22 @@ SwAttrFnTab aHTMLAttrFnTab = {
/* RES_CHRATR_DUMMY1 */ 0,
/* RES_CHRATR_DUMMY2 */ 0,
-/* RES_TXTATR_DUMMY4 */ 0,
-/* RES_TXTATR_INETFMT */ OutHTML_SwFmtINetFmt,
-/* RES_TXTATR_REFMARK*/ 0,
+/* RES_TXTATR_REFMARK */ 0,
/* RES_TXTATR_TOXMARK */ 0,
-/* RES_TXTATR_CHARFMT */ OutHTML_SwTxtCharFmt,
-/* RES_TXTATR_TWO_LINES */ 0,
+/* RES_TXTATR_META */ 0,
+/* RES_TXTATR_METAFIELD */ 0,
+/* RES_TXTATR_AUTOFMT */ 0,
+/* RES_TXTATR_INETFMT */ OutHTML_SwFmtINetFmt,
+/* RES_TXTATR_CHARFMT */ OutHTML_SwTxtCharFmt,
/* RES_TXTATR_CJK_RUBY */ 0,
/* RES_TXTATR_UNKNOWN_CONTAINER */ 0,
/* RES_TXTATR_DUMMY5 */ 0,
-/* RES_TXTATR_DUMMY6 */ 0,
/* RES_TXTATR_FIELD */ OutHTML_SwFmtFld,
/* RES_TXTATR_FLYCNT */ OutHTML_SwFlyCnt,
/* RES_TXTATR_FTN */ OutHTML_SwFmtFtn,
-/* RES_TXTATR_SOFTHYPH */ 0,
-/* RES_TXTATR_HARDBLANK*/ OutHTML_SwHardBlank,
+/* RES_TXTATR_DUMMY4 */ 0,
+/* RES_TXTATR_DUMMY3 */ 0,
/* RES_TXTATR_DUMMY1 */ 0, // Dummy:
/* RES_TXTATR_DUMMY2 */ 0, // Dummy:
diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx
index bb003d292ed8..e591d2d5e90b 100644
--- a/sw/source/filter/html/htmlbas.cxx
+++ b/sw/source/filter/html/htmlbas.cxx
@@ -47,6 +47,8 @@
#include <svtools/htmltokn.h>
#include <svtools/htmlkywd.hxx>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/uno/Reference.hxx>
#include <fmtornt.hxx>
#include <fmtfld.hxx>
@@ -251,7 +253,7 @@ void SwHTMLParser::AddScriptSource()
}
}
-void SwHTMLParser::InsertBasicDocEvent( USHORT nEvent, const String& rName,
+void SwHTMLParser::InsertBasicDocEvent( rtl::OUString aEvent, const String& rName,
ScriptType eScrType,
const String& rScrType )
{
@@ -270,8 +272,10 @@ void SwHTMLParser::InsertBasicDocEvent( USHORT nEvent, const String& rName,
if( EXTENDED_STYPE == eScrType )
sScriptType = rScrType;
+ rtl::OUString aEventName;
+
SfxEventConfiguration* pECfg = SFX_APP()->GetEventConfig();
- pECfg->ConfigureEvent( nEvent, SvxMacro( sEvent, sScriptType, eScrType ),
+ pECfg->ConfigureEvent( aEvent, SvxMacro( sEvent, sScriptType, eScrType ),
pDocSh );
}
@@ -338,6 +342,10 @@ void SwHTMLWriter::OutBasic()
SFX_APP()->LeaveBasicCall();
}
+static const char* aEventNames[] =
+{
+ "OnLoad", "OnPrepareUnload", "OnFocus", "OnUnfocus"
+};
void SwHTMLWriter::OutBasicBodyEvents()
{
@@ -345,14 +353,19 @@ void SwHTMLWriter::OutBasicBodyEvents()
if( !pDocSh )
return;
- SfxEventConfiguration* pECfg = SFX_APP()->GetEventConfig();
- ASSERT( pECfg, "Wo ist die Event-Konfiguration?" );
- if( !pECfg )
- return;
+ SvxMacroTableDtor *pDocTable = new SvxMacroTableDtor;
+
+ uno::Reference< document::XEventsSupplier > xSup( pDocSh->GetModel(), uno::UNO_QUERY );
+ uno::Reference < container::XNameReplace > xEvents = xSup->getEvents();
+ for ( sal_Int32 i=0; i<4; i++ )
+ {
+ SvxMacro* pMacro = SfxEventConfiguration::ConvertToMacro( xEvents->getByName( ::rtl::OUString::createFromAscii(aEventNames[i]) ), pDocSh, TRUE );
+ if ( pMacro )
+ pDocTable->Insert( aBodyEventTable[i].nEvent, pMacro );
+ }
- SvxMacroTableDtor *pMacTable = pECfg->GetDocEventTable( pDocSh );
- if( pMacTable && pMacTable->Count() )
- HTMLOutFuncs::Out_Events( Strm(), *pMacTable, aBodyEventTable,
+ if( pDocTable && pDocTable->Count() )
+ HTMLOutFuncs::Out_Events( Strm(), *pDocTable, aBodyEventTable,
bCfgStarBasic, eDestEnc, &aNonConvertableCharacters );
}
diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx
index 7e3e088eb7d9..c9930c3ca8ef 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -547,7 +547,7 @@ void SwHTMLParser::NewField()
}
else
{
- pDoc->Insert( *pPam, SwFmtFld(*pFld), 0 );
+ pDoc->InsertPoolItem( *pPam, SwFmtFld(*pFld), 0 );
delete pFld;
}
bInField = TRUE;
@@ -585,7 +585,7 @@ void SwHTMLParser::EndField()
break;
}
- pDoc->Insert( *pPam, SwFmtFld(*pField), 0 );
+ pDoc->InsertPoolItem( *pPam, SwFmtFld(*pField), 0 );
delete pField;
pField = 0;
}
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index b3ef7f67d75e..d9e7f92ec6a3 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -312,8 +312,8 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld,
sal_Bool bNeedsCJKProcessing = sal_False;
if( sExpand.Len() )
{
- sal_uInt16 nScriptType = pBreakIt->xBreak->getScriptType( sExpand, 0 );
- xub_StrLen nPos = (xub_StrLen)pBreakIt->xBreak->endOfScript( sExpand, 0,
+ sal_uInt16 nScriptType = pBreakIt->GetBreakIter()->getScriptType( sExpand, 0 );
+ xub_StrLen nPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( sExpand, 0,
nScriptType );
sal_uInt16 nScript =
@@ -361,10 +361,10 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld,
xub_StrLen nPos = 0;
do
{
- sal_uInt16 nScriptType = pBreakIt->xBreak->getScriptType( sExpand, nPos );
+ sal_uInt16 nScriptType = pBreakIt->GetBreakIter()->getScriptType( sExpand, nPos );
sal_uInt16 nScript =
SwHTMLWriter::GetCSS1ScriptForScriptType( nScriptType );
- xub_StrLen nEndPos = (xub_StrLen)pBreakIt->xBreak->endOfScript(
+ xub_StrLen nEndPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript(
sExpand, nPos, nScriptType );
if( nScript != CSS1_OUTMODE_ANY_SCRIPT &&
/* #108791# */ nScript != rHTMLWrt.nCSS1Script )
diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index 9e35f8e78768..343939bd38d1 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -228,11 +228,10 @@ void SwHTMLParser::FinishFootEndNote()
if( pFootEndNoteImpl->bFixed )
aFtn.SetNumStr( pFootEndNoteImpl->sContent );
- pDoc->Insert( *pPam, aFtn, 0 );
- SwTxtFtn *pTxtFtn =
- (SwTxtFtn *)pPam->GetNode()->GetTxtNode()->GetTxtAttr(
- pPam->GetPoint()->nContent.GetIndex() - 1,
- RES_TXTATR_FTN );
+ pDoc->InsertPoolItem( *pPam, aFtn, 0 );
+ SwTxtFtn * const pTxtFtn = static_cast<SwTxtFtn *>(
+ pPam->GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ pPam->GetPoint()->nContent.GetIndex() - 1, RES_TXTATR_FTN ) );
// In Kopf- und Fusszeilen duerfen keine Fussnoten eingefuegt werden.
if( pTxtFtn )
{
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 904648f75bd2..d18a2b762aa0 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -53,7 +53,7 @@
#include <svtools/imap.hxx>
#include <svtools/htmltokn.h>
#include <svtools/htmlkywd.hxx>
-
+#include <svtools/eventcfg.hxx>
#include <fmtornt.hxx>
#include <fmturl.hxx>
@@ -841,7 +841,7 @@ void SwHTMLParser::InsertBodyOptions()
{
const HTMLOption *pOption = (*pHTMLOptions)[--i];
ScriptType eScriptType2 = eDfltScriptType;
- USHORT nEvent = 0;
+ rtl::OUString aEvent;
BOOL bSetEvent = FALSE;
switch( pOption->GetToken() )
@@ -872,28 +872,28 @@ void SwHTMLParser::InsertBodyOptions()
case HTML_O_SDONLOAD:
eScriptType2 = STARBASIC;
case HTML_O_ONLOAD:
- nEvent = SFX_EVENT_OPENDOC;
+ aEvent = GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC );
bSetEvent = TRUE;
break;
case HTML_O_SDONUNLOAD:
eScriptType2 = STARBASIC;
case HTML_O_ONUNLOAD:
- nEvent = SFX_EVENT_PREPARECLOSEDOC;
+ aEvent = GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC );
bSetEvent = TRUE;
break;
case HTML_O_SDONFOCUS:
eScriptType2 = STARBASIC;
case HTML_O_ONFOCUS:
- nEvent = SFX_EVENT_ACTIVATEDOC;
+ aEvent = GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC );
bSetEvent = TRUE;
break;
case HTML_O_SDONBLUR:
eScriptType2 = STARBASIC;
case HTML_O_ONBLUR:
- nEvent = SFX_EVENT_DEACTIVATEDOC;
+ aEvent = GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC );
bSetEvent = TRUE;
break;
@@ -919,7 +919,7 @@ void SwHTMLParser::InsertBodyOptions()
{
const String& rEvent = pOption->GetString();
if( rEvent.Len() )
- InsertBasicDocEvent( nEvent, rEvent, eScriptType2,
+ InsertBasicDocEvent( aEvent, rEvent, eScriptType2,
sDfltScriptType );
}
}
@@ -1374,7 +1374,7 @@ void SwHTMLParser::StripTrailingPara()
if( pPrvNd )
{
SwIndex aSrc( pCNd, 0 );
- pCNd->GetTxtNode()->Cut( pPrvNd, aSrc, pCNd->Len() );
+ pCNd->GetTxtNode()->CutText( pPrvNd, aSrc, pCNd->Len() );
}
}
@@ -1436,9 +1436,10 @@ void SwHTMLParser::StripTrailingPara()
xub_StrLen nPos = pPam->GetPoint()->nContent.GetIndex();
while( bSetSmallFont && nPos>0 )
{
- bSetSmallFont = CH_TXTATR_BREAKWORD ==
- pTxtNd->GetTxt().GetChar( --nPos ) &&
- 0 != pTxtNd->GetTxtAttr( nPos, RES_TXTATR_FLYCNT );
+ --nPos;
+ bSetSmallFont =
+ (CH_TXTATR_BREAKWORD == pTxtNd->GetTxt().GetChar( nPos )) &&
+ (0 != pTxtNd->GetTxtAttrForCharAt( nPos, RES_TXTATR_FLYCNT ));
}
}
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index f1eb32d730a6..a4fb7f70ff66 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -351,7 +351,7 @@ void SwHTMLParser::NewDivision( int nToken )
aItemSet.ClearItem( RES_FRAMEDIR );
}
- pDoc->Insert( *pPam, aSection, &aFrmItemSet, sal_False );
+ pDoc->InsertSwSection( *pPam, aSection, &aFrmItemSet, false );
// ggfs. einen Bereich anspringen
if( JUMPTO_REGION == eJumpTo && aName == sJmpMark )
@@ -746,7 +746,7 @@ void SwHTMLParser::NewMultiCol()
aFrmItemSet.Put( *pItem );
aItemSet.ClearItem( RES_FRAMEDIR );
}
- pDoc->Insert( *pPam, aSection, &aFrmItemSet, sal_False );
+ pDoc->InsertSwSection( *pPam, aSection, &aFrmItemSet, false );
// Jump to section, if this is requested.
if( JUMPTO_REGION == eJumpTo && aName == sJmpMark )
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index cc83cbcd8605..3b02546494f8 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -3030,7 +3030,7 @@ xub_StrLen SwHTMLParser::StripTrailingLF()
nPos = nLen - nLFCount;
SwIndex nIdx( pTxtNd, nPos );
- pTxtNd->Erase( nIdx, nLFCount );
+ pTxtNd->EraseText( nIdx, nLFCount );
nStripped = nLFCount;
}
}
@@ -5495,7 +5495,8 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
pNd = pTblStNd->EndOfSectionNode();
SwNodeIndex aDstIdx( *pNd, bTop ? 0 : 1 );
- pDoc->Move( aSrcRg, aDstIdx, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ pDoc->MoveNodeRange( aSrcRg, aDstIdx,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
// Wenn die Caption vor der Tabelle eingefuegt wurde muss
// eine an der Tabelle gestzte Seitenvorlage noch in den
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index aa42977d9a02..551ebf937be2 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -79,7 +79,6 @@
#include <charatr.hxx>
#include <fmtfld.hxx>
#include <fmtpdsc.hxx>
-#include <fmthbsh.hxx>
#include <txtfld.hxx>
#include <fmtanchr.hxx>
#include <fmtsrnd.hxx>
@@ -235,7 +234,7 @@ ULONG HTMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const
// sonst ist sie schon gesetzt.
if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) )
{
- rDoc.Insert( rPam, SwFmtPageDesc(
+ rDoc.InsertPoolItem( rPam, SwFmtPageDesc(
rDoc.GetPageDescFromPool( RES_POOLPAGE_HTML, false )), 0 );
}
}
@@ -1282,7 +1281,9 @@ void __EXPORT SwHTMLParser::NextToken( int nToken )
pPageDesc = pCSS1Parser->GetRightPageDesc();
if( pPageDesc )
- pDoc->Insert( *pPam, SwFmtPageDesc( pPageDesc ), 0 );
+ {
+ pDoc->InsertPoolItem( *pPam, SwFmtPageDesc( pPageDesc ), 0 );
+ }
}
break;
@@ -1436,11 +1437,11 @@ void __EXPORT SwHTMLParser::NextToken( int nToken )
break;
case HTML_NONBREAKSPACE:
- pDoc->Insert( *pPam, CHAR_HARDBLANK );
+ pDoc->InsertString( *pPam, CHAR_HARDBLANK );
break;
case HTML_SOFTHYPH:
- pDoc->Insert( *pPam, CHAR_SOFTHYPHEN );
+ pDoc->InsertString( *pPam, CHAR_SOFTHYPHEN );
break;
case HTML_LINEFEEDCHAR:
@@ -1482,7 +1483,7 @@ void __EXPORT SwHTMLParser::NextToken( int nToken )
{
if( !bDocInitalized )
DocumentDetected();
- pDoc->Insert( *pPam, aToken, true );
+ pDoc->InsertString( *pPam, aToken );
// wenn es noch vorlaefige Absatz-Attribute gibt, der Absatz aber
// nicht leer ist, dann sind die Absatz-Attribute entgueltig.
@@ -2190,9 +2191,9 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum )
{
const String& rText = pTxtNd->GetTxt();
sal_uInt16 nScriptTxt =
- pBreakIt->xBreak->getScriptType(
+ pBreakIt->GetBreakIter()->getScriptType(
rText, pAttr->GetSttCnt() );
- xub_StrLen nScriptEnd = (xub_StrLen)pBreakIt->xBreak
+ xub_StrLen nScriptEnd = (xub_StrLen)pBreakIt->GetBreakIter()
->endOfScript( rText, nStt, nScriptTxt );
while( nScriptEnd < nEndCnt )
{
@@ -2212,9 +2213,9 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum )
pNext->InsertPrev( pSetAttr );
}
nStt = nScriptEnd;
- nScriptTxt = pBreakIt->xBreak->getScriptType(
+ nScriptTxt = pBreakIt->GetBreakIter()->getScriptType(
rText, nStt );
- nScriptEnd = (xub_StrLen)pBreakIt->xBreak
+ nScriptEnd = (xub_StrLen)pBreakIt->GetBreakIter()
->endOfScript( rText, nStt, nScriptTxt );
}
bInsert = nScriptItem == nScriptTxt;
@@ -2336,7 +2337,7 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum )
// also delete the SwpHints!!! To avoid any trouble
// we leave the loop immediately if this is the last
// hint.
- pTxtNd->Delete( pHt, sal_True );
+ pTxtNd->DeleteAttribute( pHt );
if( 1 == nCntAttr )
break;
i--;
@@ -2821,7 +2822,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable,
eJumpTo = JUMPTO_NONE;
}
- pDoc->Insert( *pAttrPam, *pAttr->pItem, nsSetAttrMode::SETATTR_DONTREPLACE );
+ pDoc->InsertPoolItem( *pAttrPam, *pAttr->pItem, nsSetAttrMode::SETATTR_DONTREPLACE );
}
pAttrPam->DeleteMark();
@@ -2903,7 +2904,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable,
pAttrPam->Move( fnMoveBackward );
}
- pDoc->Insert( *pAttrPam, *pAttr->pItem, 0 );
+ pDoc->InsertPoolItem( *pAttrPam, *pAttr->pItem, 0 );
aFields.Remove( 0, 1 );
delete pAttr;
@@ -3007,9 +3008,9 @@ void SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr,
.GetTxtNode();
ASSERT( pTxtNd, "No text node" );
const String& rText = pTxtNd->GetTxt();
- sal_uInt16 nScriptTxt = pBreakIt->xBreak->getScriptType(
+ sal_uInt16 nScriptTxt = pBreakIt->GetBreakIter()->getScriptType(
rText, pAttr->GetSttCnt() );
- xub_StrLen nScriptEnd = (xub_StrLen)pBreakIt->xBreak
+ xub_StrLen nScriptEnd = (xub_StrLen)pBreakIt->GetBreakIter()
->endOfScript( rText, pAttr->GetSttCnt(), nScriptTxt );
while( nScriptEnd < nEndCnt )
{
@@ -3027,9 +3028,9 @@ void SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr,
}
}
pAttr->nSttCntnt = nScriptEnd;
- nScriptTxt = pBreakIt->xBreak->getScriptType(
+ nScriptTxt = pBreakIt->GetBreakIter()->getScriptType(
rText, nScriptEnd );
- nScriptEnd = (xub_StrLen)pBreakIt->xBreak
+ nScriptEnd = (xub_StrLen)pBreakIt->GetBreakIter()
->endOfScript( rText, nScriptEnd, nScriptTxt );
}
bInsert = nScriptItem == nScriptTxt;
@@ -4941,7 +4942,7 @@ void SwHTMLParser::InsertSpacer()
{
NewAttr( &aAttrTab.pKerning, SvxKerningItem( (short)nSize, RES_CHRATR_KERNING ) );
String aTmp( ' ' );
- pDoc->Insert( *pPam, aTmp /*, CHARSET_ANSI*/, true );
+ pDoc->InsertString( *pPam, aTmp );
EndAttr( aAttrTab.pKerning );
}
}
@@ -5149,7 +5150,7 @@ void SwHTMLParser::InsertLineBreak()
// wenn kein CLEAR ausgefuehrt werden sollte oder konnte, wird
// ein Zeilenumbruch eingef?gt
String sTmp( (sal_Unicode)0x0a ); // make the Mac happy :-)
- pDoc->Insert( *pPam, sTmp, true );
+ pDoc->InsertString( *pPam, sTmp );
}
else if( pPam->GetPoint()->nContent.GetIndex() )
{
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 45349e626032..61dfb82fc040 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -782,7 +782,7 @@ private:
void AddScriptSource();
// ein Event in die SFX-Konfiguation eintragen (htmlbas.cxx)
- void InsertBasicDocEvent( sal_uInt16 nEvent, const String& rName,
+ void InsertBasicDocEvent( rtl::OUString aEventName, const String& rName,
ScriptType eScrType, const String& rScrType );
// ein Event an ein VC-Control anhaengen (htmlform.cxx)
diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx
index d1b0f0f7859c..fc60c857aedb 100644
--- a/sw/source/filter/rtf/rtfatr.cxx
+++ b/sw/source/filter/rtf/rtfatr.cxx
@@ -102,7 +102,6 @@
#include <fmtfld.hxx>
#include <fmtflcnt.hxx>
#include <fmtftn.hxx>
-#include <fmthbsh.hxx>
#include <fchrfmt.hxx>
#include <fmtautofmt.hxx>
#include <fmtcntnt.hxx>
@@ -2790,8 +2789,8 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt )
*/
const String& rFldPar1 = pFld->GetPar1();
USHORT nScript;
- if( pBreakIt->xBreak.is() )
- nScript = pBreakIt->xBreak->getScriptType( rFldPar1, 0);
+ if( pBreakIt->GetBreakIter().is() )
+ nScript = pBreakIt->GetBreakIter()->getScriptType( rFldPar1, 0);
else
nScript = i18n::ScriptType::ASIAN;
@@ -3048,14 +3047,6 @@ static Writer& OutRTF_SwFtn( Writer& rWrt, const SfxPoolItem& rHt )
return rWrt;
}
-static Writer& OutRTF_SwHardBlank( Writer& rWrt, const SfxPoolItem& rHt)
-{
- RTFOutFuncs::Out_String(rWrt.Strm(),
- String(((SwFmtHardBlank&)rHt).GetChar()), ((SwRTFWriter&)rWrt).eDefaultEncoding,
- ((SwRTFWriter&)rWrt).bWriteHelpFmt);
- return rWrt;
-}
-
static Writer& OutRTF_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt )
{
const SwFmtCharFmt& rChrFmt = (const SwFmtCharFmt&)rHt;
@@ -3110,8 +3101,8 @@ static Writer& OutRTF_SwTxtRuby( Writer& rWrt, const SfxPoolItem& rHt )
defaulting to asian.
*/
USHORT nScript;
- if( pBreakIt->xBreak.is() )
- nScript = pBreakIt->xBreak->getScriptType( rRuby.GetText(), 0);
+ if( pBreakIt->GetBreakIter().is() )
+ nScript = pBreakIt->GetBreakIter()->getScriptType( rRuby.GetText(), 0);
else
nScript = i18n::ScriptType::ASIAN;
@@ -3153,8 +3144,8 @@ static Writer& OutRTF_SwTxtRuby( Writer& rWrt, const SfxPoolItem& rHt )
rWrt.Strm() << "\\\\a" << cDirective;
rWrt.Strm() << "(\\\\s\\\\up ";
- if( pBreakIt->xBreak.is() )
- nScript = pBreakIt->xBreak->getScriptType( pNd->GetTxt(),
+ if( pBreakIt->GetBreakIter().is() )
+ nScript = pBreakIt->GetBreakIter()->getScriptType( pNd->GetTxt(),
*pRubyTxt->GetStart() );
else
nScript = i18n::ScriptType::ASIAN;
@@ -4260,22 +4251,22 @@ SwAttrFnTab aRTFAttrFnTab = {
/* RES_CHRATR_DUMMY1 */ 0,
/* RES_CHRATR_DUMMY2 */ 0,
-/* RES_TXTATR_AUTOFMT */ OutRTF_SwTxtAutoFmt,
-/* RES_TXTATR_INETFMT */ OutRTF_SwTxtINetFmt, // Dummy
-/* RES_TXTATR_REFMARK*/ 0, // NOT USED!! OutRTF_SwRefMark,
+/* RES_TXTATR_REFMARK */ 0, // NOT USED!! OutRTF_SwRefMark,
/* RES_TXTATR_TOXMARK */ 0, // NOT USED!! OutRTF_SwTOXMark,
-/* RES_TXTATR_CHARFMT */ OutRTF_SwTxtCharFmt,
-/* RES_TXTATR_TWO_LINES */ 0,
+/* RES_TXTATR_META */ 0,
+/* RES_TXTATR_METAFIELD */ 0,
+/* RES_TXTATR_AUTOFMT */ OutRTF_SwTxtAutoFmt,
+/* RES_TXTATR_INETFMT */ OutRTF_SwTxtINetFmt,
+/* RES_TXTATR_CHARFMT */ OutRTF_SwTxtCharFmt,
/* RES_TXTATR_CJK_RUBY */ OutRTF_SwTxtRuby,
/* RES_TXTATR_UNKNOWN_CONTAINER */ 0,
/* RES_TXTATR_DUMMY5 */ 0,
-/* RES_TXTATR_DUMMY6 */ 0,
/* RES_TXTATR_FIELD */ OutRTF_SwField,
/* RES_TXTATR_FLYCNT */ OutRTF_SwFlyCntnt,
/* RES_TXTATR_FTN */ OutRTF_SwFtn,
-/* RES_TXTATR_SOFTHYPH */ 0, // old attr. - coded now by character
-/* RES_TXTATR_HARDBLANK*/ OutRTF_SwHardBlank,
+/* RES_TXTATR_DUMMY4 */ 0,
+/* RES_TXTATR_DUMMY3 */ 0,
/* RES_TXTATR_DUMMY1 */ 0, // Dummy:
/* RES_TXTATR_DUMMY2 */ 0, // Dummy:
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index b608ad1b622e..8985d58429c3 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -450,7 +450,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
// steht jetzt geanu auf dem Format-Namen
aFld.ChangeFormat( CheckNumberFmtStr( aSaveStr ));
}
- pDoc->Insert( *pPam, SwFmtFld( aFld ), 0 );
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0 );
SkipGroup();
}
break;
@@ -469,7 +469,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
// steht jetzt geanu auf dem Format-Namen
aPF.ChangeFormat( CheckNumberFmtStr( aSaveStr ));
}
- pDoc->Insert( *pPam, SwFmtFld( aPF ), 0 );
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( aPF ), 0 );
SkipGroup(); // ueberlese den Rest
}
break;
@@ -480,8 +480,8 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
{
// es fehlt die Format - Angabe: defaulten auf Datum
pFldType = pDoc->GetSysFldType( RES_DATETIMEFLD );
- pDoc->Insert( *pPam, SwFmtFld( SwDateTimeField(
- (SwDateTimeFieldType*)pFldType, DATEFLD )), 0);
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( SwDateTimeField(
+ static_cast<SwDateTimeFieldType*>(pFldType), DATEFLD)), 0);
}
else
{
@@ -524,7 +524,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
if( pFld )
{
- pDoc->Insert( *pPam, SwFmtFld( *pFld ), 0);
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( *pFld ), 0);
delete pFld;
}
}
@@ -553,8 +553,8 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
if( bField )
{
pFldType = pDoc->GetSysFldType( RES_DBNAMEFLD );
- pDoc->Insert( *pPam, SwFmtFld( SwDBNameField(
- (SwDBNameFieldType*)pFldType, SwDBData() ) ), 0);
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( SwDBNameField(
+ static_cast<SwDBNameFieldType*>(pFldType), SwDBData())), 0);
}
else
pDoc->ChgDBData( aData ); // MS: Keine DBInfo verwenden
@@ -569,7 +569,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
SwDBField aDBFld( (SwDBFieldType*)pDoc->InsertFldType( aTmp ));
aDBFld.ChangeFormat( UF_STRING );
- pDoc->Insert( *pPam, SwFmtFld( aDBFld ), 0);
+ pDoc->InsertPoolItem(*pPam, SwFmtFld( aDBFld ), 0);
SkipGroup(); // ueberlese den Rest
}
break;
@@ -598,7 +598,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
sal_Unicode nChar = (sal_Unicode)sParam.ToInt32();
if( nChar )
{
- pDoc->Insert( *pPam, nChar );
+ pDoc->InsertString( *pPam, nChar );
bCharIns = TRUE;
}
}
@@ -708,8 +708,8 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
{
//Make a guess at which of asian of western we should be setting
USHORT nScript;
- if (pBreakIt->xBreak.is())
- nScript = pBreakIt->xBreak->getScriptType( aData.sUp, 0);
+ if (pBreakIt->GetBreakIter().is())
+ nScript = pBreakIt->GetBreakIter()->getScriptType( aData.sUp, 0);
else
nScript = i18n::ScriptType::ASIAN;
@@ -763,10 +763,11 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
aRuby.SetAdjustment( (USHORT)aData.nJustificationCode );
// im FieldStr steht der anzuzeigenden Text, im
- pDoc->Insert( *pPam, aData.sText, true );
+ pDoc->InsertString( *pPam, aData.sText );
pPam->SetMark();
pPam->GetMark()->nContent -= aData.sText.Len();
- pDoc->Insert( *pPam, aRuby, nsSetAttrMode::SETATTR_DONTEXPAND );
+ pDoc->InsertPoolItem( *pPam, aRuby,
+ nsSetAttrMode::SETATTR_DONTEXPAND );
pPam->DeleteMark();
}
// or a combined character field?
@@ -778,7 +779,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
sFld += aData.sDown;
SwCombinedCharField aFld((SwCombinedCharFieldType*)pDoc->
GetSysFldType( RES_COMBINED_CHARS ), sFld );
- pDoc->Insert( *pPam, SwFmtFld( aFld ), 0);
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0);
}
SkipGroup(); // ueberlese den Rest
@@ -808,7 +809,9 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
sOrigBkmName,REF_BOOKMARK,0,REF_PAGE);
if(!bNestedField)
- pDoc->Insert( *pPam, SwFmtFld( aFld ), 0 );
+ {
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0 );
+ }
else
bNestedField = false;
}
@@ -850,14 +853,14 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
SwGetRefField aFld(
(SwGetRefFieldType*)pDoc->GetSysFldType( RES_GETREFFLD ),
sOrigBkmName,REF_BOOKMARK,0,REF_CHAPTER);
- pDoc->Insert( *pPam, SwFmtFld( aFld ), 0 );
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0 );
}
else
{
SwGetRefField aFld(
(SwGetRefFieldType*)pDoc->GetSysFldType( RES_GETREFFLD ),
sOrigBkmName,REF_BOOKMARK,0,REF_CONTENT);
- pDoc->Insert( *pPam, SwFmtFld( aFld ), 0 );
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( aFld ), 0 );
}
}
@@ -866,7 +869,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
SwGetRefField aFld( (SwGetRefFieldType*)
pDoc->GetSysFldType( RES_GETREFFLD ), sOrigBkmName, REF_BOOKMARK, 0,
REF_UPDOWN );
- pDoc->Insert(*pPam, SwFmtFld(aFld), 0);
+ pDoc->InsertPoolItem(*pPam, SwFmtFld(aFld), 0);
}
}
break;
@@ -882,7 +885,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
SwUserFieldType aTmp( pDoc, aSaveStr );
SwUserField aUFld( (SwUserFieldType*)pDoc->InsertFldType( aTmp ));
aUFld.ChangeFormat( UF_STRING );
- pDoc->Insert( *pPam, SwFmtFld( aUFld ), 0);
+ pDoc->InsertPoolItem( *pPam, SwFmtFld( aUFld ), 0);
nRet = RTFFLD_UNKNOWN;
}
break;
@@ -1045,7 +1048,8 @@ void SwRTFParser::ReadField()
// FieldResult wurde eingelesen
if (SwTxtNode* pTxtNd = pPam->GetPoint()->nNode.GetNode().GetTxtNode())
{
- SwTxtAttr* pFldAttr = pTxtNd->GetTxtAttr(
+ SwTxtAttr* const pFldAttr =
+ pTxtNd->GetTxtAttrForCharAt(
pPam->GetPoint()->nContent.GetIndex()-1 );
if (pFldAttr)
@@ -1078,7 +1082,7 @@ void SwRTFParser::ReadField()
sNestedFieldStr.Erase();
// im FieldStr steht der anzuzeigenden Text, im
- pDoc->Insert( *pPam, sFieldStr, true );
+ pDoc->InsertString( *pPam, sFieldStr );
String sTarget( sFieldNm.GetToken( 1, '\1' ));
if( sTarget.Len() )
@@ -1087,7 +1091,7 @@ void SwRTFParser::ReadField()
// oder ueber den Stack setzen??
pPam->SetMark();
pPam->GetMark()->nContent -= sFieldStr.Len();
- pDoc->Insert( *pPam,
+ pDoc->InsertPoolItem( *pPam,
SwFmtINetFmt( sFieldNm, sTarget ),
nsSetAttrMode::SETATTR_DONTEXPAND );
pPam->DeleteMark();
diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx
index e4f1adc8850c..e4043f2e8529 100644
--- a/sw/source/filter/rtf/rtffly.cxx
+++ b/sw/source/filter/rtf/rtffly.cxx
@@ -396,7 +396,8 @@ void SwRTFParser::SetFlysInDoc()
}
}
aTmpIdx = *pSttNd->EndOfSectionNode();
- pDoc->Move( aRg, aTmpIdx, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ pDoc->MoveNodeRange( aRg, aTmpIdx,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
}
// patch from cmc for #i52542#
@@ -1174,7 +1175,7 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
{
SwTxtNode* pTxtNd = pFlySave->nSttNd.GetNode().GetTxtNode();
- SwTxtFlyCnt* pFlyCnt;
+ SwTxtFlyCnt* pFlyCnt = 0;
if( 1 == pTxtNd->GetTxt().Len() &&
0 != ( pFlyCnt = (SwTxtFlyCnt*)pTxtNd->GetTxtAttr(
0, RES_TXTATR_FLYCNT )) &&
@@ -1232,7 +1233,8 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
(SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
SwNodeIndex aTmp( pFlySave->nSttNd, +1 );
- pDoc->Move( aRg, aTmp, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ pDoc->MoveNodeRange( aRg, aTmp,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
// now delete the redundant txtnode
pDoc->GetNodes().Delete( pFlySave->nSttNd, 1 );
diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx
index 736bbf3d750b..4fd06a26925f 100644
--- a/sw/source/filter/rtf/rtftbl.cxx
+++ b/sw/source/filter/rtf/rtftbl.cxx
@@ -851,7 +851,8 @@ void SwRTFParser::ReadTable( int nToken )
//table
aRg.SetMark();
aRg.GetMark()->nContent.Assign(aRg.GetCntntNode(), 0);
- pDoc->Move(aRg, *pPam->GetPoint(), IDocumentContentOperations::DOC_MOVEDEFAULT);
+ pDoc->MoveRange(aRg, *pPam->GetPoint(),
+ IDocumentContentOperations::DOC_MOVEDEFAULT);
}
//Update the attribute stack entries to reflect that the properties
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index daa881ba0d1f..9b5b90a01641 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -55,7 +55,6 @@
#include <svx/hyznitem.hxx>
#include <fmtpdsc.hxx>
#include <fmtfld.hxx>
-#include <fmthbsh.hxx>
#include <fmthdft.hxx>
#include <fmtcntnt.hxx>
#include <txtftn.hxx>
@@ -449,7 +448,6 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() )
for (rtfSections::myrDummyIter aI = maSegments.maDummyPageNos.rbegin(); aI != aDEnd; ++aI)
pDoc->DelPageDesc(*aI);
-
if( aFlyArr.Count() )
SetFlysInDoc();
@@ -852,7 +850,8 @@ SwSectionFmt *rtfSections::InsertSection(SwPaM& rMyPaM, rtfSection &rSection)
aSet.Put(SvxFrameDirectionItem(
nRTLPgn ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
- rSection.mpSection = mrReader.pDoc->Insert( rMyPaM, aSection, &aSet );
+ rSection.mpSection =
+ mrReader.pDoc->InsertSwSection( rMyPaM, aSection, &aSet );
ASSERT(rSection.mpSection, "section not inserted!");
if (!rSection.mpSection)
return 0;
@@ -1003,7 +1002,7 @@ void rtfSections::InsertSegments(bool bNewDoc)
aIter->maStart.GetNode().GetCntntNode(), 0);
SwPaM aPage(aPamStart);
- mrReader.pDoc->Insert(aPage, aPgDesc, 0);
+ mrReader.pDoc->InsertPoolItem(aPage, aPgDesc, 0);
}
++nDesc;
}
@@ -1824,7 +1823,8 @@ void SwRTFParser::NextToken( int nToken )
if (lcl_UsedPara(*pPam))
InsertPara();
CheckInsNewTblLine();
- pDoc->Insert(*pPam, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0);
+ pDoc->InsertPoolItem(*pPam,
+ SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0);
}
break;
@@ -1976,12 +1976,13 @@ void SwRTFParser::NextToken( int nToken )
&const_cast<const SwDoc *>(pDoc)
->GetPageDesc( USHORT(nTokenValue) );
CheckInsNewTblLine();
- pDoc->Insert( *pPam, SwFmtPageDesc( pPgDsc ), 0);
+ pDoc->InsertPoolItem(*pPam, SwFmtPageDesc( pPgDsc ), 0);
}
break;
case RTF_COLUM:
- pDoc->Insert( *pPam, SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0);
+ pDoc->InsertPoolItem(*pPam,
+ SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0);
break;
case RTF_DXFRTEXT: // werden nur im Zusammenhang mit Flys ausgewertet
@@ -2001,7 +2002,7 @@ SETCHDATEFIELD:
SwDateTimeField aDateFld( (SwDateTimeFieldType*)
pDoc->GetSysFldType( RES_DATETIMEFLD ), DATEFLD, nFormat);
CheckInsNewTblLine();
- pDoc->Insert( *pPam, SwFmtFld( aDateFld ), 0);
+ pDoc->InsertPoolItem(*pPam, SwFmtFld( aDateFld ), 0);
}
break;
@@ -2013,7 +2014,7 @@ SETCHDATEFIELD:
SwDateTimeField aTimeFld( (SwDateTimeFieldType*)
pDoc->GetSysFldType( RES_DATETIMEFLD ), TIMEFLD, nFormat);
CheckInsNewTblLine();
- pDoc->Insert( *pPam, SwFmtFld( aTimeFld ), 0);
+ pDoc->InsertPoolItem(*pPam, SwFmtFld( aTimeFld ), 0);
}
break;
@@ -2023,7 +2024,7 @@ SETCHDATEFIELD:
pDoc->GetSysFldType( RES_PAGENUMBERFLD ),
PG_RANDOM, SVX_NUM_ARABIC );
CheckInsNewTblLine();
- pDoc->Insert( *pPam, SwFmtFld( aPageFld), 0);
+ pDoc->InsertPoolItem(*pPam, SwFmtFld(aPageFld), 0);
}
break;
@@ -2053,7 +2054,7 @@ SETCHDATEFIELD:
CheckInsNewTblLine();
if( nTokenValue )
aToken = (sal_Unicode )nTokenValue;
- pDoc->Insert( *pPam, aToken, true );
+ pDoc->InsertString( *pPam, aToken );
}
break;
@@ -2119,7 +2120,7 @@ void SwRTFParser::InsertText()
if(pRedlineDelete)
mpRedlineStack->open(*pPam->GetPoint(), *pRedlineDelete);
- pDoc->Insert( *pPam, aToken, true );
+ pDoc->InsertString( *pPam, aToken );
if(pRedlineDelete)
{
@@ -2283,14 +2284,15 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
}
} while( 0 != (pStyle = GetStyleTbl().Next()) );
- pDoc->Insert(aPam, *pCharFmt, 0);
+ pDoc->InsertPoolItem(aPam, *pCharFmt, 0);
rSet.GetAttrSet().ClearItem(RES_TXTATR_CHARFMT); //test hack
}
if (rSet.GetAttrSet().Count())
{
// dann setze ueber diesen Bereich die Attrbiute
SetSwgValues(rSet.GetAttrSet());
- pDoc->Insert(aPam, rSet.GetAttrSet(), nsSetAttrMode::SETATTR_DONTCHGNUMRULE);
+ pDoc->InsertItemSet(aPam, rSet.GetAttrSet(),
+ nsSetAttrMode::SETATTR_DONTCHGNUMRULE);
}
}
@@ -2452,7 +2454,7 @@ void SwRTFParser::SetPageInformationAsDefault(const DocPageInformation &rInfo)
{
SwFmtPageDesc aPgDsc( &rPg );
aPgDsc.SetNumOffset( nPgStart );
- pDoc->Insert( *pPam, aPgDsc, 0 );
+ pDoc->InsertPoolItem( *pPam, aPgDsc, 0 );
}
}
}
@@ -3711,7 +3713,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
aSet.Put( SwFmtAnchor( FLY_IN_CNTNT ));
pHdFtFmt = pDoc->MakeFlySection( FLY_IN_CNTNT, pPam->GetPoint(), &aSet );
- pTxtAttr = pPam->GetNode()->GetTxtNode()->GetTxtAttr(
+ pTxtAttr = pPam->GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
nPos, RES_TXTATR_FLYCNT );
ASSERT( pTxtAttr, "konnte den Fly nicht einfuegen/finden" );
@@ -4297,7 +4299,7 @@ void SwRTFParser::UnknownAttrToken( int nToken, SfxItemSet* pSet )
{
const SwPageDesc* pPgDsc = &const_cast<const SwDoc *>(pDoc)
->GetPageDesc( (USHORT)nTokenValue );
- pDoc->Insert( *pPam, SwFmtPageDesc( pPgDsc ), 0);
+ pDoc->InsertPoolItem( *pPam, SwFmtPageDesc( pPgDsc ), 0);
}
break;
case RTF_CS:
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 7283bdcbab1f..4b2ab6e086a2 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -340,10 +340,6 @@ ULONG Writer::Write( SwPaM& rPam, SfxMedium& rMed, const String* pFileName )
// This method must be overloaded in SwXMLWriter a storage from medium will be used there.
// The microsoft format can write to storage but the storage will be based on the stream.
return Write( rPam, *rMed.GetOutStream(), pFileName );
-
- // return IsStgWriter()
- // ? Write( rPam, rMed.GetStorage(), pFileName )
- // : Write( rPam, *rMed.GetOutStream(), pFileName );
}
ULONG Writer::Write( SwPaM& /*rPam*/, SvStorage&, const String* )
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index a25d1b39f705..822091cec765 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -492,7 +492,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
{
// XRefs und Bookmarks sind bereits geUpcased
MakeBookRegionOrPoint(pEntry, pDoc, aRegion, TRUE);
- pDoc->Insert(aRegion, SwFmtRefMark(rName), 0);
+ pDoc->InsertPoolItem(aRegion, SwFmtRefMark(rName), 0);
}
else if( !pB->IsOnlyRef() )
{
@@ -506,7 +506,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
pB->GetValSys());
aFld.SetSubType( nsSwExtendedSubType::SUB_INVISIBLE );
MakePoint(pEntry, pDoc, aRegion);
- pDoc->Insert(aRegion, SwFmtFld(aFld), 0);
+ pDoc->InsertPoolItem(aRegion, SwFmtFld(aFld), 0);
MoveAttrs( *(aRegion.GetPoint()) );
}
}
@@ -564,8 +564,9 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
break;
case RES_FLTR_SECTION:
MakePoint(pEntry, pDoc, aRegion); // bislang immer Point==Mark
- pDoc->Insert(aRegion, *((SwFltSection*)pEntry->pAttr)->GetSection(),
- 0, FALSE);
+ pDoc->InsertSwSection(aRegion,
+ *(static_cast<SwFltSection*>(pEntry->pAttr))->GetSection(),
+ 0, false);
delete(((SwFltSection*)pEntry->pAttr)->GetSection());
break;
case RES_FLTR_REDLINE:
@@ -602,7 +603,9 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
break;
default:
if (pEntry->MakeRegion(pDoc, aRegion, FALSE))
- pDoc->Insert(aRegion, *pEntry->pAttr, 0);
+ {
+ pDoc->InsertPoolItem(aRegion, *pEntry->pAttr, 0);
+ }
break;
}
}
@@ -1006,7 +1009,7 @@ SwFltShell::~SwFltShell()
SwFltShell& SwFltShell::operator << ( const String& rStr )
{
ASSERT(eSubMode != Style, "char insert while in style-mode");
- GetDoc().Insert( *pPaM, rStr, true );
+ GetDoc().InsertString( *pPaM, rStr );
return *this;
}
@@ -1043,7 +1046,7 @@ String SwFltShell::QuoteStr( const String& rIn )
SwFltShell& SwFltShell::operator << ( const sal_Unicode c )
{
ASSERT( eSubMode != Style, "char insert while in style-mode");
- GetDoc().Insert( *pPaM, c );
+ GetDoc().InsertString( *pPaM, c );
return *this;
}
@@ -1060,7 +1063,7 @@ SwFltShell& SwFltShell::AddError( const sal_Char* pErr )
SwSetExpField aFld( (SwSetExpFieldType*)pFT,
String::CreateFromAscii( pErr ));
//, VVF_INVISIBLE
- GetDoc().Insert(*pPaM, SwFmtFld(aFld), 0);
+ GetDoc().InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
return *this;
}
@@ -1079,7 +1082,8 @@ void SwFltShell::NextParagraph()
void SwFltShell::NextPage()
{
NextParagraph();
- GetDoc().Insert(*pPaM, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0);
+ GetDoc().InsertPoolItem(*pPaM,
+ SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0);
}
SwFltShell& SwFltShell::AddGraphic( const String& rPicName )
@@ -1170,7 +1174,7 @@ SwFltShell& SwFltShell::EndItem( USHORT nAttrId )
SwFltShell& SwFltShell::operator << (const SwField& rField)
{
- GetDoc().Insert(*pPaM, SwFmtFld(rField), 0);
+ GetDoc().InsertPoolItem(*pPaM, SwFmtFld(rField), 0);
return *this;
}
@@ -1931,7 +1935,7 @@ void SwFltShell::BeginFootnote()
// Fussnoten im PMW uebernommen werden
SwFmtFtn aFtn;
- GetDoc().Insert(*pPaM, aFtn, 0);
+ GetDoc().InsertPoolItem(*pPaM, aFtn, 0);
ASSERT(pSavedPos == NULL, "SwFltShell");
pSavedPos = new SwPosition(*pPaM->GetPoint());
pPaM->Move(fnMoveBackward, fnGoCntnt);
@@ -2031,7 +2035,9 @@ SwPageDesc* SwFltShell::MakePageDesc(SwPageDesc* pFirstPageDesc)
pNewPD->SetFollow(pNewPD);
}
else
- GetDoc().Insert( *pPaM, SwFmtPageDesc( pNewPD ), 0 );
+ {
+ GetDoc().InsertPoolItem( *pPaM, SwFmtPageDesc( pNewPD ), 0 );
+ }
pNewPD->WriteUseOn( // alle Seiten
(UseOnPage)(nsUseOnPage::PD_ALL | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE));
return pNewPD;
diff --git a/sw/source/filter/ww8/WW8FibData.cxx b/sw/source/filter/ww8/WW8FibData.cxx
new file mode 100644
index 000000000000..fdf54c25b216
--- /dev/null
+++ b/sw/source/filter/ww8/WW8FibData.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:$
+ * $Revision:$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
+#include "WW8FibData.hxx"
+
+namespace ww8
+{
+WW8FibData::WW8FibData()
+ : m_bReadOnlyRecommended(false),
+ m_bWriteReservation(false)
+{
+}
+
+WW8FibData::~WW8FibData()
+{
+}
+
+void WW8FibData::setReadOnlyRecommended(bool bReadOnlyRecommended)
+{
+ m_bReadOnlyRecommended = bReadOnlyRecommended;
+}
+
+void WW8FibData::setWriteReservation(bool bWriteReservation)
+{
+ m_bWriteReservation = bWriteReservation;
+}
+
+bool WW8FibData::getReadOnlyRecommended() const
+{
+ return m_bReadOnlyRecommended;
+}
+
+bool WW8FibData::getWriteReservation() const
+{
+ return m_bWriteReservation;
+}
+}
diff --git a/sw/source/filter/ww8/WW8FibData.hxx b/sw/source/filter/ww8/WW8FibData.hxx
new file mode 100644
index 000000000000..597ab16a7ad5
--- /dev/null
+++ b/sw/source/filter/ww8/WW8FibData.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:$
+ * $Revision:$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+#ifndef INCLUDED_WW8_FIB_DATA_HXX
+#define INCLUDED_WW8_FIB_DATA_HXX
+#include <IDocumentExternalData.hxx>
+
+namespace ww8
+{
+class WW8FibData : public ::sw::ExternalData
+{
+ bool m_bReadOnlyRecommended;
+ bool m_bWriteReservation;
+
+public:
+ WW8FibData();
+ virtual ~WW8FibData();
+
+ void setReadOnlyRecommended(bool bReadOnlyRecommended);
+ void setWriteReservation(bool bWriteReservation);
+
+ bool getReadOnlyRecommended() const;
+ bool getWriteReservation() const;
+};
+}
+
+#endif // INCLUDED_WW8_FIB_DATA_HXX
diff --git a/sw/source/filter/ww8/WW8Sttbf.cxx b/sw/source/filter/ww8/WW8Sttbf.cxx
new file mode 100644
index 000000000000..b03ec823292f
--- /dev/null
+++ b/sw/source/filter/ww8/WW8Sttbf.cxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ww8par2.hxx,v $
+ * $Revision: 1.47.214.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
+#include <iostream>
+#include <dbgoutsw.hxx>
+#include "WW8Sttbf.hxx"
+
+namespace ww8
+{
+ WW8Struct::WW8Struct(SvStream& rSt, sal_uInt32 nPos, sal_uInt32 nSize)
+ : mn_offset(0), mn_size(nSize)
+ {
+ rSt.Seek(nPos);
+
+ mp_data.reset(new BYTE[nSize]);
+ rSt.Read(mp_data.get(), nSize);
+ }
+
+ WW8Struct::WW8Struct(WW8Struct * pStruct, sal_uInt32 nPos, sal_uInt32 nSize)
+ : mp_data(pStruct->mp_data), mn_offset(pStruct->mn_offset + nPos),
+ mn_size(nSize)
+ {
+ }
+
+ WW8Struct::~WW8Struct()
+ {
+ }
+
+ sal_uInt8 WW8Struct::getU8(sal_uInt32 nOffset)
+ {
+ sal_uInt8 nResult = 0;
+
+ if (nOffset < mn_size)
+ {
+ nResult = mp_data[mn_offset + nOffset];
+ }
+
+ return nResult;
+ }
+
+ ::rtl::OUString WW8Struct::getUString(sal_uInt32 nOffset,
+ sal_uInt32 nCount)
+ {
+ ::rtl::OUString aResult;
+
+ if (nCount > 0)
+ {
+ rtl_uString * pNew = 0;
+ rtl_uString_newFromStr_WithLength
+ (&pNew, reinterpret_cast<const sal_Unicode *>(&mp_data[mn_offset + nOffset]),
+ nCount);
+
+ aResult = rtl::OUString(pNew);
+ }
+
+#ifdef DEBUG
+ char sBuffer[256];
+ snprintf(sBuffer, sizeof(sBuffer), "offset=\"%" SAL_PRIuUINT32 "\" count=\"%" SAL_PRIuUINT32 "\"",
+ nOffset, nCount);
+ ::std::clog << "<WW8Struct-getUString" << sBuffer << ">"
+ << dbg_out(aResult) << "</WW8Struct-getUString>"
+ << ::std::endl;
+#endif
+
+ return aResult;
+
+ }
+
+ ::rtl::OUString WW8Struct::getString(sal_uInt32 nOffset,
+ sal_uInt32 nCount)
+ {
+ ::rtl::OUString aResult;
+
+ if (nCount > 0)
+ {
+ ::rtl::OString aOStr(reinterpret_cast<const sal_Char *>(&mp_data[mn_offset + nOffset]),
+ nCount);
+ ::rtl::OUString aOUStr(rtl::OStringToOUString(aOStr, RTL_TEXTENCODING_ASCII_US));
+ aResult = rtl::OUString(aOUStr);
+ }
+
+#ifdef DEBUG
+ char sBuffer[256];
+ snprintf(sBuffer, sizeof(sBuffer), "offset=\"%" SAL_PRIuUINT32 "\" count=\"%" SAL_PRIuUINT32 "\"",
+ nOffset, nCount);
+ ::std::clog << "<WW8Struct-getString " << sBuffer << ">"
+ << dbg_out(aResult) << "</WW8Struct-getUString>"
+ << ::std::endl;
+#endif
+
+ return aResult;
+ }
+}
diff --git a/sw/source/filter/ww8/WW8Sttbf.hxx b/sw/source/filter/ww8/WW8Sttbf.hxx
new file mode 100644
index 000000000000..cb3c43cee86c
--- /dev/null
+++ b/sw/source/filter/ww8/WW8Sttbf.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ww8par2.hxx,v $
+ * $Revision: 1.47.214.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include <tools/solar.h>
+#include <rtl/ustring.hxx>
+#include <tools/stream.hxx>
+#include <IDocumentExternalData.hxx>
+
+namespace ww8
+{
+ typedef boost::shared_array<BYTE> DataArray_t;
+
+class WW8Struct : public ::sw::ExternalData
+ {
+ DataArray_t mp_data;
+ sal_uInt32 mn_offset;
+ sal_uInt32 mn_size;
+
+ public:
+ WW8Struct(SvStream& rSt, sal_uInt32 nPos, sal_uInt32 nSize);
+ WW8Struct(WW8Struct * pStruct, sal_uInt32 nPos, sal_uInt32 nSize);
+ virtual ~WW8Struct();
+
+ sal_uInt8 getU8(sal_uInt32 nOffset);
+
+ sal_uInt16 getU16(sal_uInt32 nOffset)
+ { return getU8(nOffset) + (getU8(nOffset + 1) << 8); }
+
+ sal_uInt32 getU32(sal_uInt32 nOffset)
+ { return getU16(nOffset) + (getU16(nOffset + 1) << 16); }
+
+ ::rtl::OUString getUString(sal_uInt32 nOffset, sal_uInt32 nCount);
+
+ ::rtl::OUString getString(sal_uInt32 nOffset, sal_uInt32 nCount);
+ };
+
+typedef ::std::vector<rtl::OUString> StringVector_t;
+ template <class T>
+ class WW8Sttb : public WW8Struct
+ {
+ typedef ::boost::shared_ptr< void > ExtraPointer_t;
+ typedef ::std::vector< ExtraPointer_t > ExtrasVector_t;
+ bool bDoubleByteCharacters;
+ StringVector_t m_Strings;
+ ExtrasVector_t m_Extras;
+
+ public:
+ WW8Sttb(SvStream& rSt, INT32 nPos, sal_uInt32 nSize);
+ virtual ~WW8Sttb();
+
+ sal_uInt32 getCount() const;
+ ::rtl::OUString getEntry(sal_uInt32 nEntry) const
+ {
+ return m_Strings[nEntry];
+ }
+
+ StringVector_t & getStrings()
+ {
+ return m_Strings;
+ }
+
+ const T * getExtra(sal_uInt32 nEntry) const
+ {
+ return dynamic_cast<const T *> (m_Extras[nEntry].get());
+ }
+ };
+
+ template <class T>
+ WW8Sttb<T>::WW8Sttb(SvStream& rSt, INT32 nPos, sal_uInt32 nSize)
+ : WW8Struct(rSt, nPos, nSize), bDoubleByteCharacters(false)
+ {
+ sal_uInt32 nOffset = 0;
+
+ if (getU16(nOffset) == 0xffff)
+ {
+ bDoubleByteCharacters = true;
+ nOffset += 2;
+ }
+
+ sal_uInt16 nCount = getU16(nOffset);
+ sal_uInt16 ncbExtra = getU16(nOffset + 2);
+
+ nOffset += 4;
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ if (bDoubleByteCharacters)
+ {
+ sal_uInt16 nStrLen = getU16(nOffset);
+
+ m_Strings.push_back(getUString(nOffset +2, nStrLen));
+
+ nOffset += 2 + 2 * nStrLen;
+ }
+ else
+ {
+ sal_uInt8 nStrLen = getU8(nOffset);
+
+ m_Strings.push_back(getUString(nOffset, nStrLen));
+
+ nOffset += 1 + nStrLen;
+ }
+
+ if (ncbExtra > 0)
+ {
+ ExtraPointer_t pExtra(new T(this, nOffset, ncbExtra));
+ m_Extras.push_back(pExtra);
+
+ nOffset += ncbExtra;
+ }
+ }
+ }
+
+ template <class T>
+ WW8Sttb<T>::~WW8Sttb()
+ {
+ }
+}
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 98f2f6074349..499cc59e132a 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -449,9 +449,6 @@ protected:
/// Sfx item RES_TXTATR_FTN
virtual void TextFootnote_Impl( const SwFmtFtn& ) = 0;
- /// Sfx item RES_TXTATR_HARDBLANK
- virtual void TextHardBlank( const SwFmtHardBlank& ) = 0;
-
/// Sfx item RES_PARATR_LINESPACING
void ParaLineSpacing( const SvxLineSpacingItem& );
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 537a881f76ad..0eb0284a701e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2776,13 +2776,6 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
}
-void DocxAttributeOutput::TextHardBlank( const SwFmtHardBlank& )
-{
-#if OSL_DEBUG_LEVEL > 0
- fprintf( stderr, "TODO DocxAttributeOutput::TextHardBlank()\n" );
-#endif
-}
-
void DocxAttributeOutput::ParaLineSpacing_Impl( short nSpace, short /*nMulti*/ )
{
if ( !m_pSpacingAttrList )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 71b1a452f440..a84c0f40284c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -434,9 +434,6 @@ protected:
/// Output the footnote/endnote reference (if there's one to output).
void FootnoteEndnoteReference();
- /// Sfx item RES_TXTATR_HARDBLANK
- virtual void TextHardBlank( const SwFmtHardBlank& );
-
/// Sfx item RES_PARATR_LINESPACING
virtual void ParaLineSpacing_Impl( short nSpace, short nMulti );
diff --git a/sw/source/filter/ww8/makefile.mk b/sw/source/filter/ww8/makefile.mk
index 6697ceaec4b1..164a8fef28d6 100644
--- a/sw/source/filter/ww8/makefile.mk
+++ b/sw/source/filter/ww8/makefile.mk
@@ -69,7 +69,9 @@ EXCEPTIONSFILES = \
$(SLO)$/writerwordglue.obj \
$(SLO)$/ww8scan.obj \
$(SLO)$/WW8TableInfo.obj \
- $(SLO)$/WW8FFData.obj
+ $(SLO)$/WW8FFData.obj \
+ $(SLO)$/WW8Sttbf.obj \
+ $(SLO)$/WW8FibData.obj
SLOFILES = \
@@ -96,7 +98,9 @@ SLOFILES = \
$(SLO)$/writerhelper.obj \
$(SLO)$/writerwordglue.obj \
$(SLO)$/WW8TableInfo.obj \
- $(SLO)$/WW8FFData.obj
+ $(SLO)$/WW8FFData.obj \
+ $(SLO)$/WW8Sttbf.obj \
+ $(SLO)$/WW8FibData.obj
# --- Tagets -------------------------------------------------------
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 17f854eaa1d6..fb197163e226 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -548,8 +548,8 @@ namespace sw
using namespace ::com::sun::star::i18n;
sal_uInt16 nScript = i18n::ScriptType::LATIN;
- if (rTxt.Len() && pBreakIt && pBreakIt->xBreak.is())
- nScript = pBreakIt->xBreak->getScriptType(rTxt, 0);
+ if (rTxt.Len() && pBreakIt && pBreakIt->GetBreakIter().is())
+ nScript = pBreakIt->GetBreakIter()->getScriptType(rTxt, 0);
rtl_TextEncoding eChrSet = ItemGet<SvxFontItem>(rTxtNd,
GetWhichOfScript(RES_CHRATR_FONT, nScript)).GetCharSet();
@@ -635,20 +635,20 @@ namespace sw
using sw::types::writer_cast;
- if (pBreakIt && pBreakIt->xBreak.is())
+ if (pBreakIt && pBreakIt->GetBreakIter().is())
{
xub_StrLen nLen = rTxt.Len();
xub_StrLen nPos = 0;
while (nPos < nLen)
{
- sal_Int32 nEnd2 = pBreakIt->xBreak->endOfScript(rTxt, nPos,
+ sal_Int32 nEnd2 = pBreakIt->GetBreakIter()->endOfScript(rTxt, nPos,
nScript);
if (nEnd2 < 0)
break;
// nPos = writer_cast<xub_StrLen>(nEnd2);
nPos = static_cast< xub_StrLen >(nEnd2);
aScripts.push_back(ScriptEntry(nPos, nScript));
- nScript = pBreakIt->xBreak->getScriptType(rTxt, nPos);
+ nScript = pBreakIt->GetBreakIter()->getScriptType(rTxt, nPos);
}
}
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 03b4e52c2c6f..5bb1ffc557b7 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -884,8 +884,8 @@ void WW8_SdrAttrIter::NextPara( USHORT nPar )
pEditPool = aSet.GetPool();
eNdChrSet = ItemGet<SvxFontItem>(aSet,EE_CHAR_FONTINFO).GetCharSet();
- if( pBreakIt->xBreak.is() )
- nScript = pBreakIt->xBreak->getScriptType( pEditObj->GetText(nPara), 0);
+ if( pBreakIt->GetBreakIter().is() )
+ nScript = pBreakIt->GetBreakIter()->getScriptType( pEditObj->GetText(nPara), 0);
else
nScript = i18n::ScriptType::LATIN;
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index d42a389e3704..2cbbb7943f37 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -344,9 +344,9 @@ xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos )
if( nPos >= nStartPos && nPos <= nMinPos )
nMinPos = nPos;
}
- else
+ if (pHt->HasDummyChar())
{
- // Attr ohne Ende Laenge 1 wegen CH_TXTATR im Text
+ // pos + 1 because of CH_TXTATR in Text
nPos = *pHt->GetStart() + 1;
if( nPos >= nStartPos && nPos <= nMinPos )
nMinPos = nPos;
@@ -545,13 +545,13 @@ void SwAttrIter::OutFlys(xub_StrLen nSwPos)
bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
{
- // search for attrs without end position
+ // search for attrs with CH_TXTATR
if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
{
for (USHORT i = 0; i < pTxtAttrs->Count(); ++i)
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
- if( !pHt->GetEnd() && *pHt->GetStart() == nSwPos )
+ if ( pHt->HasDummyChar() && (*pHt->GetStart() == nSwPos) )
return true;
}
}
@@ -670,15 +670,15 @@ void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRu
aStr += String::CreateFromInt32( nJC );
/*
- MS needs to know the name and size of the font used in the ruby item,
- but we coud have written it in a mixture of asian and western
- scripts, and each of these can be a different font and size than the
- other, so we make a guess based upon the first character of the text,
- defaulting to asian.
- */
+ MS needs to know the name and size of the font used in the ruby item,
+ but we coud have written it in a mixture of asian and western
+ scripts, and each of these can be a different font and size than the
+ other, so we make a guess based upon the first character of the text,
+ defaulting to asian.
+ */
USHORT nRubyScript;
- if ( pBreakIt->xBreak.is() )
- nRubyScript = pBreakIt->xBreak->getScriptType( rRuby.GetText(), 0);
+ if( pBreakIt->GetBreakIter().is() )
+ nRubyScript = pBreakIt->GetBreakIter()->getScriptType( rRuby.GetText(), 0);
else
nRubyScript = i18n::ScriptType::ASIAN;
@@ -726,8 +726,8 @@ void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRu
aStr.APPEND_CONST_ASC( "(\\s\\up " );
- if ( pBreakIt->xBreak.is() )
- nRubyScript = pBreakIt->xBreak->getScriptType( rNode.GetTxt(),
+ if ( pBreakIt->GetBreakIter().is() )
+ nRubyScript = pBreakIt->GetBreakIter()->getScriptType( rNode.GetTxt(),
*( pRubyTxt->GetStart() ) );
else
nRubyScript = i18n::ScriptType::ASIAN;
@@ -1409,8 +1409,8 @@ String SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
if (SVX_CASEMAP_TITEL == ((const SvxCaseMapItem&)rItem).GetValue())
{
sal_uInt16 nScriptType = i18n::ScriptType::LATIN;
- if (pBreakIt->xBreak.is())
- nScriptType = pBreakIt->xBreak->getScriptType(aSnippet, 0);
+ if (pBreakIt->GetBreakIter().is())
+ nScriptType = pBreakIt->GetBreakIter()->getScriptType(aSnippet, 0);
LanguageType nLanguage;
switch (nScriptType)
@@ -1435,7 +1435,7 @@ String SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
//If we weren't at the begin of a word undo the case change.
//not done before doing the casemap because the sequence might start
//with whitespace
- if (pBreakIt->xBreak.is() && !pBreakIt->xBreak->isBeginWord(
+ if (pBreakIt->GetBreakIter().is() && !pBreakIt->GetBreakIter()->isBeginWord(
rStr, nAktPos, pBreakIt->GetLocale(nLanguage),
i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
{
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index c7c627a12271..6601f874c60f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -117,6 +117,8 @@
#include <svx/mscodec.hxx>
#include <osl/time.h>
#include <rtl/random.h>
+#include "WW8Sttbf.hxx"
+#include "WW8FibData.hxx"
using namespace sw::util;
using namespace sw::types;
@@ -2416,9 +2418,7 @@ void WW8Export::SectionBreaksAndFrames( const SwTxtNode& rNode )
void MSWordExportBase::WriteText()
{
#ifdef DEBUG
-//!! does not compile with debug=t -> unresolved external (dbg_out),
-//!! sommeone who knows what he wants to get should fix this
-// ::std::clog << "<WriteText>" << ::std::endl;
+ ::std::clog << "<WriteText>" << ::std::endl;
// ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl;
#endif
@@ -2537,6 +2537,8 @@ void WW8Export::WriteMainText()
#endif
}
+typedef ww8::WW8Sttb< ww8::WW8Struct > WW8SttbAssoc;
+
void WW8Export::WriteFkpPlcUsw()
{
if( !bWrtWW8 )
@@ -2658,9 +2660,36 @@ void WW8Export::WriteFkpPlcUsw()
ExportDopTypography(pDop->doptypography);
WriteDop( *this ); // Document-Properties
+
+ // Write SttbfAssoc
+ WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *>
+ (pDoc->getExternalData(::sw::STTBF_ASSOC).get());
+ ::std::vector<String> aStrings;
+
+ ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings();
+ ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end();
+ for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin();
+ aIt != aItEnd; aIt++)
+ {
+ String aStr(aIt->getStr());
+ aStrings.push_back(aStr);
+ }
+
+ WriteAsStringTable(aStrings, pFib->fcSttbfAssoc,
+ pFib->lcbSttbfAssoc);
+
}
Strm().Seek( 0 );
+ // Reclaim stored FIB data from document.
+ ::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *>
+ (pDoc->getExternalData(::sw::FIB).get());
+
+ pFib->fReadOnlyRecommended =
+ pFibData->getReadOnlyRecommended() ? 1 : 0;
+ pFib->fWriteReservation =
+ pFibData->getWriteReservation() ? 1 : 0;
+
pFib->Write( Strm() ); // FIB
}
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 9ca4cd6e34e3..ddb8e13bb867 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -109,7 +109,6 @@
#include <pagedesc.hxx> // for SwPageDesc
#include <flddat.hxx> // for Date fields
#include <ndtxt.hxx> // for Numrules
-#include <fmthbsh.hxx>
#include <swrect.hxx>
#include <reffld.hxx>
#include <ftninfo.hxx>
@@ -2383,9 +2382,9 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
GetExport( ).OutputField( 0, eCode, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START |
WRITEFIELD_CMD_END );
}
-
- GetExport( ).bStartTOX = false;
}
+
+ GetExport( ).bStartTOX = false;
}
void AttributeOutputBase::EndTOX( const SwSection& rSect )
@@ -2961,8 +2960,8 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
font size of that script as our default.
*/
USHORT nScript;
- if( pBreakIt->xBreak.is() )
- nScript = pBreakIt->xBreak->getScriptType( pFld->GetPar1(), 0);
+ if( pBreakIt->GetBreakIter().is() )
+ nScript = pBreakIt->GetBreakIter()->getScriptType( pFld->GetPar1(), 0);
else
nScript = i18n::ScriptType::ASIAN;
@@ -3140,10 +3139,6 @@ void WW8AttributeOutput::ParaVerticalAlign( const SvxParaVertAlignItem& rAlign )
// NoHyphen: ich habe keine Entsprechung in der SW-UI und WW-UI gefunden
-void WW8AttributeOutput::TextHardBlank( const SwFmtHardBlank& rHardBlank )
-{
- m_rWW8Export.WriteChar( rHardBlank.GetChar() );
-}
// RefMark, NoLineBreakHere fehlen noch
@@ -3757,8 +3752,17 @@ void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid )
UINT16 nHeight = rGrid.GetBaseHeight() + rGrid.GetRubyHeight();
m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaLinePitch );
m_rWW8Export.InsUInt16( nHeight );
- sal_uInt32 nPageCharSize = ItemGet<SvxFontHeightItem>(*(m_rWW8Export.pStyles->GetSwFmt()),
- RES_CHRATR_CJK_FONTSIZE).GetHeight();
+
+ MSWordStyles * pStyles = m_rWW8Export.pStyles;
+ SwFmt * pSwFmt = pStyles->GetSwFmt();
+
+ sal_uInt32 nPageCharSize = 0;
+
+ if (pSwFmt != NULL)
+ {
+ nPageCharSize = ItemGet<SvxFontHeightItem>
+ (*pSwFmt, RES_CHRATR_CJK_FONTSIZE).GetHeight();
+ }
INT32 nCharWidth = rGrid.GetBaseWidth() - nPageCharSize;
INT32 nFraction = 0;
@@ -4543,9 +4547,9 @@ void AttributeOutputBase::ParaLineSpacing( const SvxLineSpacingItem& rSpacing )
{
const SwTxtNode* pNd = (const SwTxtNode*)GetExport().pOutFmtNode;
pSet = &pNd->GetSwAttrSet();
- if ( pBreakIt->xBreak.is() )
+ if ( pBreakIt->GetBreakIter().is() )
{
- nScript = pBreakIt->xBreak->
+ nScript = pBreakIt->GetBreakIter()->
getScriptType(pNd->GetTxt(), 0);
}
}
@@ -5146,9 +5150,6 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt )
case RES_TXTATR_FTN:
TextFootnote( static_cast< const SwFmtFtn& >( rHt ) );
break;
- case RES_TXTATR_HARDBLANK:
- TextHardBlank( static_cast< const SwFmtHardBlank& >( rHt ) );
- break;
case RES_PARATR_LINESPACING:
ParaLineSpacing( static_cast< const SvxLineSpacingItem& >( rHt ) );
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index cff22353d60c..4968d88887dc 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -323,9 +323,6 @@ protected:
/// Sfx item RES_TXTATR_FTN
virtual void TextFootnote_Impl( const SwFmtFtn& );
- /// Sfx item RES_TXTATR_HARDBLANK
- virtual void TextHardBlank( const SwFmtHardBlank& );
-
/// Sfx item RES_PARATR_LINESPACING
virtual void ParaLineSpacing_Impl( short nSpace, short nMulti );
diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index 81d605457e9c..b0dabff56b2f 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -187,7 +187,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks,
-1 );
pCNd = aIdx.GetNode().GetCntntNode();
SwPosition aPos( aIdx, SwIndex( pCNd, pCNd->Len() ));
- pD->Copy( aPam, aPos, false );
+ pD->CopyRange( aPam, aPos, false );
rBlocks.PutDoc();
}
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index f8bc1ce18537..b9fd20dc1cba 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -46,7 +46,7 @@
#include <unotools/tempfile.hxx>
#include <svtools/sfxecode.hxx>
-#include <svtools/docpasswdrequest.hxx>
+#include <comphelper/docpasswordrequest.hxx>
#include <hintids.hxx>
#include <svx/tstpitem.hxx>
@@ -81,7 +81,6 @@
#include <fmtcntnt.hxx>
#include <fmtcnct.hxx>
#include <fmtpdsc.hxx>
-#include <fmthbsh.hxx>
#include <ftninfo.hxx>
#include <fmtftn.hxx>
#include <txtftn.hxx>
@@ -139,6 +138,8 @@
#include <dbgoutsw.hxx>
#endif
+#include "WW8Sttbf.hxx"
+#include "WW8FibData.hxx"
#define MM_250 1417 // WW-Default fuer Hor. Seitenraender: 2.5 cm
#define MM_200 1134 // WW-Default fuer u.Seitenrand: 2.0 cm
@@ -597,7 +598,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
}
}
- if ( ( mnFix16Angle || nTextRotationAngle ) && dynamic_cast< SdrObjCustomShape* >( pObj ) )
+ if ( ( ( rObjData.nSpFlags & SP_FFLIPV ) || mnFix16Angle || nTextRotationAngle ) && dynamic_cast< SdrObjCustomShape* >( pObj ) )
{
SdrObjCustomShape* pCustomShape = dynamic_cast< SdrObjCustomShape* >( pObj );
@@ -606,6 +607,10 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
{ // text is already rotated, we have to take back the object rotation if DFF_Prop_RotateText is false
fExtraTextRotation = -mnFix16Angle;
}
+ if ( rObjData.nSpFlags & SP_FFLIPV ) // sj: in ppt the text is flipped, whereas in word the text
+ { // remains unchanged, so we have to take back the flipping here
+ fExtraTextRotation += 18000.0; // because our core will flip text if the shape is flipped.
+ }
fExtraTextRotation += nTextRotationAngle;
if ( !::basegfx::fTools::equalZero( fExtraTextRotation ) )
{
@@ -950,7 +955,9 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
pFrm->SetFmtAttr(aURL);
}
else
- pDoc->Insert(aRegion, *pEntry->pAttr, 0);
+ {
+ pDoc->InsertPoolItem(aRegion, *pEntry->pAttr, 0);
+ }
}
}
break;
@@ -1068,7 +1075,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos,
SwTxtNode* pTxt = rBkMrkPos.nNode.GetNode().GetTxtNode();
if( pTxt && rBkMrkPos.nContent.GetIndex() )
{
- SwTxtAttr* pFtn = pTxt->GetTxtAttr(
+ SwTxtAttr* const pFtn = pTxt->GetTxtAttrForCharAt(
rBkMrkPos.nContent.GetIndex()-1, RES_TXTATR_FTN );
if( pFtn )
{
@@ -1083,7 +1090,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos,
}
}
- pDoc->Insert(aPaM, *pEntry->pAttr, 0);
+ pDoc->InsertPoolItem(aPaM, *pEntry->pAttr, 0);
MoveAttrs(*aPaM.GetPoint());
}
break;
@@ -1623,7 +1630,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
sTxt, aDate );
aPostIt.SetTextObject(pOutliner);
- rDoc.Insert(*pPaM, SwFmtFld(aPostIt), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aPostIt), 0);
return 0;
}
@@ -2177,6 +2184,66 @@ CharSet SwWW8ImplReader::GetCurrentCharSet()
switch (pLang->GetLanguage())
{
case LANGUAGE_CZECH:
+ case LANGUAGE_HUNGARIAN:
+ case LANGUAGE_POLISH:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1250;
+ break;
+ case LANGUAGE_RUSSIAN:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1251;
+ break;
+ case LANGUAGE_GREEK:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1253;
+ break;
+ case LANGUAGE_TURKISH:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1254;
+ break;
+ default:
+ eSrcCharSet = RTL_TEXTENCODING_MS_1252;
+ break;
+ }
+ }
+ }
+ }
+ return eSrcCharSet;
+}
+
+//Takashi Ono for CJK
+CharSet SwWW8ImplReader::GetCurrentCJKCharSet()
+{
+ /*
+ #i2015
+ If the hard charset is set use it, if not see if there is an open
+ character run that has set the charset, if not then fallback to the
+ current underlying paragraph style.
+ */
+ CharSet eSrcCharSet = eHardCharSet;
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ {
+ if (!maFontSrcCJKCharSets.empty())
+ eSrcCharSet = maFontSrcCJKCharSets.top();
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
+ eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet();
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ eSrcCharSet = pCollA[nAktColl].GetCJKCharSet();
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ { // patch from cmc for #i52786#
+ /*
+ #i22206#/#i52786#
+ The (default) character set used for a run of text is the default
+ character set for the version of Word that last saved the document.
+
+ This is a bit tentative, more might be required if the concept is correct.
+ When later version of word write older 6/95 documents the charset is
+ correctly set in the character runs involved, so its hard to reproduce
+ documents that require this to be sure of the process involved.
+ */
+ const SvxLanguageItem *pLang =
+ (const SvxLanguageItem*)GetFmtAttr(RES_CHRATR_LANGUAGE);
+ if (pLang)
+ {
+ switch (pLang->GetLanguage())
+ {
+ case LANGUAGE_CZECH:
eSrcCharSet = RTL_TEXTENCODING_MS_1250;
break;
default:
@@ -2335,6 +2402,8 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
const CharSet eSrcCharSet = bVer67 ? GetCurrentCharSet() :
RTL_TEXTENCODING_MS_1252;
+ const CharSet eSrcCJKCharSet = bVer67 ? GetCurrentCJKCharSet() :
+ RTL_TEXTENCODING_MS_1252;
// (re)alloc UniString data
String sPlainCharsBuf;
@@ -2395,7 +2464,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
sal_Char aTest[2];
aTest[0] = static_cast< sal_Char >((nUCode & 0xFF00) >> 8);
aTest[1] = static_cast< sal_Char >(nUCode & 0x00FF);
- String aTemp(aTest, 2, eSrcCharSet);
+ String aTemp(aTest, 2, eSrcCJKCharSet);
ASSERT(aTemp.Len() == 1, "so much for that theory");
*pWork = aTemp.GetChar(0);
}
@@ -2450,7 +2519,7 @@ bool SwWW8ImplReader::AddTextToParagraph(const String& rAddString)
*/
if ((pNd->GetTxt().Len() + rAddString.Len()) < STRING_MAXLEN -1)
{
- rDoc.Insert (*pPaM, rAddString, true);
+ rDoc.InsertString(*pPaM, rAddString);
}
else
{
@@ -2459,16 +2528,16 @@ bool SwWW8ImplReader::AddTextToParagraph(const String& rAddString)
{
String sTempStr (rAddString,0,
STRING_MAXLEN - pNd->GetTxt().Len() -1);
- rDoc.Insert (*pPaM, sTempStr, true);
+ rDoc.InsertString(*pPaM, sTempStr);
sTempStr = rAddString.Copy(sTempStr.Len(),
rAddString.Len() - sTempStr.Len());
AppendTxtNode(*pPaM->GetPoint());
- rDoc.Insert (*pPaM,sTempStr, true );
+ rDoc.InsertString(*pPaM, sTempStr);
}
else
{
AppendTxtNode(*pPaM->GetPoint());
- rDoc.Insert (*pPaM, rAddString, true);
+ rDoc.InsertString(*pPaM, rAddString);
}
}
@@ -2489,7 +2558,9 @@ bool SwWW8ImplReader::ReadChars(WW8_CP& rPos, WW8_CP nNextAttr, long nTextEnd,
if( bSymbol ) // Spezialzeichen einfuegen
{
for(USHORT nCh = 0; nCh < nEnd - rPos; ++nCh)
- rDoc.Insert( *pPaM, cSymbol );
+ {
+ rDoc.InsertString( *pPaM, cSymbol );
+ }
pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_FONT );
}
pStrm->SeekRel( nEnd- rPos );
@@ -2570,7 +2641,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
SwPageNumberField aFld(
(SwPageNumberFieldType*)rDoc.GetSysFldType(
RES_PAGENUMBERFLD ), PG_RANDOM, SVX_NUM_ARABIC);
- rDoc.Insert(*pPaM, SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
}
break;
case 0xe:
@@ -2582,7 +2653,8 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
{
// Always insert a txtnode for a column break, e.g. ##
AppendTxtNode(*pPaM->GetPoint());
- rDoc.Insert(*pPaM, SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK), 0);
+ rDoc.InsertPoolItem(*pPaM,
+ SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK), 0);
}
break;
case 0x7:
@@ -2633,14 +2705,14 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
case 0xc:
bRet = HandlePageBreakChar();
break;
- case 0x1e:
- rDoc.Insert( *pPaM, CHAR_HARDHYPHEN); // Non-breaking hyphen
+ case 0x1e: // Non-breaking hyphen
+ rDoc.InsertString( *pPaM, CHAR_HARDHYPHEN );
break;
- case 0x1f:
- rDoc.Insert( *pPaM, CHAR_SOFTHYPHEN); // Non-required hyphens
+ case 0x1f: // Non-required hyphens
+ rDoc.InsertString( *pPaM, CHAR_SOFTHYPHEN );
break;
- case 0xa0:
- rDoc.Insert( *pPaM, CHAR_HARDBLANK); // Non-breaking spaces
+ case 0xa0: // Non-breaking spaces
+ rDoc.InsertString( *pPaM, CHAR_HARDBLANK );
break;
case 0x1:
/*
@@ -3098,7 +3170,8 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType)
AppendTxtNode(*pPaM->GetPoint());
}
// <--
- rDoc.Insert(*pPaM, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0);
+ rDoc.InsertPoolItem(*pPaM,
+ SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0);
bPgSecBreak = false;
}
}
@@ -3332,7 +3405,7 @@ void GiveNodePageDesc(SwNodeIndex &rIdx, const SwFmtPageDesc &rPgDesc,
rIdx.GetNode().GetCntntNode(), 0);
SwPaM aPage(aPamStart);
- rDoc.Insert(aPage, rPgDesc, 0);
+ rDoc.InsertPoolItem(aPage, rPgDesc, 0);
}
}
@@ -3669,6 +3742,34 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
if (mbNewDoc && pStg && !pGloss)
ReadDocInfo();
+ ::ww8::WW8FibData * pFibData = new ::ww8::WW8FibData();
+
+ if (pWwFib->fReadOnlyRecommended)
+ pFibData->setReadOnlyRecommended(true);
+ else
+ pFibData->setReadOnlyRecommended(false);
+
+ if (pWwFib->fWriteReservation)
+ pFibData->setWriteReservation(true);
+ else
+ pFibData->setWriteReservation(false);
+
+ ::sw::tExternalDataPointer pExternalFibData(pFibData);
+
+ rDoc.setExternalData(::sw::FIB, pExternalFibData);
+
+ ::sw::tExternalDataPointer pSttbfAsoc
+ (new ::ww8::WW8Sttb<ww8::WW8Struct>(*pTableStream, pWwFib->fcSttbfAssoc, pWwFib->lcbSttbfAssoc));
+
+ rDoc.setExternalData(::sw::STTBF_ASSOC, pSttbfAsoc);
+
+ if (pWwFib->fWriteReservation || pWwFib->fReadOnlyRecommended)
+ {
+ SwDocShell * pDocShell = rDoc.GetDocShell();
+ if (pDocShell)
+ pDocShell->SetReadOnlyUI(sal_True);
+ }
+
pPaM = new SwPaM(rPos);
pCtrlStck = new SwWW8FltControlStack( &rDoc, nFieldFlags, *this );
@@ -4171,8 +4272,8 @@ namespace
uno::Reference< task::XInteractionHandler > xHandler( rMedium.GetInteractionHandler() );
if( xHandler.is() )
{
- RequestDocumentPassword* pRequest = new RequestDocumentPassword(
- task::PasswordRequestMode_PASSWORD_ENTER,
+ ::comphelper::DocPasswordRequest* pRequest = new ::comphelper::DocPasswordRequest(
+ ::comphelper::DocPasswordRequestType_MS, task::PasswordRequestMode_PASSWORD_ENTER,
INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ) );
uno::Reference< task::XInteractionRequest > xRequest( pRequest );
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 777b2e0055c3..93a20df1576c 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -933,6 +933,7 @@ private:
Stack of textencoding being used as we progress through the document text
*/
std::stack<rtl_TextEncoding> maFontSrcCharSets;
+ std::stack<rtl_TextEncoding> maFontSrcCJKCharSets;
/*
Winword numbering gets imported as SwNumRules, there is a problem that
@@ -1173,6 +1174,7 @@ private:
rtl_TextEncoding&);
bool SetNewFontAttr(USHORT nFCode, bool bSetEnums, USHORT nWhich);
void ResetCharSetVars();
+ void ResetCJKCharSetVars();
const SfxPoolItem* GetFmtAttr( USHORT nWhich );
bool JoinNode(SwPaM &rPam, bool bStealAttr = false);
@@ -1615,6 +1617,7 @@ public: // eigentlich private, geht aber leider nur public
// Laden eines kompletten DocFiles
ULONG LoadDoc( SwPaM&,WW8Glossary *pGloss=0);
CharSet GetCurrentCharSet();
+ CharSet GetCurrentCJKCharSet();
void PostProcessAttrs();
};
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 0dffb74b6dd0..7342843e6b9a 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -381,7 +381,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn()
sChar.Append(pTxt->GetTxt().GetChar(--nPos));
pPaM->SetMark();
pPaM->GetMark()->nContent--;
- rDoc.Delete( *pPaM );
+ rDoc.DeleteRange( *pPaM );
pPaM->DeleteMark();
SwFmtFtn aFtn(rDesc.meType == MAN_EDN);
pFN = pTxt->InsertItem(aFtn, nPos, nPos);
@@ -435,7 +435,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn()
pPaM->GetMark()->nContent++;
pPaM->GetMark()->nContent++;
pReffingStck->Delete(*pPaM);
- rDoc.Delete( *pPaM );
+ rDoc.DeleteRange( *pPaM );
pPaM->DeleteMark();
}
}
@@ -4725,4 +4725,11 @@ CharSet SwWW8StyInf::GetCharSet() const
return eLTRFontSrcCharSet;
}
+CharSet SwWW8StyInf::GetCJKCharSet() const
+{
+ if ((pFmt) && (pFmt->GetFrmDir().GetValue() == FRMDIR_HORI_RIGHT_TOP))
+ return eRTLFontSrcCharSet;
+ return eCJKFontSrcCharSet;
+}
+
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx
index 1d26e384a61c..302227fca0fe 100644
--- a/sw/source/filter/ww8/ww8par2.hxx
+++ b/sw/source/filter/ww8/ww8par2.hxx
@@ -224,6 +224,7 @@ public:
return pOutlineNumrule;
}
CharSet GetCharSet() const;
+ CharSet GetCJKCharSet() const;
};
class WW8RStyle: public WW8Style
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index de912778c17a..aa2737da1fa4 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -207,7 +207,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr )
aFld.SetHelp(aFormula.sHelp);
aFld.SetToolTip(aFormula.sToolTip);
- rDoc.Insert(*pPaM, SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
return FLD_OK;
} else {
WW8PLCFx_Book* pB = pPlcxMan->GetBook();
@@ -321,7 +321,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, String& rStr)
aFld.SetSelectedItem(aFormula.maListEntries[nIndex]);
}
- rDoc.Insert(*pPaM, SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
return FLD_OK;
}
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index b45aa575baf4..f5f82d879aac 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -61,7 +61,6 @@
#include <svx/fhgtitem.hxx>
#include <svx/langitem.hxx>
#include <fmtfld.hxx>
-#include <fmthbsh.hxx>
#include <fmtanchr.hxx>
#include <pam.hxx> // fuer SwPam
#include <doc.hxx>
@@ -1062,7 +1061,8 @@ void SwWW8ImplReader::InsertTagField( const USHORT nId, const String& rTagText )
if( SwFltGetFlag(nFieldFlags, SwFltControlStack::TAGS_IN_TEXT))
{
aName += rTagText; // als Txt taggen
- rDoc.Insert(*pPaM, aName, false);
+ rDoc.InsertString(*pPaM, aName,
+ IDocumentContentOperations::INS_NOHINTEXPAND);
}
else
{ // normal tagggen
@@ -1073,7 +1073,7 @@ void SwWW8ImplReader::InsertTagField( const USHORT nId, const String& rTagText )
USHORT nSubType = ( SwFltGetFlag( nFieldFlags, SwFltControlStack::TAGS_VISIBLE ) ) ? 0 : nsSwExtendedSubType::SUB_INVISIBLE;
aFld.SetSubType(nSubType | nsSwGetSetExpType::GSE_STRING);
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
}
}
@@ -1133,7 +1133,7 @@ eF_ResT SwWW8ImplReader::Read_F_Input( WW8FieldDesc* pF, String& rStr )
SwInputField aFld( (SwInputFieldType*)rDoc.GetSysFldType( RES_INPUTFLD ),
aDef, aQ, INP_TXT, 0 ); // sichtbar ( geht z.Zt. nicht anders )
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -1335,7 +1335,7 @@ eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, String& rStr )
aFld.SetInputFlag(true);
aFld.SetPromptText( aQ );
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
pReffedStck->SetAttr(*pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo);
return FLD_OK;
@@ -1351,7 +1351,7 @@ eF_ResT SwWW8ImplReader::Read_F_ANumber( WW8FieldDesc*, String& rStr )
SwSetExpField aFld( (SwSetExpFieldType*)pNumFldType, aEmptyStr,
GetNumberPara( rStr ) );
aFld.SetValue( ++nFldNum );
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -1427,7 +1427,7 @@ eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, String& rStr )
else if (!bCountOn)
aFld.SetFormula(aSequenceName);
- rDoc.Insert(*pPaM, SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
return FLD_OK;
}
@@ -1552,7 +1552,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, String& rStr )
*/
SwDocInfoField aFld( (SwDocInfoFieldType*)
rDoc.GetSysFldType( RES_DOCINFOFLD ), DI_CUSTOM|nReg, aDocProperty, GetFieldResult( pF ) );
- rDoc.Insert(*pPaM, SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
return FLD_OK;
}
@@ -1632,7 +1632,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, String& rStr )
rDoc.GetSysFldType( RES_DOCINFOFLD ), nSub|nReg, String(), nFormat );
if (bDateTime)
ForceFieldLanguage(aFld, nLang);
- rDoc.Insert(*pPaM, SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
return FLD_OK;
}
@@ -1645,7 +1645,7 @@ eF_ResT SwWW8ImplReader::Read_F_Author( WW8FieldDesc*, String& )
SwDocInfoField aFld( (SwDocInfoFieldType*)
rDoc.GetSysFldType( RES_DOCINFOFLD ),
DI_CREATE|DI_SUB_AUTHOR, String() );
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -1653,7 +1653,7 @@ eF_ResT SwWW8ImplReader::Read_F_TemplName( WW8FieldDesc*, String& )
{
SwTemplNameField aFld( (SwTemplNameFieldType*)
rDoc.GetSysFldType( RES_TEMPLNAMEFLD ), FF_NAME );
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -1708,14 +1708,14 @@ eF_ResT SwWW8ImplReader::Read_F_DateTime( WW8FieldDesc*pF, String& rStr )
SwDateTimeField aFld((SwDateTimeFieldType*)
rDoc.GetSysFldType(RES_DATETIMEFLD ), DATEFLD, nFormat);
ForceFieldLanguage(aFld, nLang);
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
}
else if (nDT == NUMBERFORMAT_TIME)
{
SwDateTimeField aFld((SwDateTimeFieldType*)
rDoc.GetSysFldType(RES_DATETIMEFLD), TIMEFLD, nFormat);
ForceFieldLanguage(aFld, nLang);
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
}
return FLD_OK;
@@ -1745,7 +1745,7 @@ eF_ResT SwWW8ImplReader::Read_F_FileName(WW8FieldDesc*, String &rStr)
SwFileNameField aFld(
(SwFileNameFieldType*)rDoc.GetSysFldType(RES_FILENAMEFLD), eType);
- rDoc.Insert(*pPaM, SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
return FLD_OK;
}
@@ -1759,7 +1759,7 @@ eF_ResT SwWW8ImplReader::Read_F_Anz( WW8FieldDesc* pF, String& rStr )
SwDocStatField aFld( (SwDocStatFieldType*)
rDoc.GetSysFldType( RES_DOCSTATFLD ), nSub,
GetNumberPara( rStr ) );
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -1771,7 +1771,7 @@ eF_ResT SwWW8ImplReader::Read_F_CurPage( WW8FieldDesc*, String& rStr )
SwChapterField aFld( (SwChapterFieldType*)
rDoc.GetSysFldType( RES_CHAPTERFLD ), CF_NUMBER );
aFld.SetLevel( nPgChpLevel );
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
static const sal_Char aDelim[] = "-.:\x97\x96";
BYTE nDelim = nPgChpDelim;
@@ -1781,9 +1781,13 @@ eF_ResT SwWW8ImplReader::Read_F_CurPage( WW8FieldDesc*, String& rStr )
sal_Unicode c = ByteString::ConvertToUnicode( aDelim[ nDelim ],
RTL_TEXTENCODING_MS_1252 );
if( '-' == c )
- rDoc.Insert( *pPaM, CHAR_HARDHYPHEN );
+ {
+ rDoc.InsertString( *pPaM, CHAR_HARDHYPHEN );
+ }
else
- rDoc.Insert( *pPaM, SwFmtHardBlank( c ), 0);
+ {
+ rDoc.InsertString( *pPaM, c ); // maybe insert ZWNBSP?
+ }
}
// Seitennummer
@@ -1791,7 +1795,7 @@ eF_ResT SwWW8ImplReader::Read_F_CurPage( WW8FieldDesc*, String& rStr )
rDoc.GetSysFldType( RES_PAGENUMBERFLD ), PG_RANDOM,
GetNumberPara(rStr, true));
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -1850,7 +1854,7 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, String& rStr )
NewAttr(aSz);
}
- rDoc.Insert(*pPaM, cChar);
+ rDoc.InsertString(*pPaM, cChar);
if (nSize > 0)
pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_FONTSIZE);
@@ -1859,7 +1863,7 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, String& rStr )
}
else
{
- rDoc.Insert(*pPaM, CREATE_CONST_ASC("###"), true);
+ rDoc.InsertString(*pPaM, CREATE_CONST_ASC("###"));
}
return FLD_OK;
@@ -1920,7 +1924,7 @@ eF_ResT SwWW8ImplReader::Read_F_Set( WW8FieldDesc* pF, String& rStr )
SwSetExpField aFld( (SwSetExpFieldType*)pFT, sVal, ULONG_MAX );
aFld.SetSubType(nsSwExtendedSubType::SUB_INVISIBLE | nsSwGetSetExpType::GSE_STRING);
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
pReffedStck->SetAttr(*pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo);
@@ -1970,7 +1974,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, String& rStr )
SwGetRefField aFld(
(SwGetRefFieldType*)rDoc.GetSysFldType( RES_GETREFFLD ),
sBkmName,REF_BOOKMARK,0,REF_CHAPTER);
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
}
else
{
@@ -1993,7 +1997,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, String& rStr )
SwGetRefField aFld( (SwGetRefFieldType*)
rDoc.GetSysFldType( RES_GETREFFLD ), sBkmName, REF_BOOKMARK, 0,
REF_UPDOWN );
- rDoc.Insert(*pPaM, SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
}
return FLD_OK;
}
@@ -2070,7 +2074,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, String& rStr )
(SwGetRefFieldType*)rDoc.GetSysFldType( RES_GETREFFLD ), sName,
REF_BOOKMARK, 0, REF_PAGE );
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -2119,7 +2123,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, String& rStr)
SwMacroField aFld( (SwMacroFieldType*)
rDoc.GetSysFldType( RES_MACROFLD ), aName, aVText );
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
WW8_CP nOldCp = pPlcxMan->Where();
@@ -2280,7 +2284,7 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, String& rStr
aSection.SetLinkFileName( aPara );
aSection.SetProtect(true);
- SwSection* pSection = rDoc.Insert(*pPaM, aSection, 0 ,false);
+ SwSection*const pSection = rDoc.InsertSwSection(*pPaM, aSection, 0, false);
ASSERT(pSection, "no section inserted");
if (!pSection)
return FLD_TEXT;
@@ -2327,7 +2331,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBField( WW8FieldDesc* pF, String& rStr )
aFld.InitContent(aResult);
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld( aFld ), 0);
return FLD_OK;
}
@@ -2339,7 +2343,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBNext( WW8FieldDesc*, String& )
SwFieldType* pFT = rDoc.InsertFldType( aN );
SwDBNextSetField aFld( (SwDBNextSetFieldType*)pFT, aEmptyStr, aEmptyStr,
SwDBData() ); // Datenbank: Nichts
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -2350,7 +2354,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBNum( WW8FieldDesc*, String& )
SwFieldType* pFT = rDoc.InsertFldType( aN );
SwDBSetNumberField aFld( (SwDBSetNumberFieldType*)pFT,
SwDBData() ); // Datenbank: Nichts
- rDoc.Insert( *pPaM, SwFmtFld( aFld ), 0 );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
return FLD_OK;
}
@@ -2415,7 +2419,7 @@ void SwWW8ImplReader::Read_SubF_Combined( _ReadFieldParams& rReadParam)
{
SwCombinedCharField aFld((SwCombinedCharFieldType*)
rDoc.GetSysFldType(RES_COMBINED_CHARS),sCombinedCharacters);
- rDoc.Insert(*pPaM,SwFmtFld(aFld), 0);
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
}
}
@@ -2521,8 +2525,8 @@ void SwWW8ImplReader::Read_SubF_Ruby( _ReadFieldParams& rReadParam)
const SwCharFmt *pCharFmt=0;
//Make a guess at which of asian of western we should be setting
USHORT nScript;
- if (pBreakIt->xBreak.is())
- nScript = pBreakIt->xBreak->getScriptType(sRuby, 0);
+ if (pBreakIt->GetBreakIter().is())
+ nScript = pBreakIt->GetBreakIter()->getScriptType(sRuby, 0);
else
nScript = i18n::ScriptType::ASIAN;
@@ -2573,7 +2577,7 @@ void SwWW8ImplReader::Read_SubF_Ruby( _ReadFieldParams& rReadParam)
aRuby.SetAdjustment(nJustificationCode);
NewAttr(aRuby);
- rDoc.Insert( *pPaM, sText, true );
+ rDoc.InsertString( *pPaM, sText );
pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_TXTATR_CJK_RUBY );
}
}
@@ -3423,7 +3427,7 @@ void lcl_ImportTox(SwDoc &rDoc, SwPaM &rPaM, const String &rStr, bool bIdx)
if (sFldTxt.Len())
{
aM.SetAlternativeText( sFldTxt );
- rDoc.Insert( rPaM, aM, 0 );
+ rDoc.InsertPoolItem( rPaM, aM, 0 );
}
}
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index ab60c37a899b..978834f3345e 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -698,7 +698,8 @@ SwSectionFmt *wwSectionManager::InsertSection(
aSection.SetProtect(SectionIsProtected(rSection));
- rSection.mpSection = mrReader.rDoc.Insert( rMyPaM, aSection, &aSet );
+ rSection.mpSection =
+ mrReader.rDoc.InsertSwSection( rMyPaM, aSection, &aSet );
ASSERT(rSection.mpSection, "section not inserted!");
if (!rSection.mpSection)
return 0;
@@ -851,7 +852,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
aSection.SetProtect(true);
// --> CMC, OD 2004-06-18 #i19922# improvement:
// return value of method <Insert> not used.
- mrReader.rDoc.Insert(*mrReader.pPaM, aSection, 0 ,false);
+ mrReader.rDoc.InsertSwSection(*mrReader.pPaM, aSection, 0, false);
}
wwSection aLastSection(*mrReader.pPaM->GetPoint());
@@ -3217,7 +3218,7 @@ SwFrmFmt *SwWW8ImplReader::ContainsSingleInlineGraphic(const SwPaM &rRegion)
if (
aBegin == aEnd && nBegin == nEnd - 1 &&
0 != (pTNd = aBegin.GetNode().GetTxtNode()) &&
- 0 != (pTFlyAttr = pTNd->GetTxtAttr(nBegin, RES_TXTATR_FLYCNT))
+ 0 != (pTFlyAttr = pTNd->GetTxtAttrForCharAt(nBegin, RES_TXTATR_FLYCNT))
)
{
const SwFmtFlyCnt& rFly = pTFlyAttr->GetFlyCnt();
@@ -3557,11 +3558,32 @@ bool SwWW8ImplReader::SetNewFontAttr(USHORT nFCode, bool bSetEnums,
//off the stack will keep in sync
if (!pAktColl && IsListOrDropcap())
{
- if (!maFontSrcCharSets.empty())
- eSrcCharSet = maFontSrcCharSets.top();
+ if (nWhich == RES_CHRATR_CJK_FONT)
+ {
+ if (!maFontSrcCJKCharSets.empty())
+ {
+ eSrcCharSet = maFontSrcCJKCharSets.top();
+ }
+ else
+ {
+ eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
+ }
+
+ maFontSrcCJKCharSets.push(eSrcCharSet);
+ }
else
- eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
- maFontSrcCharSets.push(eSrcCharSet);
+ {
+ if (!maFontSrcCharSets.empty())
+ {
+ eSrcCharSet = maFontSrcCharSets.top();
+ }
+ else
+ {
+ eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
+ }
+
+ maFontSrcCharSets.push(eSrcCharSet);
+ }
}
return false;
}
@@ -3591,7 +3613,10 @@ bool SwWW8ImplReader::SetNewFontAttr(USHORT nFCode, bool bSetEnums,
else if (IsListOrDropcap())
{
//Add character text encoding to stack
- maFontSrcCharSets.push(eSrcCharSet);
+ if (nWhich == RES_CHRATR_CJK_FONT)
+ maFontSrcCJKCharSets.push(eSrcCharSet);
+ else
+ maFontSrcCharSets.push(eSrcCharSet);
}
}
@@ -3607,6 +3632,13 @@ void SwWW8ImplReader::ResetCharSetVars()
maFontSrcCharSets.pop();
}
+void SwWW8ImplReader::ResetCJKCharSetVars()
+{
+ ASSERT(!maFontSrcCJKCharSets.empty(),"no charset to remove");
+ if (!maFontSrcCJKCharSets.empty())
+ maFontSrcCJKCharSets.pop();
+}
+
/*
Font ein oder ausschalten:
*/
@@ -3637,7 +3669,10 @@ void SwWW8ImplReader::Read_FontCode( USHORT nId, const BYTE* pData, short nLen )
if( nLen < 0 ) // Ende des Attributes
{
pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
- ResetCharSetVars();
+ if (nId == RES_CHRATR_CJK_FONT)
+ ResetCJKCharSetVars();
+ else
+ ResetCharSetVars();
}
else
{
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f3a4c3630e4c..f20c13889f27 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1498,8 +1498,15 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
}
INT32 nFcStart = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
if( 8 <= pWw8Fib->nVersion )
+ {
nFcStart = WW8PLCFx_PCD::TransformPieceAddress( nFcStart,
bIsUnicode );
+ }
+ else
+ {
+ if (pWw8Fib->fExtChar)
+ bIsUnicode=true;
+ }
INT32 nLen = (nCpEnd - nCpStart) * (bIsUnicode ? 2 : 1);
/*
@@ -1581,7 +1588,10 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
WW8_FC nRet = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
if (8 > pWw8Fib->nVersion)
- *pIsUnicode = false;
+ if (pWw8Fib->fExtChar)
+ *pIsUnicode=true;
+ else
+ *pIsUnicode = false;
else
nRet = WW8PLCFx_PCD::TransformPieceAddress( nRet, *pIsUnicode );
@@ -5478,7 +5488,8 @@ WW8Fib::WW8Fib(SvStream& rSt, BYTE nWantedVersion, UINT32 nOffset)
cQuickSaves = ( aBits1 & 0xf0 ) >> 4;
fEncrypted = aBits2 & 0x01 ;
fWhichTblStm= ( aBits2 & 0x02 ) >> 1;
- // dummy = ( aBits2 & 0x0e ) >> 1;
+ fReadOnlyRecommended = (aBits2 & 0x4) >> 2;
+ fWriteReservation = (aBits2 & 0x8) >> 3;
fExtChar = ( aBits2 & 0x10 ) >> 4;
// dummy = ( aBits2 & 0x20 ) >> 5;
fFarEast = ( aBits2 & 0x40 ) >> 6; // #i90932#
@@ -5651,6 +5662,12 @@ bool WW8Fib::WriteHeader(SvStream& rStrm)
nBits16 |= (0xf0 & ( cQuickSaves << 4 ));
if( fEncrypted ) nBits16 |= 0x0100;
if( fWhichTblStm ) nBits16 |= 0x0200;
+
+ if (fReadOnlyRecommended)
+ nBits16 |= 0x0400;
+ if (fWriteReservation)
+ nBits16 |= 0x0800;
+
if( fExtChar ) nBits16 |= 0x1000;
if( fFarEast ) nBits16 |= 0x4000; // #i90932#
if( fObfuscated ) nBits16 |= 0x8000;
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 2bcf97819f21..3547eaf99391 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -1033,6 +1033,8 @@ public:
UINT16 cQuickSaves :4; // 00F0 count of times file was quicksaved
UINT16 fEncrypted :1; //0100 1 if file is encrypted, 0 if not
UINT16 fWhichTblStm :1; //0200 When 0, this fib refers to the table stream
+ UINT16 fReadOnlyRecommended :1;
+ UINT16 fWriteReservation :1;
// named "0Table", when 1, this fib refers to the
// table stream named "1Table". Normally, a file
// will have only one table stream, but under unusual
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 2cb78f0bae4c..7e3187a4a948 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -646,7 +646,7 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
// delete 'deleted' redlines and forget about the whole thing
if (nsRedlineType_t::REDLINE_DELETE == pRedlineInfo->eType)
{
- pDoc->Delete(aPaM);
+ pDoc->DeleteRange(aPaM);
// And what about the "deleted nodes"?
// They have to be deleted as well (#i80689)!
if( bIgnoreRedlines && pRedlineInfo->pContentIndex != NULL )
@@ -657,7 +657,7 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
{
SwNodeIndex aEnd( *pEnd, 1 );
SwPaM aDel( aIdx, aEnd );
- pDoc->Delete(aDel);
+ pDoc->DeleteRange(aDel);
}
}
}
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index abe69df298d6..a99e719e3fe0 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -216,6 +216,24 @@ sal_Int32 ReadThroughComponent(
}
catch( xml::sax::SAXParseException& r )
{
+ // sax parser sends wrapped exceptions,
+ // try to find the original one
+ xml::sax::SAXException aSaxEx = *(xml::sax::SAXException*)(&r);
+ sal_Bool bTryChild = sal_True;
+
+ while( bTryChild )
+ {
+ xml::sax::SAXException aTmp;
+ if ( aSaxEx.WrappedException >>= aTmp )
+ aSaxEx = aTmp;
+ else
+ bTryChild = sal_False;
+ }
+
+ packages::zip::ZipIOException aBrokenPackage;
+ if ( aSaxEx.WrappedException >>= aBrokenPackage )
+ return ERRCODE_IO_BROKENPACKAGE;
+
if( bEncrypted )
return ERRCODE_SFX_WRONGPASSWORD;
@@ -246,7 +264,10 @@ sal_Int32 ReadThroughComponent(
}
catch( xml::sax::SAXException& r)
{
- (void)r;
+ packages::zip::ZipIOException aBrokenPackage;
+ if ( r.WrappedException >>= aBrokenPackage )
+ return ERRCODE_IO_BROKENPACKAGE;
+
if( bEncrypted )
return ERRCODE_SFX_WRONGPASSWORD;
@@ -255,6 +276,7 @@ sal_Int32 ReadThroughComponent(
aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
DBG_ERROR( aError.GetBuffer() );
#endif
+
return ERR_SWG_READ_ERROR;
}
catch( packages::zip::ZipIOException& r)
@@ -873,35 +895,39 @@ ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const S
// <--
sal_uInt32 nWarnRDF = 0;
- // RDF metadata - must be read before styles/content
- // N.B.: embedded documents have their own manifest.rdf!
- try
- {
- const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(xModelComp,
- uno::UNO_QUERY_THROW);
- const uno::Reference<rdf::XURI> xBaseURI( ::sfx2::createBaseURI(
- aContext.getUNOContext(), xStorage, aBaseURL, StreamPath) );
- const uno::Reference<task::XInteractionHandler> xHandler(
- pDocSh->GetMedium()->GetInteractionHandler() );
- xDMA->loadMetadataFromStorage(xStorage, xBaseURI, xHandler);
- }
- catch (lang::WrappedTargetException & e)
+ if ( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFmtsOnly() ||
+ bInsertMode) )
{
- ucb::InteractiveAugmentedIOException iaioe;
- if (e.TargetException >>= iaioe)
+ // RDF metadata - must be read before styles/content
+ // N.B.: embedded documents have their own manifest.rdf!
+ try
{
- // import error that was not ignored by InteractionHandler!
- nWarnRDF = ERR_SWG_READ_ERROR;
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(xModelComp,
+ uno::UNO_QUERY_THROW);
+ const uno::Reference<rdf::XURI> xBaseURI( ::sfx2::createBaseURI(
+ aContext.getUNOContext(), xStorage, aBaseURL, StreamPath) );
+ const uno::Reference<task::XInteractionHandler> xHandler(
+ pDocSh->GetMedium()->GetInteractionHandler() );
+ xDMA->loadMetadataFromStorage(xStorage, xBaseURI, xHandler);
}
- else
+ catch (lang::WrappedTargetException & e)
+ {
+ ucb::InteractiveAugmentedIOException iaioe;
+ if (e.TargetException >>= iaioe)
+ {
+ // import error that was not ignored by InteractionHandler!
+ nWarnRDF = ERR_SWG_READ_ERROR;
+ }
+ else
+ {
+ nWarnRDF = WARN_SWG_FEATURES_LOST; // uhh... something wrong?
+ }
+ }
+ catch (uno::Exception &)
{
nWarnRDF = WARN_SWG_FEATURES_LOST; // uhh... something went wrong?
}
}
- catch (uno::Exception &)
- {
- nWarnRDF = WARN_SWG_FEATURES_LOST; // uhh... something went wrong?
- }
sal_uInt32 nWarn = 0;
sal_uInt32 nWarn2 = 0;
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index a25bfbb45659..b71812df6774 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -699,7 +699,7 @@ void SwXMLTableCellContext_Impl::EndElement()
SwPaM aSrcPaM( *pSrcPaM->GetPoint(),
*pSrcPaM->GetMark() );
SwPosition aDstPos( *pDstTxtCrsr->GetPaM()->GetPoint() );
- pDoc->Copy( aSrcPaM, aDstPos, false );
+ pDoc->CopyRange( aSrcPaM, aDstPos, false );
nColRepeat--;
}
diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx
index 4a4de8b648b9..7698fe58c580 100644
--- a/sw/source/ui/app/appopt.cxx
+++ b/sw/source/ui/app/appopt.cxx
@@ -35,6 +35,8 @@
#include <cmdid.h> // Funktion-Ids
#endif
+#include <com/sun/star/i18n/ScriptType.hpp>
+
#define _SVSTDARR_STRINGSDTOR
#include <svtools/svstdarr.hxx>
@@ -54,6 +56,7 @@
#include <svx/optgrid.hxx>
#include <svx/svxdlg.hxx>
#include <svx/dialogs.hrc>
+#include <i18npool/mslangid.hxx>
#include <fontcfg.hxx>
#include <optload.hxx>
#include <optcomp.hxx>
@@ -191,19 +194,25 @@ SfxItemSet* SwModule::CreateItemSet( USHORT nId )
pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));*/
SvtLinguConfig aLinguCfg;
+ Locale aLocale;
+ LanguageType nLang;
+
+ using namespace ::com::sun::star::i18n::ScriptType;
Any aLang = aLinguCfg.GetProperty(C2U("DefaultLocale"));
- Locale aLocale;
aLang >>= aLocale;
- pRet->Put(SvxLanguageItem(SvxLocaleToLanguage( aLocale ), SID_ATTR_LANGUAGE));
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), LATIN);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CJK"));
aLang >>= aLocale;
- pRet->Put(SvxLanguageItem(SvxLocaleToLanguage( aLocale ), SID_ATTR_CHAR_CJK_LANGUAGE));
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), ASIAN);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CTL"));
aLang >>= aLocale;
- pRet->Put(SvxLanguageItem(SvxLocaleToLanguage( aLocale ), SID_ATTR_CHAR_CTL_LANGUAGE));
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), COMPLEX);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
}
if(bTextDialog)
pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index dd5ecb185c2d..06289c10f38a 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -1083,15 +1083,10 @@ void SwDocShell::GetState(SfxItemSet& rSet)
break;
case SID_SOURCEVIEW:
{
- if(IsLoading())
- rSet.DisableItem(nWhich);
- else
- {
- SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView()
- : SfxViewShell::Current();
- BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView);
- rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView));
- }
+ SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView()
+ : SfxViewShell::Current();
+ BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView);
+ rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView));
}
break;
case SID_HTML_MODE:
@@ -1116,18 +1111,10 @@ void SwDocShell::GetState(SfxItemSet& rSet)
case SID_BROWSER_MODE:
case FN_PRINT_LAYOUT:
{
- SfxViewShell* pViewShell = SfxViewShell::Current();
- BOOL bDisable = 0 != PTR_CAST(SwPagePreView, pViewShell) ||
- 0 != PTR_CAST(SwSrcView, pViewShell);
- if (bDisable)
- rSet.DisableItem( nWhich );
- else
- {
- sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE);
- if(FN_PRINT_LAYOUT == nWhich)
- bState = !bState;
- rSet.Put( SfxBoolItem( nWhich, bState));
- }
+ sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE);
+ if(FN_PRINT_LAYOUT == nWhich)
+ bState = !bState;
+ rSet.Put( SfxBoolItem( nWhich, bState));
}
break;
@@ -1337,44 +1324,42 @@ uno::Reference< frame::XController >
/* -----------------------------12.02.01 12:08--------------------------------
---------------------------------------------------------------------------*/
+static const char* pEventNames[] =
+{
+ "OnPageCountChange",
+ "OnMailMerge",
+ "OnMailMergeFinished",
+ "OnFieldMerge",
+ "OnFieldMergeFinished",
+ "OnLayoutFinished"
+};
+
Sequence< OUString > SwDocShell::GetEventNames()
{
Sequence< OUString > aRet = SfxObjectShell::GetEventNames();
sal_Int32 nLen = aRet.getLength();
- aRet.realloc(nLen + 2);
+ aRet.realloc(nLen + 6);
OUString* pNames = aRet.getArray();
- pNames[nLen++] = OUString::createFromAscii("OnMailMerge");
- pNames[nLen] = OUString::createFromAscii("OnPageCountChange");
+ pNames[nLen++] = GetEventName(0);
+ pNames[nLen++] = GetEventName(1);
+ pNames[nLen++] = GetEventName(2);
+ pNames[nLen++] = GetEventName(3);
+ pNames[nLen++] = GetEventName(4);
+ pNames[nLen] = GetEventName(5);
+
return aRet;
}
-/*
-void SwTmpPersist::FillClass( SvGlobalName * pClassName,
- ULONG * pClipFormat,
- String * pAppName,
- String * pLongUserName,
- String * pUserName,
- sal_Int32 nFileFormat ) const
-{
- pDShell->SwDocShell::FillClass( pClassName, pClipFormat, pAppName,
- pLongUserName, pUserName, nFileFormat );
-}
-BOOL SwTmpPersist::Save()
-{
- if( SaveChilds() )
- return SvPersist::Save();
- return FALSE;
-}
+static sal_Int32 nEvents=13;
-BOOL SwTmpPersist::SaveCompleted( SvStorage * pStor )
+rtl::OUString SwDocShell::GetEventName( sal_Int32 nIndex )
{
- if( SaveCompletedChilds( pStor ) )
- return SvPersist::SaveCompleted( pStor );
- return FALSE;
-} */
+ if ( nIndex<nEvents )
+ return ::rtl::OUString::createFromAscii(pEventNames[nIndex]);
+ return rtl::OUString();
+}
const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const
{
return pDoc ? &pDoc->GetXmlIdRegistry() : 0;
}
-
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index 182bda09d7b8..3fd1e879b063 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -943,10 +943,10 @@ void SwDocShell::Execute(SfxRequest& rReq)
bDone = TRUE;
SfxEventConfiguration* pEvent = SFX_APP()->GetEventConfig();
SvxMacro aMac(aEmptyStr, aEmptyStr, STARBASIC);
- pEvent->ConfigureEvent(SFX_EVENT_OPENDOC, aMac, this);
- pEvent->ConfigureEvent(SFX_EVENT_CLOSEDOC, aMac, this);
- pEvent->ConfigureEvent(SFX_EVENT_ACTIVATEDOC, aMac, this);
- pEvent->ConfigureEvent(SFX_EVENT_DEACTIVATEDOC, aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this);
ReloadFromHtml(aTempFile.GetURL(), pSrcView);
nSlot = 0;
}
@@ -983,6 +983,8 @@ void SwDocShell::Execute(SfxRequest& rReq)
//pSavePrinter darf nicht wieder geloescht werden
}
pViewFrm->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, nSlot == SID_VIEWSHELL2));
+ pViewFrm->GetBindings().Invalidate( SID_BROWSER_MODE );
+ pViewFrm->GetBindings().Invalidate( FN_PRINT_LAYOUT );
}
break;
case SID_GET_COLORTABLE:
@@ -1780,7 +1782,10 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView )
SwView* pTempView = _pView ? _pView : (SwView*)GetView();
if( pTempView )
{
- pTempView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR);
+ SfxBindings& rBind = pTempView->GetViewFrame()->GetBindings();
+ rBind.Invalidate(FN_SHADOWCURSOR);
+ rBind.Invalidate(SID_BROWSER_MODE);
+ rBind.Invalidate(FN_PRINT_LAYOUT);
if( !GetDoc()->getPrinter( false ) )
{
@@ -1793,8 +1798,8 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView )
GetDoc()->CheckDefaultPageFmt();
// <--
- //Wenn wir die BrowseView einschalten, darf es nur diese eine
- //Sicht auf das Dokument geben, alle anderen werden geschlossen.
+ // Currently there can be only one view (layout) if the document is viewed in Web layout
+ // So if there are more views we are in print layout and for toggling to Web layout all other views must be closed
SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE);
do {
if( pTmpFrm != pTempView->GetViewFrame() )
diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx
index e355dcba5e64..630d836c785b 100644
--- a/sw/source/ui/app/docshini.cxx
+++ b/sw/source/ui/app/docshini.cxx
@@ -37,6 +37,7 @@
#ifndef _SVX_DIALOGS_HRC
#include <svx/dialogs.hrc>
#endif
+#include <i18npool/mslangid.hxx>
#include <sot/storinfo.hxx>
#include <sot/storage.hxx>
#include <svtools/zforlist.hxx>
@@ -58,6 +59,7 @@
#endif
#include <linguistic/lngprops.hxx>
#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
#include <rtl/logfile.hxx>
#include <sfx2/docfilt.hxx>
#include <svx/xtable.hxx>
@@ -791,9 +793,9 @@ void SwDocShell::SubInitNew()
SvtLinguConfig().GetOptions( aLinguOpt );
- sal_Int16 nVal = aLinguOpt.nDefaultLanguage,
- eCJK = aLinguOpt.nDefaultLanguage_CJK,
- eCTL = aLinguOpt.nDefaultLanguage_CTL;
+ sal_Int16 nVal = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
aDfltSet.Put( SvxLanguageItem( nVal, RES_CHRATR_LANGUAGE ) );
aDfltSet.Put( SvxLanguageItem( eCJK, RES_CHRATR_CJK_LANGUAGE ) );
aDfltSet.Put( SvxLanguageItem( eCTL, RES_CHRATR_CTL_LANGUAGE ) );
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 41814d006339..7841176d47e1 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -37,6 +37,7 @@
#include <hintids.hxx>
#include <svtools/itemiter.hxx>
#include <svtools/eitem.hxx>
+#include <svtools/syslocale.hxx>
#include <svx/boxitem.hxx>
#include <svx/numitem.hxx>
// --> OD 2008-02-13 #newlistlevelattrs#
@@ -609,7 +610,7 @@ String SwDocStyleSheet::GetDescription(SfxMapUnit eUnit)
{
IntlWrapper aIntlWrapper(
::comphelper::getProcessServiceFactory(),
- GetAppLocaleData().getLocale());
+ SvtSysLocale().GetLocaleData().getLocale());
String sPlus(String::CreateFromAscii(" + "));
if ( SFX_STYLE_FAMILY_PAGE == nFamily )
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index b0884997dbd9..c58eaa369fc0 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -441,26 +441,26 @@
{\
Identifier = FN_DELETE_NOTE ;\
HelpID = FN_DELETE_NOTE ;\
- Text [ en-US ] = "Delete ~Note" ;\
+ Text [ en-US ] = "Delete ~Comment" ;\
};\
MenuItem\
{\
Identifier = FN_DELETE_NOTE_AUTHOR ;\
HelpID = FN_DELETE_NOTE_AUTHOR ;\
- Text [ en-US ] = "Delete ~All Notes by $1" ;\
+ Text [ en-US ] = "Delete ~All Comments by $1" ;\
};\
MenuItem\
{\
Identifier = FN_DELETE_ALL_NOTES ;\
HelpID = FN_DELETE_ALL_NOTES ;\
- Text [ en-US ] = "~Delete All Notes" ;\
+ Text [ en-US ] = "~Delete All Comments" ;\
};\
/*
MenuItem\
{\
Identifier = FN_HIDE_NOTE ;\
HelpID = FN_HIDE_NOTE ;\
- Text [ en-US ] = "~Hide note" ;\
+ Text [ en-US ] = "~Hide comment" ;\
};\
MenuItem\
{\
@@ -472,7 +472,7 @@
{\
Identifier = FN_HIDE_ALL_NOTES ;\
HelpID = FN_HIDE_ALL_NOTES ;\
- Text [ en-US ] = "Hide all ~notes" ;\
+ Text [ en-US ] = "Hide all ~comments" ;\
};
*/
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index 694c2514ef93..c84273770667 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -221,11 +221,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
ERRCODE_AREA_SW_END,
pSwResMgr );
- SfxEventConfiguration::RegisterEvent(SW_EVENT_MAIL_MERGE, SW_RES(STR_PRINT_MERGE_MACRO), String::CreateFromAscii("OnMailMerge"));
- SfxEventConfiguration::RegisterEvent(SW_EVENT_MAIL_MERGE_END, SW_RES(STR_PRINT_MERGE_MACRO), String::CreateFromAscii("OnMailMergeFinished"));
- SfxEventConfiguration::RegisterEvent(SW_EVENT_FIELD_MERGE, String(), String::CreateFromAscii("OnFieldMerge"));
- SfxEventConfiguration::RegisterEvent(SW_EVENT_FIELD_MERGE_FINISHED, String(), String::CreateFromAscii("OnFieldMergeFinished"));
- SfxEventConfiguration::RegisterEvent(SW_EVENT_PAGE_COUNT, SW_RES(STR_PAGE_COUNT_MACRO), String::CreateFromAscii("OnPageCountChange"));
pModuleConfig = new SwModuleOptions;
//Die brauchen wie sowieso
diff --git a/sw/source/ui/cctrl/actctrl.cxx b/sw/source/ui/cctrl/actctrl.cxx
index 4fbbbb9048bf..dfb2ef0ae4e6 100644
--- a/sw/source/ui/cctrl/actctrl.cxx
+++ b/sw/source/ui/cctrl/actctrl.cxx
@@ -71,6 +71,15 @@ long NumEditAction::Notify( NotifyEvent& rNEvt )
Beschreibung: KeyInput fuer ShortName - Edits ohne Spaces
------------------------------------------------------------------------*/
+NoSpaceEdit::NoSpaceEdit( Window* pParent, const ResId& rResId)
+ : Edit(pParent, rResId),
+ sForbiddenChars(String::CreateFromAscii(" "))
+{
+}
+
+NoSpaceEdit::~NoSpaceEdit()
+{
+}
void NoSpaceEdit::KeyInput(const KeyEvent& rEvt)
{
diff --git a/sw/source/ui/config/fontcfg.cxx b/sw/source/ui/config/fontcfg.cxx
index 14793b511c6f..34ffa8f215b9 100644
--- a/sw/source/ui/config/fontcfg.cxx
+++ b/sw/source/ui/config/fontcfg.cxx
@@ -33,10 +33,12 @@
#include <fontcfg.hxx>
+#include <i18npool/mslangid.hxx>
#include <vcl/outdev.hxx>
#include <svtools/lingucfg.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
#include <swtypes.hxx>
#include <unomid.h>
@@ -116,9 +118,10 @@ SwStdFontConfig::SwStdFontConfig() :
SvtLinguConfig().GetOptions( aLinguOpt );
- sal_Int16 eWestern = aLinguOpt.nDefaultLanguage,
- eCJK = aLinguOpt.nDefaultLanguage_CJK,
- eCTL = aLinguOpt.nDefaultLanguage_CTL;
+ sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
for(sal_Int16 i = 0; i < DEF_FONT_COUNT; i++)
{
sDefaultFonts[i] = GetDefaultFor(i,
@@ -163,9 +166,10 @@ void SwStdFontConfig::Commit()
SvtLinguConfig().GetOptions( aLinguOpt );
- sal_Int16 eWestern = aLinguOpt.nDefaultLanguage,
- eCJK = aLinguOpt.nDefaultLanguage_CJK,
- eCTL = aLinguOpt.nDefaultLanguage_CTL;
+ sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
for(sal_uInt16 nProp = 0;
nProp < sal::static_int_cast< sal_uInt16, sal_Int32 >( aNames.getLength() );
nProp++)
@@ -198,9 +202,10 @@ BOOL SwStdFontConfig::IsFontDefault(USHORT nFontType) const
SvtLinguConfig().GetOptions( aLinguOpt );
- sal_Int16 eWestern = aLinguOpt.nDefaultLanguage,
- eCJK = aLinguOpt.nDefaultLanguage_CJK,
- eCTL = aLinguOpt.nDefaultLanguage_CTL;
+ sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
String sDefFont(GetDefaultFor(FONT_STANDARD, eWestern));
String sDefFontCJK(GetDefaultFor(FONT_STANDARD_CJK, eCJK));
String sDefFontCTL(GetDefaultFor(FONT_STANDARD_CTL, eCTL));
@@ -320,9 +325,11 @@ void SwStdFontConfig::ChangeInt( USHORT nFontType, sal_Int32 nHeight )
{
SvtLinguOptions aLinguOpt;
SvtLinguConfig().GetOptions( aLinguOpt );
- sal_Int16 eWestern = aLinguOpt.nDefaultLanguage,
- eCJK = aLinguOpt.nDefaultLanguage_CJK,
- eCTL = aLinguOpt.nDefaultLanguage_CTL;
+
+ sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
// #i92090# default height value sets back to -1
const sal_Int32 nDefaultHeight = GetDefaultHeightFor(nFontType, lcl_LanguageOfType(nFontType, eWestern, eCJK, eCTL));
const bool bIsDefaultHeight = nHeight == nDefaultHeight;
diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src
index 96719f17bd58..41ba789789ff 100644
--- a/sw/source/ui/config/optdlg.src
+++ b/sw/source/ui/config/optdlg.src
@@ -173,7 +173,7 @@ TabPage TP_CONTENT_OPT
{
Pos = MAP_APPFONT ( 12 , 119 ) ;
Size = MAP_APPFONT ( 108 , 10 ) ;
- Text [ en-US ] = "~Notes" ;
+ Text [ en-US ] = "~Comments" ;
};
FixedLine FL_SETTINGS
{
@@ -323,7 +323,7 @@ TabPage TP_OPTPRINT_PAGE
{
Pos = MAP_APPFONT ( 180 , 27 ) ;
Size = MAP_APPFONT ( 74 , 10 ) ;
- Text [ en-US ] = "Notes ~only" ;
+ Text [ en-US ] = "Comments ~only" ;
};
RadioButton RB_END
{
@@ -347,7 +347,7 @@ TabPage TP_OPTPRINT_PAGE
{
Pos = MAP_APPFONT ( 174 , 3 ) ;
Size = MAP_APPFONT ( 80 , 8 ) ;
- Text [ en-US ] = "Notes" ;
+ Text [ en-US ] = "Comments" ;
Group = TRUE ;
};
FixedLine FL_4
diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx
index e4b232269cc5..1170f3506b31 100644
--- a/sw/source/ui/config/usrpref.cxx
+++ b/sw/source/ui/config/usrpref.cxx
@@ -33,7 +33,7 @@
#include <tools/stream.hxx>
-
+#include <svtools/syslocale.hxx>
#include "swtypes.hxx"
#include "hintids.hxx"
@@ -72,7 +72,7 @@ SwMasterUsrPref::SwMasterUsrPref(BOOL bWeb) :
aCursorConfig(*this),
pWebColorConfig(bWeb ? new SwWebColorConfig(*this) : 0)
{
- MeasurementSystem eSystem = GetAppLocaleData().getMeasurementSystemEnum();
+ MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
eHScrollMetric = eUserMetric;
eVScrollMetric = eUserMetric;
diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx
index af43528016f9..661a73f312ad 100644
--- a/sw/source/ui/config/viewopt.cxx
+++ b/sw/source/ui/config/viewopt.cxx
@@ -58,6 +58,7 @@
#include <crstate.hxx>
#include <svtools/colorcfg.hxx>
#include <svtools/accessibilityoptions.hxx>
+#include <svtools/syslocale.hxx>
#include <svx/acorrcfg.hxx>
@@ -237,7 +238,7 @@ SwViewOption::SwViewOption() :
nCore2Options = VIEWOPT_CORE2_BLACKFONT | VIEWOPT_CORE2_HIDDENPARA;
nUIOptions = VIEWOPT_2_MODIFIED | VIEWOPT_2_GRFKEEPZOOM |VIEWOPT_2_ANY_RULER;
- if(MEASURE_METRIC != GetAppLocaleData().getMeasurementSystemEnum())
+ if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
aSnapSize.Width() = aSnapSize.Height() = 720; // 1/2"
else
aSnapSize.Width() = aSnapSize.Height() = 567; // 1 cm
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 07e9b0a0eec0..cb815a93f1a6 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -1131,7 +1131,9 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
for( n = 0; n < nCols; ++n )
{
if( aRbHeadlColnms.IsChecked() )
- rSh.SwEditShell::Insert( aColFlds[ n ]->sColumn );
+ {
+ rSh.SwEditShell::Insert2( aColFlds[ n ]->sColumn );
+ }
rSh.GoNextCell();
}
}
@@ -1227,7 +1229,9 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
{
rtl::OUString sVal = xColumn->getString();
if(!xColumn->wasNull())
- rSh.SwEditShell::Insert( sVal );
+ {
+ rSh.SwEditShell::Insert2( sVal );
+ }
}
}
catch(Exception&
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index af339ac79181..603af1c31111 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -701,7 +701,7 @@ void SwNewDBMgr::ImportDBEntry(SwWrtShell* pSh)
if (i < nLength - 1)
sStr += '\t';
}
- pSh->SwEditShell::Insert(sStr);
+ pSh->SwEditShell::Insert2(sStr);
pSh->SwFEShell::SplitNode(); // Zeilenvorschub
}
}
@@ -932,9 +932,9 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView,
do {
nStartRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
{
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, pSh->GetView().GetViewFrame()->GetObjectShell()));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), pSh->GetView().GetViewFrame()->GetObjectShell()));
pSh->ViewShell::UpdateFlds();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, pSh->GetView().GetViewFrame()->GetObjectShell()));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), pSh->GetView().GetViewFrame()->GetObjectShell()));
++rOpt.nMergeAct;
// launch MailMergeEvent if required
@@ -1455,9 +1455,9 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
SwDoc* pWorkDoc = ((SwDocShell*)(&xWorkDocSh))->GetDoc();
SwNewDBMgr* pOldDBMgr = pWorkDoc->GetNewDBMgr();
pWorkDoc->SetNewDBMgr( this );
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, xWorkDocSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), xWorkDocSh));
pWorkDoc->UpdateFlds(NULL, false);
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, xWorkDocSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), xWorkDocSh));
// alle versteckten Felder/Bereiche entfernen
pWorkDoc->RemoveInvisibleContent();
@@ -2858,7 +2858,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
aDescriptor[daCursor] <<= xResSet;
SfxObjectShellRef xDocShell = rSh.GetView().GetViewFrame()->GetObjectShell();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, xDocShell));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xDocShell));
{
//copy rSh to aTempFile
::rtl::OUString sTempURL;
@@ -2924,7 +2924,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
//remove the temporary file
SWUnoHelper::UCB_DeleteFile( sTempURL );
}
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, rSh.GetView().GetViewFrame()->GetObjectShell()));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), rSh.GetView().GetViewFrame()->GetObjectShell()));
// reset the cursor inside
xResSet = NULL;
@@ -3260,9 +3260,9 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
// create a layout
rWorkShell.CalcLayout();
rWorkShell.UnlockExpFlds();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
- rWorkShell.ViewShell::UpdateFlds();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
+ rWorkShell.ViewShell::UpdateFlds();
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
// strip invisible content and convert fields to text
rWorkShell.RemoveInvisibleContent();
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 72fc1e122a8e..eb1f75d57979 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -1000,14 +1000,14 @@ IMPL_LINK(SwMailMergeOutputPage, PrintHdl_Impl, PushButton*, EMPTYARG)
}
SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, pObjSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh));
rSh.GetNewDBMgr()->SetMergeType( DBMGR_MERGE_DOCUMENTS );
SfxDispatcher *pDis = pTargetView->GetViewFrame()->GetDispatcher();
SfxBoolItem aMergeSilent(SID_SILENT, sal_False);
m_pWizard->enableButtons(WZB_CANCEL, sal_False);
pDis->Execute(SID_PRINTDOCDIRECT,
SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aMergeSilent, 0L);
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, pObjSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), pObjSh));
pTargetView->SetMailMergeConfigItem(0, 0, sal_False);
m_pWizard->enableButtons(WZB_CANCEL, sal_True);
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index 1e978dbdac4c..585151383893 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -35,6 +35,8 @@
#endif
#include <hintids.hxx>
#include <rtl/textenc.h>
+#include <i18npool/mslangid.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
#include <svtools/lingucfg.hxx>
#include <fontcfg.hxx>
#include <swmodule.hxx>
@@ -234,14 +236,14 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh,
switch(nAppScriptType)
{
case SCRIPTTYPE_ASIAN:
- aOpt.SetLanguage(aLinguOpt.nDefaultLanguage_CJK);
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, SCRIPTTYPE_ASIAN));
break;
case SCRIPTTYPE_COMPLEX:
- aOpt.SetLanguage(aLinguOpt.nDefaultLanguage_CTL);
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, SCRIPTTYPE_COMPLEX));
break;
//SCRIPTTYPE_LATIN:
default:
- aOpt.SetLanguage(aLinguOpt.nDefaultLanguage);
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, SCRIPTTYPE_LATIN));
}
}
}
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 2f90c9fddef3..9626f5104db9 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -34,29 +34,22 @@
#undef SW_DLLIMPLEMENTATION
#endif
-#include "hintids.hxx"
-#include "regionsw.hxx"
+#include <hintids.hxx>
+#include <regionsw.hxx>
#include <svtools/urihelper.hxx>
#include <svtools/PasswordHelper.hxx>
#include <vcl/svapp.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <svtools/stritem.hxx>
#include <svtools/eitem.hxx>
-#ifndef _PASSWD_HXX //autogen
#include <sfx2/passwd.hxx>
-#endif
#include <sfx2/docfilt.hxx>
#include <sfx2/request.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/linkmgr.hxx>
#include <sfx2/docinsert.hxx>
#include <sfx2/filedlghelper.hxx>
-#ifndef _SVX_SIZEITEM_HXX //autogen
-
#include <svx/sizeitem.hxx>
-#endif
#include <svx/htmlcfg.hxx>
#include <comphelper/storagehelper.hxx>
@@ -65,15 +58,9 @@
#include <section.hxx>
#include <docary.hxx>
#include <doc.hxx> // fuers SwSectionFmt-Array
-#ifndef _BASESH_HXX
#include <basesh.hxx>
-#endif
-#ifndef _WDOCSH_HXX
#include <wdocsh.hxx>
-#endif
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <swmodule.hxx>
#include <wrtsh.hxx>
#include <swundo.hxx> // fuer Undo-Ids
@@ -82,27 +69,15 @@
#include <swunodef.hxx>
#include <shellio.hxx>
-#ifndef _HELPID_H
#include <helpid.h>
-#endif
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
-#ifndef _REGIONSW_HRC
#include <regionsw.hrc>
-#endif
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
-#ifndef _GLOBALS_HRC
#include <globals.hrc>
-#endif
#include <sfx2/bindings.hxx>
#include <svx/htmlmode.hxx>
#include <svx/dlgutil.hxx>
-#ifndef _SVX_DIALOGS_HRC
#include <svx/dialogs.hrc>
-#endif
#include <svx/svxdlg.hxx>
#include <svx/flagsdef.hxx>
@@ -115,7 +90,65 @@ SV_IMPL_PTRARR( SwSectionFmts, SwSectionFmtPtr )
SV_IMPL_OP_PTRARR_SORT( SectReprArr, SectReprPtr )
-static void lcl_ReadSections( SwWrtShell& rSh, SfxMedium& rMedium, ComboBox& rBox );
+static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox );
+
+void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames, const SwSectionFmt* pNewFmt )
+{
+ const SwSectionFmt* pFmt;
+ if( !pNewFmt )
+ {
+ USHORT nCount = rSh.GetSectionFmtCount();
+ for(USHORT i=0;i<nCount;i++)
+ {
+ SectionType eTmpType;
+ if( !(pFmt = &rSh.GetSectionFmt(i))->GetParent() &&
+ pFmt->IsInNodesArr() &&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ String* pString = new String(pFmt->GetSection()->GetName());
+ if(pAvailNames)
+ pAvailNames->InsertEntry(*pString);
+ rSubRegions.InsertEntry(*pString);
+ lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt );
+ }
+ }
+ }
+ else
+ {
+ SwSections aTmpArr;
+ USHORT nCnt = pNewFmt->GetChildSections(aTmpArr,SORTSECT_POS);
+ if( nCnt )
+ {
+ SectionType eTmpType;
+ for( USHORT n = 0; n < nCnt; ++n )
+ if( (pFmt = aTmpArr[n]->GetFmt())->IsInNodesArr()&&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ String* pString = new String(pFmt->GetSection()->GetName());
+ if(pAvailNames)
+ pAvailNames->InsertEntry(*pString);
+ rSubRegions.InsertEntry(*pString);
+ lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt );
+ }
+ }
+ }
+}
+
+void lcl_FillSubRegionList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames )
+{
+ lcl_FillList( rSh, rSubRegions, pAvailNames, 0 );
+ IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
+ for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ ppMark != pMarkAccess->getMarksEnd();
+ ppMark++)
+ {
+ const ::sw::mark::IMark* pBkmk = ppMark->get();
+ if( pBkmk->IsExpanded() )
+ rSubRegions.InsertEntry( pBkmk->GetName() );
+ }
+}
/* -----------------25.06.99 15:38-------------------
@@ -275,6 +308,7 @@ SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh )
aFilePB ( this, SW_RES( PB_FILE ) ),
aSubRegionFT ( this, SW_RES( FT_SUBREG ) ) ,
aSubRegionED ( this, SW_RES( LB_SUBREG ) ) ,
+ bSubRegionsFilled( false ),
aProtectFL ( this, SW_RES( FL_PROTECT ) ),
aProtectCB ( this, SW_RES( CB_PROTECT ) ),
@@ -330,6 +364,8 @@ SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh )
aFilePB.SetClickHdl ( LINK( this, SwEditRegionDlg, FileSearchHdl ));
aFileNameED.SetModifyHdl( LINK( this, SwEditRegionDlg, FileNameHdl ));
aSubRegionED.SetModifyHdl( LINK( this, SwEditRegionDlg, FileNameHdl ));
+ aSubRegionED.AddEventListener( LINK( this, SwEditRegionDlg, SubRegionEventHdl ));
+ aSubRegionED.EnableAutocomplete( sal_True, sal_True );
aTree.SetHelpId(HID_REGION_TREE);
aTree.SetSelectionMode( MULTIPLE_SELECTION );
@@ -667,6 +703,8 @@ IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox )
aDismiss.Enable();
String aFile = pRepr->GetFile();
String sSub = pRepr->GetSubRegion();
+ bSubRegionsFilled = false;
+ aSubRegionED.Clear();
if(aFile.Len()||sSub.Len())
{
aFileCB.Check(TRUE);
@@ -1174,6 +1212,8 @@ IMPL_LINK( SwEditRegionDlg, FileNameHdl, Edit *, pEdit )
SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
if(pEdit == &aFileNameED)
{
+ bSubRegionsFilled = false;
+ aSubRegionED.Clear();
if( aDDECB.IsChecked() )
{
String sLink( pEdit->GetText() );
@@ -1371,7 +1411,7 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg )
const SfxPoolItem* pItem;
if ( SFX_ITEM_SET == pMedium->GetItemSet()->GetItemState( SID_PASSWORD, FALSE, &pItem ) )
sPassword = ( (SfxStringItem*)pItem )->GetValue();
- ::lcl_ReadSections( rSh, *pMedium, aSubRegionED );
+ ::lcl_ReadSections( *pMedium, aSubRegionED );
delete pMedium;
}
}
@@ -1390,6 +1430,36 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg )
Application::SetDefDialogParent( m_pOldDefDlgParent );
return 0;
}
+/*-- 03.09.2009 16:24:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent *, pEvent )
+{
+ if( !bSubRegionsFilled && pEvent && pEvent->GetId() == VCLEVENT_DROPDOWN_PRE_OPEN )
+ {
+ //if necessary fill the names bookmarks/sections/tables now
+
+ rtl::OUString sFileName = aFileNameED.GetText();
+ if(sFileName.getLength())
+ {
+ SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ sFileName = URIHelper::SmartRel2Abs(
+ aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
+
+ //load file and set the shell
+ SfxMedium aMedium( sFileName, STREAM_STD_READ );
+ sFileName = aMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
+ ::lcl_ReadSections( aMedium, aSubRegionED );
+ }
+ else
+ lcl_FillSubRegionList( rSh, aSubRegionED, 0 );
+ bSubRegionsFilled = true;
+ }
+ return 0;
+}
/* -----------------------------08.05.2002 15:00------------------------------
@@ -1404,7 +1474,7 @@ Image SwEditRegionDlg::BuildBitmap(BOOL bProtect,BOOL bHidden, BOOL bHighContras
Beschreibung: Hilfsfunktion - Bereichsnamen aus dem Medium lesen
--------------------------------------------------------------------*/
-static void lcl_ReadSections( SwWrtShell& /*rSh*/, SfxMedium& rMedium, ComboBox& rBox )
+static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox )
{
rBox.Clear();
uno::Reference < embed::XStorage > xStg;
@@ -1580,6 +1650,7 @@ SwInsertSectionTabPage::SwInsertSectionTabPage(
aCurName.SetModifyHdl ( LINK( this, SwInsertSectionTabPage, NameEditHdl));
aDDECB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, DDEHdl ));
ChangeProtectHdl(&aProtectCB);
+ aSubRegionED.EnableAutocomplete( sal_True, sal_True );
}
/* -----------------21.05.99 10:31-------------------
*
@@ -1603,16 +1674,7 @@ void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh)
aDDECommandFT .Hide();
}
- FillList();
- IDocumentMarkAccess* const pMarkAccess = m_pWrtSh->getIDocumentMarkAccess();
- for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
- ppMark != pMarkAccess->getMarksEnd();
- ppMark++)
- {
- const ::sw::mark::IMark* pBkmk = ppMark->get();
- if( pBkmk->IsExpanded() )
- aSubRegionED.InsertEntry( pBkmk->GetName() );
- }
+ lcl_FillSubRegionList( *m_pWrtSh, aSubRegionED, &aCurName );
SwSection* pSect = ((SwInsertSectionTabDialog*)GetTabDialog())->GetSection();
if( pSect ) // etwas vorgegeben ?
@@ -1875,7 +1937,7 @@ IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFil
m_sFilePasswd = ( (SfxStringItem*)pItem )->GetValue();
aFileNameED.SetText( INetURLObject::decode(
m_sFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_UTF8 ) );
- ::lcl_ReadSections( *m_pWrtSh, *pMedium, aSubRegionED );
+ ::lcl_ReadSections( *pMedium, aSubRegionED );
delete pMedium;
}
}
@@ -1886,52 +1948,6 @@ IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFil
return 0;
}
-/*--------------------------------------------------------------------
- Beschreibung: Liste der verwendeten Namen fuellen
- --------------------------------------------------------------------*/
-
-void SwInsertSectionTabPage::FillList( const SwSectionFmt* pNewFmt )
-{
- const SwSectionFmt* pFmt;
- if( !pNewFmt )
- {
- USHORT nCount = m_pWrtSh->GetSectionFmtCount();
- for(USHORT i=0;i<nCount;i++)
- {
- SectionType eTmpType;
- if( !(pFmt = &m_pWrtSh->GetSectionFmt(i))->GetParent() &&
- pFmt->IsInNodesArr() &&
- (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
- && TOX_HEADER_SECTION != eTmpType )
- {
- String* pString = new String(pFmt->GetSection()->GetName());
- aCurName.InsertEntry(*pString);
- aSubRegionED.InsertEntry(*pString);
- FillList( pFmt );
- }
- }
- }
- else
- {
- SwSections aTmpArr;
- USHORT nCnt = pNewFmt->GetChildSections(aTmpArr,SORTSECT_POS);
- if( nCnt )
- {
- SectionType eTmpType;
- for( USHORT n = 0; n < nCnt; ++n )
- if( (pFmt = aTmpArr[n]->GetFmt())->IsInNodesArr()&&
- (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
- && TOX_HEADER_SECTION != eTmpType )
- {
- String* pString = new String(pFmt->GetSection()->GetName());
- aCurName.InsertEntry(*pString);
- aSubRegionED.InsertEntry(*pString);
- FillList( pFmt );
- }
- }
- }
-}
-
// --------------------------------------------------------------
// Numerierungsformat Umsetzung:
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index ea6ab45f4ec1..f3dc55f26f4d 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -3778,6 +3778,7 @@ BOOL SwTrnsfrDdeLink::WriteData( SvStream& rStrm )
// remove mark
pServerObject->SetNoServer(); // this removes the connection between SwServerObject and mark
+ // N.B. ppMark was not loaded from file and cannot have xml:id
pMarkAccess->deleteMark(ppMark);
// recreate as Bookmark
diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index 7a63ad665aef..6bea77137ac6 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -74,6 +74,7 @@
#include <svtools/langtab.hxx>
#include <svtools/smplhint.hxx>
+#include <svx/svdview.hxx>
#include <svx/eeitem.hxx>
#include <svx/langitem.hxx>
#include <svx/outliner.hxx>
@@ -307,8 +308,9 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
/*
else if ( rHint.IsA(TYPE(SwRedlineHint) ) )
{
- SwRedline* pRedline = const_cast<SwRedline*>(((SwRedlineHint&)rHint).GetRedline());
- switch ( ((SwRedlineHint&)rHint).Which() )
+ const SwRedlineHint rRedlineHint = static_cast<const SwRedlineHint&>(rHint);
+ SwRedline* pRedline = const_cast<SwRedline*>(rRedlineHint.GetRedline());
+ switch ( rRedlineHint.Which() )
{
case SWREDLINE_INSERTED :
{
@@ -325,7 +327,8 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
case SWREDLINE_FOCUS:
{
- Focus(rBC);
+ if (rRedlineHint.GetView()== mpView)
+ Focus(rBC);
break;
}
}
@@ -333,8 +336,9 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
*/
else if ( rHint.IsA(TYPE(SwFmtFldHint) ) )
{
- SwFmtFld* pFld = const_cast <SwFmtFld*>( ((SwFmtFldHint&)rHint).GetField() );
- switch ( ((SwFmtFldHint&)rHint).Which() )
+ const SwFmtFldHint& rFmtHint = static_cast<const SwFmtFldHint&>(rHint);
+ SwFmtFld* pFld = const_cast <SwFmtFld*>( rFmtHint.GetField() );
+ switch ( rFmtHint.Which() )
{
case SWFMTFLD_INSERTED :
{
@@ -351,9 +355,10 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
if (bEmpty && !mvPostItFlds.empty())
PrepareView(true);
}
- else {
+ else
+ {
DBG_ERROR( "Inserted field not in document!" );
- }
+ }
break;
}
case SWFMTFLD_REMOVED:
@@ -371,18 +376,22 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
case SWFMTFLD_FOCUS:
{
- Focus(rBC);
+ if (rFmtHint.GetView()== mpView)
+ Focus(rBC);
break;
}
case SWFMTFLD_CHANGED:
{
- SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
+ SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- if ( pFmtFld == (*i)->GetBroadCaster() )
+ if ( pFmtFld == (*i)->GetBroadCaster() )
{
if ((*i)->pPostIt)
+ {
(*i)->pPostIt->SetPostItText();
+ mbLayout = true;
+ }
break;
}
}
@@ -390,10 +399,10 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
case SWFMTFLD_LANGUAGE:
{
- SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
+ SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- if ( pFmtFld == (*i)->GetBroadCaster() )
+ if ( pFmtFld == (*i)->GetBroadCaster() )
{
if ((*i)->pPostIt)
{
@@ -1914,3 +1923,27 @@ sal_uInt16 SwPostItMgr::SearchReplace(const SwFmtFld &pFld, const ::com::sun::st
}
return aResult;
}
+
+void SwPostItMgr::AssureStdModeAtShell()
+{
+ //#i103373# #i103645#
+ // deselect any drawing or frame and leave editing mode
+ SdrView* pSdrView = mpWrtShell->GetDrawView();
+ if ( pSdrView && pSdrView->IsTextEdit() )
+ {
+ sal_Bool bLockView = mpWrtShell->IsViewLocked();
+ mpWrtShell->LockView( sal_True );
+ mpWrtShell->EndTextEdit();
+ mpWrtShell->LockView( bLockView );
+ }
+
+ if( mpWrtShell->IsSelFrmMode() || mpWrtShell->IsObjSelected())
+ {
+ mpWrtShell->UnSelectFrm();
+ mpWrtShell->LeaveSelFrmMode();
+ mpWrtShell->EnterStdMode();
+
+ mpWrtShell->DrawSelChanged();
+ mpView->StopShellTimer();
+ }
+}
diff --git a/sw/source/ui/docvw/docvw.src b/sw/source/ui/docvw/docvw.src
index de4305bc730e..0220d9d9eddf 100644
--- a/sw/source/ui/docvw/docvw.src
+++ b/sw/source/ui/docvw/docvw.src
@@ -315,12 +315,12 @@ String STR_POSTIT_YESTERDAY
String STR_DELETE_ALL_NOTES
{
- Text [ en-US ] = "All Notes" ;
+ Text [ en-US ] = "All Comments" ;
};
String STR_DELETE_AUTHOR_NOTES
{
- Text [ en-US ] = "Notes by " ;
+ Text [ en-US ] = "Comments by " ;
};
String STR_NODATE
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index e27e6eb477c2..7d8e38443ca0 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -5568,11 +5568,12 @@ void QuickHelpData::Stop( SwWrtShell& rSh )
void QuickHelpData::FillStrArr( SwWrtShell& rSh, const String& rWord )
{
- pCalendarWrapper->LoadDefaultCalendar( rSh.GetCurLang() );
+ salhelper::SingletonRef<SwCalendarWrapper>* pCalendar = s_getCalendarWrapper();
+ (*pCalendar)->LoadDefaultCalendar( rSh.GetCurLang() );
{
uno::Sequence< i18n::CalendarItem > aNames(
- pCalendarWrapper->getMonths() );
+ (*pCalendar)->getMonths() );
for( int n = 0; n < 2; ++n )
{
for( long nPos = 0, nEnd = aNames.getLength(); nPos < nEnd; ++nPos )
@@ -5592,7 +5593,7 @@ void QuickHelpData::FillStrArr( SwWrtShell& rSh, const String& rWord )
}
}
if( !n ) // get data for the second loop
- aNames = pCalendarWrapper->getDays();
+ aNames = (*pCalendar)->getDays();
}
}
diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx
index c306e73ba695..bfea8651bc25 100644
--- a/sw/source/ui/docvw/postit.cxx
+++ b/sw/source/ui/docvw/postit.cxx
@@ -91,6 +91,7 @@
#include <vcl/svapp.hxx>
#include <vcl/gradient.hxx>
#include <vcl/salbtype.hxx> // FRound
+#include <vcl/msgbox.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/tuple/b2dtuple.hxx>
@@ -269,6 +270,8 @@ void PostItTxt::KeyInput( const KeyEvent& rKeyEvt )
bool bIsProtected = mpMarginWin->IsProtected();
if (!bIsProtected || (bIsProtected && !mpMarginWin->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
bDone = mpOutlinerView->PostKeyEvent( rKeyEvt );
+ else
+ InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
}
if (bDone)
mpMarginWin->ResizeIfNeccessary(aOldHeight,mpMarginWin->GetPostItTextHeight());
@@ -436,33 +439,6 @@ void PostItTxt::Command( const CommandEvent& rCEvt )
mpMarginWin->DocView()->HandleWheelCommands(rCEvt);
}
}
- else if (rCEvt.GetCommand() == COMMAND_SELECTIONCHANGE)
- {
- if ( mpOutlinerView )
- {
- const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData();
- ESelection aSelection = mpOutlinerView->GetEditView().GetSelection();
- aSelection.nStartPos = sal::static_int_cast<sal_uInt16, ULONG>(pData->GetStart());
- aSelection.nEndPos = sal::static_int_cast<sal_uInt16, ULONG>(pData->GetEnd());
- mpOutlinerView->GetEditView().SetSelection(aSelection);
- }
- }
- else if (rCEvt.GetCommand() == COMMAND_PREPARERECONVERSION)
- {
- if ( mpOutlinerView && mpOutlinerView->HasSelection() )
- {
- EditEngine *aEditEngine = mpOutlinerView->GetEditView().GetEditEngine();
- ESelection aSelection = mpOutlinerView->GetEditView().GetSelection();
- aSelection.Adjust();
- if( aSelection.nStartPara != aSelection.nEndPara )
- {
- xub_StrLen aParaLen = aEditEngine->GetTextLen( aSelection.nStartPara );
- aSelection.nEndPara = aSelection.nStartPara;
- aSelection.nEndPos = aParaLen;
- mpOutlinerView->GetEditView().SetSelection( aSelection );
- }
- }
- }
else
{
if ( mpOutlinerView )
@@ -477,40 +453,6 @@ void PostItTxt::DataChanged( const DataChangedEvent& aData)
Window::DataChanged( aData );
}
-XubString PostItTxt::GetSurroundingText() const
-{
- if( mpOutlinerView )
- {
- EditEngine *aEditEngine = mpOutlinerView->GetEditView().GetEditEngine();
- if( mpOutlinerView->HasSelection() )
- return mpOutlinerView->GetSelected();
- else
- {
- ESelection aSelection = mpOutlinerView->GetEditView().GetSelection();
- XubString aStr = aEditEngine->GetText(aSelection.nStartPara);
- return aStr;
- }
- }
- else
- return XubString::EmptyString();
-}
-
-Selection PostItTxt::GetSurroundingTextSelection() const
-{
- if( mpOutlinerView )
- {
- if( mpOutlinerView->HasSelection() )
- return Selection( 0, mpOutlinerView->GetSelected().Len() );
- else
- {
- ESelection aSelection = mpOutlinerView->GetEditView().GetSelection();
- return Selection( aSelection.nStartPos, aSelection.nEndPos );
- }
- }
- else
- return Selection( 0, 0 );
-}
-
IMPL_LINK( PostItTxt, WindowEventListener, VclSimpleEvent*, pWinEvent )
{
if ( pWinEvent && pWinEvent->ISA( VclWindowEvent ) )
@@ -549,6 +491,22 @@ IMPL_LINK( PostItTxt, WindowEventListener, VclSimpleEvent*, pWinEvent )
return sal_True;
}
+XubString PostItTxt::GetSurroundingText() const
+{
+ if( mpOutlinerView )
+ return mpOutlinerView->GetSurroundingText();
+ else
+ return XubString::EmptyString();
+}
+
+Selection PostItTxt::GetSurroundingTextSelection() const
+{
+ if( mpOutlinerView )
+ return mpOutlinerView->GetSurroundingTextSelection();
+ else
+ return Selection( 0, 0 );
+}
+
/************** SwMarginWin***********************************++*/
SwMarginWin::SwMarginWin(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
: Window(pParent, nBits),
@@ -735,6 +693,15 @@ void SwMarginWin::ShowAnkorOnly(const Point &aPoint)
mpShadow->setVisible(false);
}
+SfxItemSet SwMarginWin::DefaultItem()
+{
+ SfxItemSet aItem( mpView->GetDocShell()->GetPool() );
+ aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
+ aItem.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
+ EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
+ return aItem;
+}
+
void SwMarginWin::InitControls()
{
// actual window which holds the user text
@@ -779,11 +746,7 @@ void SwMarginWin::InitControls()
mpPostItTxt->SetTextView(mpOutlinerView);
mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
- SfxItemSet item(aShell->GetPool());
- item.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
- item.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
- EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
- mpOutlinerView->SetAttribs(item);
+ mpOutlinerView->SetAttribs(DefaultItem());
// TODO: ??
EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
@@ -965,7 +928,7 @@ void SwMarginWin::SetPosAndSize()
{
mpAnkor->SetAnkorState(AS_ALL);
SwMarginWin* pWin = GetTopReplyNote();
- if (IsFollow() && pWin )
+ if (pWin)
pWin->Ankor()->SetAnkorState(AS_END);
}
}
@@ -973,9 +936,9 @@ void SwMarginWin::SetPosAndSize()
void SwMarginWin::DoResize()
{
- long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
- unsigned long aWidth = GetSizePixel().Width();
- long aHeight = GetSizePixel().Height();
+ long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
+ long aHeight = GetSizePixel().Height();
+ unsigned long aWidth = GetSizePixel().Width();
if (mbMeta)
{
@@ -999,7 +962,6 @@ void SwMarginWin::DoResize()
mpVScrollbar->Hide();
}
- mpPostItTxt->SetPosSizePixel(0, 0, aWidth, aHeight);
mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width()-GetMetaButtonAreaWidth(),GetMetaHeight());
mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
@@ -1007,11 +969,21 @@ void SwMarginWin::DoResize()
{ // if we do not have a scrollbar anymore, we want to see the complete text
mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
}
- mpVScrollbar->SetPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight );
+
+ if (!Application::GetSettings().GetLayoutRTL())
+ {
+ mpPostItTxt->SetPosSizePixel(0, 0, aWidth, aHeight);
+ mpVScrollbar->SetPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight);
+ }
+ else
+ {
+ mpPostItTxt->SetPosSizePixel((aTextHeight > aHeight) && !IsPreview() ? GetScrollbarWidth() : 0 , 0, aWidth, aHeight);
+ mpVScrollbar->SetPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight);
+ }
+
mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
- //mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY());
SetScrollbar();
mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
@@ -1025,10 +997,6 @@ void SwMarginWin::DoResize()
Point aRight = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH-1)*fx.GetNumerator()/fx.GetDenominator(), aBase.Y()+17*fy.GetNumerator()/fy.GetDenominator() ) );
Point aBottom = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+2)*fx.GetNumerator()/fx.GetDenominator(), aBase.Y()+20*fy.GetNumerator()/fy.GetDenominator() ) );
- //Point aLeft = PixelToLogic(Point(mpMeta->GetPosPixel().X()+mpMeta->GetPosPixel().X()+GetSizePixel().Width()-(GetMetaButtonWidth()+10)+5,mpMeta->GetPosPixel().Y()+17));
- //Point aRight = PixelToLogic(Point(mpMeta->GetPosPixel().X()+mpMeta->GetPosPixel().X()+GetSizePixel().Width()-(GetMetaButtonWidth()+10)+11,mpMeta->GetPosPixel().Y()+17));
- //Point aBottom = PixelToLogic(Point(mpMeta->GetPosPixel().X()+mpMeta->GetPosPixel().X()+GetSizePixel().Width()-(GetMetaButtonWidth()+10)+8,mpMeta->GetPosPixel().Y()+20));
-
aPopupTriangle.clear();
aPopupTriangle.append(basegfx::B2DPoint(aLeft.X(),aLeft.Y()));
aPopupTriangle.append(basegfx::B2DPoint(aRight.X(),aRight.Y()));
@@ -1220,6 +1188,8 @@ void SwMarginWin::HideNote()
void SwMarginWin::ActivatePostIt()
{
+ mpMgr->AssureStdModeAtShell();
+
mpOutliner->ClearModifyFlag();
mpOutliner->GetUndoManager().Clear();
@@ -1280,6 +1250,8 @@ void SwMarginWin::ToggleInsMode()
void SwMarginWin::ExecuteCommand(USHORT nSlot)
{
+ mpMgr->AssureStdModeAtShell();
+
switch (nSlot)
{
case FN_POSTIT:
@@ -1444,9 +1416,7 @@ void SwMarginWin::ResetAttributes()
{
mpOutlinerView->RemoveAttribsKeepLanguages(TRUE);
mpOutliner->RemoveFields(TRUE);
- SfxItemSet aSet( mpView->GetDocShell()->GetPool() );
- aSet.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
- mpOutlinerView->SetAttribs(aSet);
+ mpOutlinerView->SetAttribs(DefaultItem());
}
sal_Int32 SwMarginWin::GetScrollbarWidth()
@@ -1504,7 +1474,7 @@ void SwMarginWin::SetViewState(ShadowState bState)
{
mpAnkor->SetAnkorState(AS_ALL);
SwMarginWin* pWin = GetTopReplyNote();
- if (IsFollow() && pWin)
+ if (pWin)
pWin->Ankor()->SetAnkorState(AS_END);
mpAnkor->setLineSolid(true);
}
@@ -1567,7 +1537,7 @@ bool SwMarginWin::IsAnyStackParentVisible()
SwMarginWin* SwMarginWin::GetTopReplyNote()
{
SwMarginWin* pTopNote = 0;
- SwMarginWin* pMarginWin = mpMgr->GetNextPostIt(KEY_PAGEUP, this);
+ SwMarginWin* pMarginWin = IsFollow() ? mpMgr->GetNextPostIt(KEY_PAGEUP, this) : 0;
while (pMarginWin)
{
pTopNote = pMarginWin;
@@ -1627,11 +1597,7 @@ void SwPostIt::SetPostItText()
else
{
Engine()->Clear();
- SfxItemSet item( DocView()->GetDocShell()->GetPool() );
- item.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
- item.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
- EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
- View()->SetAttribs(item);
+ View()->SetAttribs(DefaultItem());
View()->InsertText(mpFld->GetPar2(),false);
}
@@ -1654,8 +1620,10 @@ void SwPostIt::UpdateData()
mpFld->SetTextObject(Engine()->CreateParaObject());
DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
delete pOldField;
- // so we get a new layout of notes (ankor position is still the same and we would otherwise not get one)
+ // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one)
Mgr()->SetLayout();
+ // #i98686# if we have several views, all notes should update their text
+ mpFmtFld->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED));
DocView()->GetDocShell()->SetModified();
}
Engine()->ClearModifyFlag();
@@ -1699,7 +1667,8 @@ bool SwPostIt::CalcFollow()
SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
SwPosition aPosition( pTxtFld->GetTxtNode() );
aPosition.nContent = *pTxtFld->GetStart();
- SwTxtAttr* pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttr( aPosition.nContent.GetIndex()-1,RES_TXTATR_FIELD );
+ SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() - 1, RES_TXTATR_FIELD );
const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
return pFld && (pFld->Which()== RES_POSTITFLD);
}
@@ -1712,12 +1681,14 @@ sal_uInt32 SwPostIt::CountFollowing()
SwPosition aPosition( pTxtFld->GetTxtNode() );
aPosition.nContent = *pTxtFld->GetStart();
- SwTxtAttr* pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttr( aPosition.nContent.GetIndex()+1,RES_TXTATR_FIELD );
+ SwTxtAttr * pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() + 1, RES_TXTATR_FIELD );
SwField* pFld = pTxtAttr ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) : 0;
while (pFld && (pFld->Which()== RES_POSTITFLD))
{
aCount++;
- pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttr( aPosition.nContent.GetIndex() + aCount,RES_TXTATR_FIELD );
+ pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() + aCount, RES_TXTATR_FIELD );
pFld = pTxtAttr ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) : 0;
}
return aCount - 1;
@@ -1818,11 +1789,7 @@ void SwPostIt::InitAnswer(OutlinerParaObject* pText)
//remove all attributes and reset our standard ones
View()->GetEditView().RemoveAttribsKeepLanguages(true);
- SfxItemSet aNormalSet( DocView()->GetDocShell()->GetPool() );
- aNormalSet.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
- aNormalSet.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
- EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
- View()->SetAttribs(aNormalSet);
+ View()->SetAttribs(DefaultItem());
// lets insert an undo step so the initial text can be easily deleted
// but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
Engine()->SetModifyHdl( Link() );
@@ -1895,11 +1862,7 @@ void SwRedComment::SetPostItText()
Engine()->EnableUndo( FALSE );
Engine()->Clear();
- SfxItemSet item( DocView()->GetDocShell()->GetPool() );
- item.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
- item.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
- EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
- View()->SetAttribs(item);
+ View()->SetAttribs(DefaultItem());
View()->InsertText(pRedline->GetComment(),false);
Engine()->ClearModifyFlag();
diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx
index 85036cad7130..19ba5aefdf25 100644
--- a/sw/source/ui/docvw/srcedtw.cxx
+++ b/sw/source/ui/docvw/srcedtw.cxx
@@ -395,8 +395,10 @@ void TextViewOutWin::MouseButtonUp( const MouseEvent &rEvt )
if ( pTextView )
{
pTextView->MouseButtonUp( rEvt );
- ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->
- GetBindings().Invalidate( SID_TABLE_CELL );
+ SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_TABLE_CELL );
+ rBindings.Invalidate( SID_CUT );
+ rBindings.Invalidate( SID_COPY );
}
}
@@ -459,6 +461,7 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
if(bChange)
bDone = pTextView->KeyInput( rKEvt );
+ SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
if ( !bDone )
{
if ( !SfxViewShell::Current()->KeyInput( rKEvt ) )
@@ -466,7 +469,6 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
}
else
{
- SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
rBindings.Invalidate( SID_TABLE_CELL );
if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR )
rBindings.Update( SID_BASICIDE_STAT_POS );
@@ -478,6 +480,10 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
if( rKEvt.GetKeyCode().GetCode() == KEY_INSERT )
rBindings.Invalidate( SID_ATTR_INSERT );
}
+
+ rBindings.Invalidate( SID_CUT );
+ rBindings.Invalidate( SID_COPY );
+
SwDocShell* pDocShell = pSrcEditWin->GetSrcView()->GetDocShell();
if(pSrcEditWin->GetTextEngine()->IsModified())
{
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index f35efbe41253..dfb7823a1216 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -1615,7 +1615,7 @@ USHORT SwFldMgr::GetCurrLanguage() const
SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
if( pSh )
return pSh->GetCurLang();
- return SvxLocaleToLanguage( GetAppLocaleData().getLocale() );
+ return SvxLocaleToLanguage( SvtSysLocale().GetLocaleData().getLocale() );
}
void SwFieldType::_GetFldName()
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index 23b85f9e8339..0de17286fcad 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -136,7 +136,7 @@ SwFldDlg::SwFldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent)
::comphelper::getProcessServiceFactory(),
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
- "/org.openoffice.Office.DataAccess/ApplicationIntegration/InstalledFeatures/Writer" ) ),
+ "/org.openoffice.Office.DataAccess/Policies/Features/Writer" ) ),
-1,
utl::OConfigurationTreeRoot::CM_READONLY);
diff --git a/sw/source/ui/inc/actctrl.hxx b/sw/source/ui/inc/actctrl.hxx
index d087a0a55753..789d6883c29a 100644
--- a/sw/source/ui/inc/actctrl.hxx
+++ b/sw/source/ui/inc/actctrl.hxx
@@ -66,10 +66,8 @@ protected:
virtual void Modify();
public:
- NoSpaceEdit( Window* pParent, const ResId& rResId)
- : Edit(pParent, rResId),
- sForbiddenChars(String::CreateFromAscii(" "))
- {}
+ NoSpaceEdit( Window* pParent, const ResId& rResId);
+ virtual ~NoSpaceEdit();
void SetForbiddenChars(const String& rSet){sForbiddenChars = rSet;}
const String& GetForbiddenChars(){return sForbiddenChars;}
};
diff --git a/sw/source/ui/inc/regionsw.hxx b/sw/source/ui/inc/regionsw.hxx
index 6ad32074cae7..f5dbec86d1ef 100644
--- a/sw/source/ui/inc/regionsw.hxx
+++ b/sw/source/ui/inc/regionsw.hxx
@@ -33,35 +33,23 @@
#include <hintids.hxx>
#include <vcl/field.hxx>
#include <vcl/lstbox.hxx>
-#ifndef _EDIT_HXX //autogen
#include <vcl/edit.hxx>
-#endif
-#ifndef _BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
-#ifndef _FIXED_HXX //autogen
#include <vcl/fixed.hxx>
-#endif
-#ifndef _COMBOBOX_HXX //autogen
#include <vcl/combobox.hxx>
-#endif
-#ifndef _GROUP_HXX //autogen
#include <vcl/group.hxx>
-#endif
#include <svtools/svtreebx.hxx>
#include <sfx2/basedlgs.hxx>
#include <sfx2/tabdlg.hxx>
#include <svx/brshitem.hxx>
-#ifndef _CONDEDIT_HXX
#include <condedit.hxx>
-#endif
#include <section.hxx>
#include <fmtclds.hxx>
#include <fmtftntx.hxx>
#include <fmtclbl.hxx>
#include <numberingtypelistbox.hxx>
-#include "svx/frmdiritem.hxx"
+#include <svx/frmdiritem.hxx>
#include <vcl/image.hxx>
#include <svx/paraprev.hxx>
#include <svx/lrspitem.hxx>
@@ -179,6 +167,7 @@ class SwEditRegionDlg : public SfxModalDialog
PushButton aFilePB;
FixedText aSubRegionFT;
ComboBox aSubRegionED;
+ bool bSubRegionsFilled;
FixedLine aProtectFL;
TriStateBox aProtectCB;
@@ -239,6 +228,7 @@ class SwEditRegionDlg : public SfxModalDialog
DECL_LINK( FileNameHdl, Edit* );
DECL_LINK( DDEHdl, CheckBox* );
DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper* );
+ DECL_LINK( SubRegionEventHdl, VclWindowEvent * );
BOOL CheckPasswd(CheckBox* pBox = 0);
@@ -308,8 +298,6 @@ class SwInsertSectionTabPage : public SfxTabPage
DECL_LINK( DDEHdl, CheckBox* );
DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper* );
- void FillList( const SwSectionFmt* pFmt = 0 );
-
public:
SwInsertSectionTabPage(Window *pParent, const SfxItemSet &rAttrSet);
virtual ~SwInsertSectionTabPage();
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 5656f6df1ab4..3c526c11d193 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -165,6 +165,8 @@ public:
// Selektion von Rahmen aufheben
void UnSelectFrm();
+ void Invalidate();
+
// Tabellenzellen selektieren fuer Bearbeiten von Formeln in der Ribbonbar
inline void SelTblCells( const Link &rLink, BOOL bMark = TRUE );
inline void EndSelTblCells();
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
index 0f3ae1d61764..865908568cd6 100644
--- a/sw/source/ui/lingu/olmenu.cxx
+++ b/sw/source/ui/lingu/olmenu.cxx
@@ -62,6 +62,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
#include <svx/dlgutil.hxx>
#include <svtools/itemset.hxx>
#include <svx/langitem.hxx>
@@ -168,7 +169,7 @@ LanguageType lcl_CheckLanguage(
SvtLinguOptions aLinguOpt;
SvtLinguConfig().GetOptions( aLinguOpt );
// The default document language from "Tools/Options - Language Settings - Languages: Western"
- aLangList[0] = aLinguOpt.nDefaultLanguage;
+ aLangList[0] = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN);
// The one from "Tools/Options - Language Settings - Languages: User interface"
aLangList[1] = rSettings.GetUILanguage();
// The one from "Tools/Options - Language Settings - Languages: Locale setting"
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 5ea6c1012baf..3f0c634f2b24 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -48,6 +48,7 @@
#include <vcl/field.hxx>
#include <vcl/svapp.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <svtools/syslocale.hxx>
#include <svx/sizeitem.hxx>
#include <svx/pageitem.hxx>
#include <svtools/eitem.hxx>
@@ -183,7 +184,7 @@ SwFootNotePage::SwFootNotePage(Window *pParent, const SfxItemSet &rSet) :
SetMetric( aMaxHeightEdit, aMetric );
SetMetric( aDistEdit, aMetric );
SetMetric( aLineDistEdit, aMetric );
- MeasurementSystem eSys = GetAppLocaleData().getMeasurementSystemEnum();
+ MeasurementSystem eSys = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
long nHeightValue = MEASURE_METRIC != eSys ? 1440 : 1134;
aMaxHeightEdit.SetValue(aMaxHeightEdit.Normalize(nHeightValue),FUNIT_TWIP);;
}
diff --git a/sw/source/ui/misc/redlndlg.src b/sw/source/ui/misc/redlndlg.src
index 81bc3e6fad93..e653f7e546a4 100644
--- a/sw/source/ui/misc/redlndlg.src
+++ b/sw/source/ui/misc/redlndlg.src
@@ -64,7 +64,7 @@ ModalDialog DLG_MOD_REDLINE_ACCEPT
{
HelpID = HID_REDLINE_AUTOFMT_ACCEPT ;
REDLNDLG
- Text [ en-US ] = "Accept or Reject AutoFormat Changes";
+ Text [ en-US ] = "Accept or Reject AutoCorrect Changes";
};
Menu MN_REDLINE_POPUP
diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx
index c8422f665b7d..07745f3c01bb 100644
--- a/sw/source/ui/ribbar/inputwin.cxx
+++ b/sw/source/ui/ribbar/inputwin.cxx
@@ -461,8 +461,8 @@ IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller )
aPam.Move( fnMoveForward, fnGoSection );
IDocumentContentOperations* pIDCO = pWrtShell->getIDocumentContentOperations();
- pIDCO->Delete( aPam );
- pIDCO->Insert( aPam, sNew, true );
+ pIDCO->DeleteRange( aPam );
+ pIDCO->InsertString( aPam, sNew );
pWrtShell->EndAllAction();
sOldFml = sNew;
}
@@ -499,7 +499,7 @@ IMPL_LINK( SwInputWindow, ModifyHdl, InputEdit*, EMPTYARG )
sNew += CH_LRE;
sNew += aEdit.GetText();
sNew += CH_PDF;
- pWrtShell->SwEditShell::Insert( sNew );
+ pWrtShell->SwEditShell::Insert2( sNew );
pWrtShell->EndAllAction();
sOldFml = sNew;
}
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
index 054220be6707..1a34e2972956 100755
--- a/sw/source/ui/shells/annotsh.cxx
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -347,7 +347,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
}
- pOLV->InsertText( String(cIns), TRUE );
+ pOLV->InsertText( String(cIns));
rReq.Done();
break;
}
@@ -799,16 +799,18 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
switch (nSlot)
{
case SID_CUT:
- pOLV->Cut();
+ if ( (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
+ pOLV->Cut();
break;
case SID_COPY:
- pOLV->Copy();
+ if( pOLV->HasSelection() )
+ pOLV->Copy();
break;
case SID_PASTE:
if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
pOLV->Paste();
break;
- case FN_PASTESPECIAL:
+ case SID_PASTE_SPECIAL:
{
if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
{
@@ -886,7 +888,7 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet)
break;
}
case SID_PASTE:
- case FN_PASTESPECIAL:
+ case SID_PASTE_SPECIAL:
{
if( !bPastePossible )
rSet.DisableItem( nWhich );
@@ -1380,6 +1382,8 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
}
}
+ rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+
if (rView.GetPostItMgr()->GetActivePostIt())
rView.GetPostItMgr()->GetActivePostIt()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActivePostIt()->GetPostItTextHeight());
}
@@ -1595,7 +1599,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
aFontSet.Set( aOldSet );
// String einfuegen
- pOLV->InsertText( sSym, TRUE );
+ pOLV->InsertText( sSym);
// attributieren (Font setzen)
SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 0c17c85dd301..9f5ee6195e81 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -301,11 +301,9 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
if ( rSh.HasSelection() )
{
SwTransferable* pTransfer = new SwTransferable( rSh );
-/*??*/ uno::Reference<
- datatransfer::XTransferable > xRef(
- pTransfer );
+/*??*/ uno::Reference< datatransfer::XTransferable > xRef( pTransfer );
- if ( nId == SID_CUT )
+ if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) )
pTransfer->Cut();
else
{
@@ -405,7 +403,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
}
break;
- case FN_PASTESPECIAL:
+ case SID_PASTE_SPECIAL:
{
TransferableDataHelper aDataHelper(
TransferableDataHelper::CreateFromSystemClipboard(
@@ -481,10 +479,10 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
rSet.DisableItem( SID_PASTE );
break;
- case FN_PASTESPECIAL:
+ case SID_PASTE_SPECIAL:
if( !GetView().IsPasteSpecialAllowed() )
{
- rSet.DisableItem( FN_PASTESPECIAL );
+ rSet.DisableItem( SID_PASTE_SPECIAL );
rSet.DisableItem( SID_PASTE_UNFORMATTED );
}
break;
@@ -539,6 +537,8 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq)
default:
DBG_ERROR("falscher Dispatcher");
}
+
+ GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
}
/*--------------------------------------------------------------------
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index d56cb88e9db8..11874ca5b151 100644
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -828,15 +828,20 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq)
return;
OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+
+ ESelection aSel(pOLV->GetSelection());
+ const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
sal_uInt16 nId = rReq.GetSlot();
switch( nId )
{
case SID_CUT:
- pOLV->Cut();
+ if (bCopy)
+ pOLV->Cut();
return;
case SID_COPY:
- pOLV->Copy();
+ if (bCopy)
+ pOLV->Copy();
return;
case SID_PASTE:
@@ -888,8 +893,8 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
}
break;
- case FN_PASTESPECIAL:
- rSet.DisableItem( FN_PASTESPECIAL );
+ case SID_PASTE_SPECIAL:
+ rSet.DisableItem( SID_PASTE_SPECIAL );
break;
// --> OD 2008-06-20 #151110#
case SID_CLIPBOARD_FORMAT_ITEMS:
diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx
index 99a2bf71bca7..9f1d49ebe067 100644
--- a/sw/source/ui/shells/drwtxtsh.cxx
+++ b/sw/source/ui/shells/drwtxtsh.cxx
@@ -514,7 +514,7 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq)
case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
}
- pOLV->InsertText( String(cIns), TRUE );
+ pOLV->InsertText( String(cIns));
rReq.Done();
}
break;
@@ -640,6 +640,7 @@ void SwDrawTextShell::ExecUndo(SfxRequest &rReq)
pUndoManager->Redo(0);
}
bCallBase = FALSE;
+ GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
}
break;
}
@@ -856,7 +857,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
aFontSet.Set( aOldSet );
// String einfuegen
- pOLV->InsertText( sSym, TRUE );
+ pOLV->InsertText( sSym );
// attributieren (Font setzen)
SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
diff --git a/sw/source/ui/shells/shells.src b/sw/source/ui/shells/shells.src
index 9036f05fd983..8a5a29046bd6 100644
--- a/sw/source/ui/shells/shells.src
+++ b/sw/source/ui/shells/shells.src
@@ -98,7 +98,7 @@ String STR_REDLINE_DELETED
};
String STR_REDLINE_AUTOFMT
{
- Text [ en-US ] = "AutoFormat";
+ Text [ en-US ] = "AutoCorrect";
Text [ x-comment ] = " ";
};
String STR_REDLINE_FORMATED
@@ -118,12 +118,12 @@ String STR_REDLINE_FMTCOLLSET
};
String STR_REDLINE_TITLE
{
- Text [ en-US ] = "AutoFormat";
+ Text [ en-US ] = "AutoCorrect";
Text [ x-comment ] = " ";
};
String STR_REDLINE_MSG
{
- Text [ en-US ] = "AutoFormat completed.\nYou can accept or reject all changes,\nor accept or reject particular changes.";
+ Text [ en-US ] = "AutoCorrect completed.\nYou can accept or reject all changes,\nor accept or reject particular changes.";
Text [ x-comment ] = " ";
};
String STR_REDLINE_ACCEPT_ALL
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
index 599be5f1f1e1..0dedb918aaf5 100644
--- a/sw/source/ui/shells/textfld.cxx
+++ b/sw/source/ui/shells/textfld.cxx
@@ -382,7 +382,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
SwFmtFld* pSwFmtFld = static_cast<SwFmtFld*>(pFirst);
if ( pSwFmtFld->GetFld() == pPostIt )
{
- pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS ) );
+ pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS, &GetView() ) );
break;
}
pFirst = aIter++;
@@ -402,7 +402,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
sComment = pRedline->GetComment();
if ( sComment == String(rtl::OUString::createFromAscii("")) )
GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED));
- const_cast<SwRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS));
+ const_cast<SwRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView()));
}
*/
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index 742e93b646c2..7e38c1297d0b 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -819,7 +819,11 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
rSh.Push();
const BOOL bCrsrInHidden = rSh.SelectHiddenRange();
- rSh.Pop(FALSE);
+ // --> OD 2009-08-05 #i103839#, #b6855246#
+ // Do not call method <SwCrsrShell::Pop(..)> with 1st parameter = <FALSE>
+ // in order to avoid that the view jumps to the visible cursor.
+ rSh.Pop();
+ // <--
while ( nWhich )
{
@@ -827,8 +831,11 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
{
case SID_INSERT_SOUND:
case SID_INSERT_VIDEO:
+ /*!SvxPluginFileDlg::IsAvailable( nWhich ) ||
+
+ discussed with mba: for performance reasons we skip the IsAvailable call here
+ */
if ( GetShell().IsSelFrmMode() ||
- !SvxPluginFileDlg::IsAvailable( nWhich ) ||
SFX_CREATE_MODE_EMBEDDED == eCreateMode || bCrsrInHidden )
{
rSet.DisableItem( nWhich );
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index 8928a505dd87..977dc77c98d3 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -488,9 +488,10 @@ void SwTextShell::Execute(SfxRequest &rReq)
RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1,
RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
- RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
- RES_TXTATR_CJK_RUBY, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0
};
@@ -1044,7 +1045,14 @@ void SwTextShell::Execute(SfxRequest &rReq)
// --> OD 2008-03-18 #refactorlists#
String sContinuedListId;
const SwNumRule* pRule =
- rWrtSh.SearchNumRule( FALSE, TRUE, FALSE, -1, sContinuedListId );
+ rWrtSh.SearchNumRule( false, true, false, -1, sContinuedListId );
+ // --> OD 2009-08-26 #i86492#
+ // Search also for bullet list
+ if ( !pRule )
+ {
+ pRule = rWrtSh.SearchNumRule( false, false, false, -1, sContinuedListId );
+ }
+ // <--
if ( pRule )
{
rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
@@ -1623,14 +1631,23 @@ void SwTextShell::GetState( SfxItemSet &rSet )
break;
case FN_NUM_CONTINUE:
{
- if ( rSh.GetCurNumRule() )
- rSet.DisableItem(nWhich);
- else
+ // --> OD 2009-08-26 #i86492#
+ // Allow continuation of previous list, even if at current cursor
+ // a list is active.
+// if ( rSh.GetCurNumRule() )
+// rSet.DisableItem(nWhich);
+// else
+ // <--
{
- // --> OD 2008-03-18 #refactorlists#
+ // --> OD 2009-08-26 #i86492#
+ // Search also for bullet list
String aDummy;
const SwNumRule* pRule =
- rSh.SearchNumRule( FALSE, TRUE, FALSE, -1, aDummy );
+ rSh.SearchNumRule( false, true, false, -1, aDummy );
+ if ( !pRule )
+ {
+ pRule = rSh.SearchNumRule( false, false, false, -1, aDummy );
+ }
// <--
if ( !pRule )
rSet.DisableItem(nWhich);
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index bd1a00c2f120..93ae56fbca73 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -1580,6 +1580,10 @@ void SwPagePreView::GetState( SfxItemSet& rSet )
{
switch(nWhich)
{
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
+ rSet.DisableItem(nWhich);
+ break;
case FN_START_OF_DOCUMENT:
{
if ( pPagePrevwLay->IsPageVisible( 1 ) )
@@ -2491,6 +2495,10 @@ SfxPrinter* SwPagePreView::GetPrinter( BOOL bCreate )
USHORT SwPagePreView::SetPrinter( SfxPrinter *pNew, USHORT nDiffFlags, bool )
{
ViewShell &rSh = *GetViewShell();
+ SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
SwEditShell &rESh = (SwEditShell&)rSh; //Buh...
if( ( SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP ) & nDiffFlags )
{
diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx
index 34cfebe663a1..d30e85c5ee71 100644
--- a/sw/source/ui/uiview/srcview.cxx
+++ b/sw/source/ui/uiview/srcview.cxx
@@ -57,6 +57,7 @@
#include <sfx2/app.hxx>
#include <sfx2/objface.hxx>
#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/fcontnr.hxx>
#include <sfx2/request.hxx>
@@ -457,17 +458,21 @@ void SwSrcView::Execute(SfxRequest& rReq)
break;
case SID_UNDO:
pTextView->Undo();
+ GetViewFrame()->GetBindings().InvalidateAll(FALSE);
break;
case SID_REDO:
pTextView->Redo();
+ GetViewFrame()->GetBindings().InvalidateAll(FALSE);
break;
case SID_REPEAT:
break;
case SID_CUT:
- pTextView->Cut();
+ if(pTextView->HasSelection())
+ pTextView->Cut();
break;
case SID_COPY:
- pTextView->Copy();
+ if(pTextView->HasSelection())
+ pTextView->Copy();
break;
case SID_PASTE:
pTextView->Paste();
@@ -588,6 +593,8 @@ void SwSrcView::GetState(SfxItemSet& rSet)
case SID_DIRECTEXPORTDOCASPDF:
case SID_EXPORTDOC:
case SID_REPEAT:
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
rSet.DisableItem(nWhich);
break;
case SID_CUT:
@@ -731,6 +738,10 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
{
SwDocShell* pDocSh = GetDocShell();
+ SfxPrinter* pOld = pDocSh->GetDoc()->getPrinter( false );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags )
{
pDocSh->GetDoc()->setPrinter( pNew, true, true );
diff --git a/sw/source/ui/uiview/uivwimp.cxx b/sw/source/ui/uiview/uivwimp.cxx
index d9634fc301ec..4154139f6ee1 100644
--- a/sw/source/ui/uiview/uivwimp.cxx
+++ b/sw/source/ui/uiview/uivwimp.cxx
@@ -335,48 +335,14 @@ void SAL_CALL SwClipboardChangeListener::changedContents( const CLIP_NMSPC::Clip
SfxBindings& rBind = pView->GetViewFrame()->GetBindings();
rBind.Invalidate( SID_PASTE );
- rBind.Invalidate( FN_PASTESPECIAL );
+ rBind.Invalidate( SID_PASTE_SPECIAL );
rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
}
void SwClipboardChangeListener::AddRemoveListener( BOOL bAdd )
{
- try
- {
- do {
-
-#ifdef _DONT_WORD_FOR_WEBTOP_
-JP 4.7.2001: change for WebTop - get Clipboard from the Window.
- Reference< XMultiServiceFactory > xFact(
- ::comphelper::getProcessServiceFactory() );
- if( !xFact.is() )
- break;
- Reference< XClipboard > xClipboard( xFact->createInstance(
- ::rtl::OUString::createFromAscii(
- "com.sun.star.datatransfer.clipboard.SystemClipboard" )),
- UNO_QUERY );
-#else
- Reference< XClipboard > xClipboard(
- pView->GetEditWin().GetClipboard() );
-#endif
- if( !xClipboard.is() )
- break;
-
- Reference< XClipboardNotifier > xClpbrdNtfr( xClipboard, UNO_QUERY );
- if( xClpbrdNtfr.is() )
- {
- Reference< XClipboardListener > xClipEvtLstnr( this );
- if( bAdd )
- xClpbrdNtfr->addClipboardListener( xClipEvtLstnr );
- else
- xClpbrdNtfr->removeClipboardListener( xClipEvtLstnr );
- }
- } while ( FALSE );
- }
- catch( const uno::Exception& )
- {
- }
+ pView->AddRemoveClipboardListener( Reference< XClipboardListener >( this ), bAdd );
}
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 5e3afd2ed8fa..a13f25d8933e 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -56,93 +56,46 @@
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
#include <unotxvw.hxx>
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
-#ifndef _SWHINTS_HXX
#include <swhints.hxx>
-#endif
#include <swmodule.hxx>
#include <inputwin.hxx>
#include <chartins.hxx>
#include <uivwimp.hxx>
#include <uitool.hxx>
#include <edtwin.hxx>
-#ifndef _TEXTSH_HXX
#include <textsh.hxx>
-#endif
-#ifndef _LISTSH_HXX
#include <listsh.hxx>
-#endif
-#ifndef _TABSH_HXX
#include <tabsh.hxx>
-#endif
-#ifndef _GRFSH_HXX
#include <grfsh.hxx>
-#endif
-#ifndef _MEDIASH_HXX
#include <mediash.hxx>
-#endif
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <frmsh.hxx>
-#ifndef _OLESH_HXX
#include <olesh.hxx>
-#endif
-#ifndef _DRAWSH_HXX
#include <drawsh.hxx>
-#endif
-#ifndef _DRAWBASE_HXX
#include <drawbase.hxx>
-#endif
-#ifndef _DRFORMSH_HXX
#include <drformsh.hxx>
-#endif
-#ifndef _DRWTXTSH_HXX
#include <drwtxtsh.hxx>
-#endif
-#ifndef _BEZIERSH_HXX
#include <beziersh.hxx>
-#endif
-#ifndef _GLOBDOC_HXX
#include <globdoc.hxx>
-#endif
#include <scroll.hxx>
-#ifndef _GLOBDOC_HXX
#include <globdoc.hxx>
-#endif
#include <navipi.hxx>
#include <gloshdl.hxx>
#include <usrpref.hxx>
-#ifndef _SRCVIEW_HXX
#include <srcview.hxx>
-#endif
#include <doc.hxx>
-#ifndef _WDOCSH_HXX
+#include <drawdoc.hxx>
#include <wdocsh.hxx>
-#endif
-#ifndef _WVIEW_HXX
#include <wview.hxx>
-#endif
#include <workctrl.hxx>
#include <wrtsh.hxx>
-#ifndef _BARCFG_HXX
#include <barcfg.hxx>
-#endif
-#ifndef _PVIEW_HXX
#include <pview.hxx>
-#endif
#include <swdtflvr.hxx>
-#ifndef _VIEW_HRC
#include <view.hrc>
-#endif
-#ifndef _GLOBDOC_HRC
#include <globdoc.hrc>
-#endif
-#ifndef _FRMUI_HRC
#include <frmui.hrc>
-#endif
#include <cfgitems.hxx>
#include <prtopt.hxx>
#include <swprtopt.hxx>
@@ -152,9 +105,7 @@
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/scanner/ScannerContext.hpp>
#include <com/sun/star/scanner/XScannerManager.hpp>
-#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/unohlp.hxx>
-#endif
#include <rtl/ustrbuf.hxx>
#include <xmloff/xmluconv.hxx>
@@ -673,7 +624,7 @@ void SwView::_CheckReadonlyState()
SID_UNDO,
SID_REDO, SID_REPEAT, SID_PASTE,
SID_PASTE_UNFORMATTED,
- FN_PASTESPECIAL, SID_SBA_BRW_INSERT,
+ SID_PASTE_SPECIAL, SID_SBA_BRW_INSERT,
SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK,
SID_CHARMAP, FN_INSERT_SOFT_HYPHEN,
FN_INSERT_HARDHYPHEN, FN_INSERT_HARD_SPACE, FN_INSERT_BREAK,
@@ -1781,7 +1732,18 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
CreateTab();
else
KillTab();
- SfxBoolItem aItem( SID_FM_DESIGN_MODE, !GetDocShell()->IsReadOnly());
+ bool bReadonly = GetDocShell()->IsReadOnly();
+ //#i76332# if document is to be opened in alive-mode then this has to be regarded while switching from readonly-mode to edit-mode
+ if( !bReadonly )
+ {
+ SwDrawDocument * pDrawDoc = 0;
+ if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (GetDocShell()->GetDoc()->GetDrawModel() ) ) )
+ {
+ if( !pDrawDoc->GetOpenInDesignMode() )
+ break;// don't touch the design mode
+ }
+ }
+ SfxBoolItem aItem( SID_FM_DESIGN_MODE, !bReadonly);
GetDispatcher().Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_ASYNCHRON,
&aItem, 0L );
}
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 6a03909d92f9..77c06f44c494 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -1233,7 +1233,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
if (nPageCnt != nCnt) // Basic benachrichtigen
{
nPageCnt = nCnt;
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, GetViewFrame()->GetObjectShell()), FALSE);
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), FALSE);
}
}
break;
diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx
index 6d219e71ab30..5e45f9a9a48c 100644
--- a/sw/source/ui/uiview/viewprt.cxx
+++ b/sw/source/ui/uiview/viewprt.cxx
@@ -141,6 +141,10 @@ void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter* pNew, BOOL bWeb )
USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
{
SwWrtShell &rSh = GetWrtShell();
+ SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags )
{
rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true );
@@ -431,9 +435,19 @@ ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent,
}
pProgress->Stop();
- pProgress->DeleteOnEndPrint();
- pPrinter->EndJob();
- return pPrinter->GetError();
+ if ( pPrinter->IsJobActive() )
+ {
+ pProgress->DeleteOnEndPrint();
+ pPrinter->EndJob();
+ return pPrinter->GetError();
+ }
+ else
+ {
+ // the next call might destroy pPrinter (in case it is not the usual document printer); so get the error before
+ ULONG nError = pPrinter->GetError();
+ pProgress->DeleteOnEndPrint();
+ return nError;
+ }
}
diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index ac2f6b5ce130..82da0914124a 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -217,7 +217,7 @@ SwFilterDetect::~SwFilterDetect()
BOOL bIsStorage = aMedium.IsStorage();
if ( bIsStorage )
{
- uno::Reference< embed::XStorage > xStorage = aMedium.GetStorage();
+ uno::Reference< embed::XStorage > xStorage = aMedium.GetStorage( sal_False );
if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE )
{
// error during storage creation means _here_ that the medium
diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx
index 0c67e24b8d10..2b302245f53b 100644
--- a/sw/source/ui/uno/unoatxt.cxx
+++ b/sw/source/ui/uno/unoatxt.cxx
@@ -416,7 +416,8 @@ sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextR
if(pxCursor)
{
SwPaM* pUnoCrsr = pxCursor->GetPaM();
- bRet |= (true == pxCursor->GetDoc()->Copy( *pUnoCrsr, aPos, false ));
+ bRet = pxCursor->GetDoc()->CopyRange( *pUnoCrsr, aPos, false )
+ || bRet;
}
else
{
@@ -424,7 +425,8 @@ sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextR
if(pBkmk && pBkmk->IsExpanded())
{
SwPaM aTmp(pBkmk->GetOtherMarkPos(), pBkmk->GetMarkPos());
- bRet |= (true == pxRange->GetDoc()->Copy(aTmp, aPos, false));
+ bRet = pxRange->GetDoc()->CopyRange(aTmp, aPos, false)
+ || bRet;
}
}
}
diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx
index 3acb1e25bd31..fed4c2b201cf 100644
--- a/sw/source/ui/uno/unomailmerge.cxx
+++ b/sw/source/ui/uno/unomailmerge.cxx
@@ -830,9 +830,9 @@ uno::Any SAL_CALL SwXMailMerge::execute(
DBG_ASSERT( !pOldSrc || pOldSrc == this, "Ooops... different event source already set." );
pMgr->SetMailMergeEvtSrc( this ); // launch events for listeners
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, xCurDocSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh));
BOOL bSucc = pMgr->MergeNew( aMergeDesc );
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, xCurDocSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh));
pMgr->SetMailMergeEvtSrc( pOldSrc );
diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx
index 19d0faa0bfce..bfdb2b1d2460 100644
--- a/sw/source/ui/uno/unomod.cxx
+++ b/sw/source/ui/uno/unomod.cxx
@@ -125,7 +125,10 @@ enum SwPrintSettingsPropertyHandles
HANDLE_PRINTSET_PAPER_FROM_SETUP,
HANDLE_PRINTSET_TABLES,
HANDLE_PRINTSET_SINGLE_JOBS,
- HANDLE_PRINTSET_EMPTY_PAGES
+ HANDLE_PRINTSET_EMPTY_PAGES,
+ HANDLE_PRINTSET_PROSPECT_RTL,
+ HANDLE_PRINTSET_PLACEHOLDER,
+ HANDLE_PRINTSET_HIDDEN_TEXT
};
static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
@@ -186,14 +189,17 @@ static ChainablePropertySetInfo * lcl_createPrintSettingsInfo()
{ RTL_CONSTASCII_STRINGPARAM ( "PrintControls" ), HANDLE_PRINTSET_CONTROLS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintDrawings" ), HANDLE_PRINTSET_DRAWINGS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintGraphics" ), HANDLE_PRINTSET_GRAPHICS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintHiddenText"), HANDLE_PRINTSET_HIDDEN_TEXT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintLeftPages" ), HANDLE_PRINTSET_LEFT_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintPageBackground" ), HANDLE_PRINTSET_PAGE_BACKGROUND , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintProspect" ), HANDLE_PRINTSET_PROSPECT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintProspectRTL" ), HANDLE_PRINTSET_PROSPECT_RTL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintReversed" ), HANDLE_PRINTSET_REVERSED , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintRightPages" ), HANDLE_PRINTSET_RIGHT_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintFaxName" ), HANDLE_PRINTSET_FAX_NAME , CPPUTYPE_OUSTRING, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintPaperFromSetup" ), HANDLE_PRINTSET_PAPER_FROM_SETUP , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintTables" ), HANDLE_PRINTSET_TABLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintTextPlaceholder"), HANDLE_PRINTSET_PLACEHOLDER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintSingleJobs" ), HANDLE_PRINTSET_SINGLE_JOBS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM ( "PrintEmptyPages" ), HANDLE_PRINTSET_EMPTY_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
{ 0, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 }
@@ -456,6 +462,24 @@ void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo,
throw lang::IllegalArgumentException();
}
break;
+ case HANDLE_PRINTSET_PROSPECT_RTL:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintProspect_RTL(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_PLACEHOLDER:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintTextPlaceholder(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_HIDDEN_TEXT:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintHiddenText(bVal);
+ }
+ break;
default:
throw UnknownPropertyException();
}
@@ -550,6 +574,21 @@ void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo,
rValue <<= mpPrtOpt->GetFaxName();
}
break;
+ case HANDLE_PRINTSET_PROSPECT_RTL:
+ {
+ rValue <<= mpPrtOpt->IsPrintProspect_RTL();
+ }
+ break;
+ case HANDLE_PRINTSET_PLACEHOLDER:
+ {
+ rValue <<= mpPrtOpt->IsPrintTextPlaceholder();
+ }
+ break;
+ case HANDLE_PRINTSET_HIDDEN_TEXT:
+ {
+ rValue <<= mpPrtOpt->IsPrintHiddenText();
+ }
+ break;
default:
throw UnknownPropertyException();
}
@@ -1024,3 +1063,4 @@ Sequence< OUString > SwXViewSettings::getSupportedServiceNames(void) throw( Runt
pArray[0] = C2U("com.sun.star.text.ViewSettings");
return aRet;
}
+
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 04a26d47b324..db81543fb883 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -81,7 +81,13 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/document/RedlineDisplayType.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/reflection/XIdlClassProvider.hpp>
#include <svx/linkmgr.hxx>
#include <svx/unofill.hxx>
#include <svx/unolingu.hxx>
@@ -236,15 +242,23 @@ sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rI
Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(RuntimeException)
{
Any aRet = SwXTextDocumentBaseClass::queryInterface(rType);
- if(aRet.getValueType() == getVoidCppuType())
+ if ( !aRet.hasValue() )
aRet = SfxBaseModel::queryInterface(rType);
- if(aRet.getValueType() == getVoidCppuType() &&
+ if ( !aRet.hasValue() &&
rType == ::getCppuType((Reference<lang::XMultiServiceFactory>*)0))
{
Reference<lang::XMultiServiceFactory> xTmp = this;
aRet <<= xTmp;
}
- if(aRet.getValueType() == getVoidCppuType())
+
+ if ( !aRet.hasValue()
+ && rType != ::getCppuType((Reference< com::sun::star::document::XDocumentEventBroadcaster>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::frame::XController>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::frame::XFrame>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::script::XInvocation>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::reflection::XIdlClassProvider>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::beans::XFastPropertySet>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::awt::XWindow>*)0))
{
GetNumberFormatter();
if(xNumFmtAgg.is())
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index ce02579370a9..e86270c55e12 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -906,16 +906,17 @@ SwContentTree::SwContentTree(Window* pParent, const ResId& rResId) :
sRename(SW_RES(ST_RENAME)),
sReadonlyIdx(SW_RES(ST_READONLY_IDX)),
sInvisible(SW_RES(ST_INVISIBLE)),
- sPostItShow(SW_RES(ST_POSTIT_SHOW)),
- sPostItHide(SW_RES(ST_POSTIT_HIDE)),
- sPostItDelete(SW_RES(ST_POSTIT_DELETE)),
+
+ sPostItShow(SW_RES(ST_POSTIT_SHOW)),
+ sPostItHide(SW_RES(ST_POSTIT_HIDE)),
+ sPostItDelete(SW_RES(ST_POSTIT_DELETE)),
pHiddenShell(0),
- pActiveShell(0),
- pConfig(SW_MOD()->GetNavigationConfig()),
+ pActiveShell(0),
+ pConfig(SW_MOD()->GetNavigationConfig()),
nActiveBlock(0),
- nHiddenBlock(0),
+ nHiddenBlock(0),
nRootType(USHRT_MAX),
nLastSelType(USHRT_MAX),
@@ -2929,6 +2930,7 @@ void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode)
break;
case CONTENT_TYPE_POSTIT:
+ pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell();
if(nMode == EDIT_MODE_DELETE)
{
if (((SwPostItContent*)pCnt)->IsPostIt())
@@ -3097,6 +3099,7 @@ void SwContentTree::GotoContent(SwContent* pCnt)
}
break;
case CONTENT_TYPE_POSTIT:
+ pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell();
if (((SwPostItContent*)pCnt)->IsPostIt())
pActiveShell->GotoFld(*((SwPostItContent*)pCnt)->GetPostIt());
else
diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx
index 98224a81edde..275b49a4c9e4 100644
--- a/sw/source/ui/utlui/initui.cxx
+++ b/sw/source/ui/utlui/initui.cxx
@@ -54,6 +54,7 @@
#ifndef _DBMGR_HXX
#include <dbmgr.hxx>
#endif
+#include <svtools/syslocale.hxx>
#include <unomid.h>
@@ -261,7 +262,7 @@ ImpAutoFmtNameListLoader::ImpAutoFmtNameListLoader( SvStringsDtor& rLst )
p->SearchAndReplace(C2S("%1"), C2S(",,"));
p->SearchAndReplace(C2S("%2"), C2S("''"));
#else
- LocaleDataWrapper& rLclD = GetAppLocaleData();
+ const LocaleDataWrapper& rLclD = SvtSysLocale().GetLocaleData();
//unter richtigen Betriebssystemen funktioniert es auch so
p->SearchAndReplace(C2S("%1"), rLclD.getDoubleQuotationMarkStart());
p->SearchAndReplace(C2S("%2"), rLclD.getDoubleQuotationMarkEnd());
diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx
index 38a4aa9a85e8..5a0030d9dd85 100644
--- a/sw/source/ui/utlui/numfmtlb.cxx
+++ b/sw/source/ui/utlui/numfmtlb.cxx
@@ -120,7 +120,7 @@ void NumFormatListBox::Init(short nFormatType, BOOL bUsrFmts)
if (pView)
eCurLanguage = pView->GetWrtShell().GetCurLang();
else
- eCurLanguage = SvxLocaleToLanguage( GetAppLocaleData().getLocale() );
+ eCurLanguage = SvxLocaleToLanguage( SvtSysLocale().GetLocaleData().getLocale() );
if (bUsrFmts == FALSE)
{
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
index fb64e51c97f8..cb6a3888d45f 100644
--- a/sw/source/ui/utlui/uitool.cxx
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -39,6 +39,7 @@
#include <unotools/collatorwrapper.hxx>
#include <svtools/urihelper.hxx>
#include <svtools/stritem.hxx>
+#include <svtools/syslocale.hxx>
#include <sfx2/app.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
@@ -732,7 +733,7 @@ SwTwips GetTableWidth( SwFrmFmt* pFmt, SwTabCols& rCols, USHORT *pPercent,
String GetAppLangDateTimeString( const DateTime& rDT )
{
- LocaleDataWrapper& rAppLclData = GetAppLocaleData();
+ const LocaleDataWrapper& rAppLclData = SvtSysLocale().GetLocaleData();
String sRet( rAppLclData.getDate( rDT ));
( sRet += ' ' ) += rAppLclData.getTime( rDT, FALSE, FALSE );
return sRet;
diff --git a/sw/source/ui/utlui/utlui.src b/sw/source/ui/utlui/utlui.src
index 2882146a8986..a67fe47aca4b 100644
--- a/sw/source/ui/utlui/utlui.src
+++ b/sw/source/ui/utlui/utlui.src
@@ -226,7 +226,7 @@ String STR_CONTENT_TYPE_DRAWOBJECT
};
String STR_CONTENT_TYPE_POSTIT
{
- Text [ en-US ] = "Notes" ;
+ Text [ en-US ] = "Comments" ;
};
String STR_CONTENT_TYPE_SINGLE_OUTLINE
{
@@ -270,7 +270,7 @@ String STR_CONTENT_TYPE_SINGLE_INDEX
};
String STR_CONTENT_TYPE_SINGLE_POSTIT
{
- Text [ en-US ] = "Note" ;
+ Text [ en-US ] = "Comment" ;
};
String STR_CONTENT_TYPE_SINGLE_DRAWOBJECT
{
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index 5ed81c942ea4..b46cbdb3a1a5 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -73,6 +73,13 @@ using namespace ::com::sun::star::util;
static long nStartDragX = 0, nStartDragY = 0;
static BOOL bStartDrag = FALSE;
+void SwWrtShell::Invalidate()
+{
+ // to avoid making the slot volatile, invalidate it everytime if something could have been changed
+ // this is still much cheaper than asking for the state every 200 ms (and avoid background processing)
+ GetView().GetViewFrame()->GetBindings().Invalidate( FN_STAT_SELMODE );
+}
+
BOOL SwWrtShell::SelNearestWrd()
{
MV_KONTEXT(this);
@@ -336,6 +343,7 @@ void SwWrtShell::UnSelectFrm()
// Rahmenselektion aufheben mit garantiert ungueltiger Position
Point aPt(LONG_MIN, LONG_MIN);
SelectObj(aPt, 0);
+ GetView().LeaveDrawCreate();
SwTransferable::ClearSelection( *this );
}
@@ -374,6 +382,7 @@ long SwWrtShell::ResetSelect(const Point *,BOOL)
*/
GetChgLnk().Call(this);
}
+ Invalidate();
SwTransferable::ClearSelection( *this );
return 1;
}
@@ -408,6 +417,7 @@ void SwWrtShell::SttSelect()
fnKillSel = &SwWrtShell::Ignore;
fnSetCrsr = &SwWrtShell::SetCrsr;
bInSelect = TRUE;
+ Invalidate();
SwTransferable::CreateSelection( *this );
}
/*
@@ -576,6 +586,7 @@ void SwWrtShell::EnterStdMode()
fnKillSel = &SwWrtShell::ResetSelect;
}
}
+ Invalidate();
SwTransferable::ClearSelection( *this );
}
@@ -654,6 +665,7 @@ void SwWrtShell::EnterAddMode()
bExtMode = FALSE;
if(SwCrsrShell::HasSelection())
CreateCrsr();
+ Invalidate();
}
@@ -664,6 +676,7 @@ void SwWrtShell::LeaveAddMode()
fnKillSel = &SwWrtShell::ResetSelect;
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
bAddMode = FALSE;
+ Invalidate();
}
/*
@@ -676,6 +689,7 @@ void SwWrtShell::EnterBlockMode()
EnterStdMode();
bBlockMode = TRUE;
CrsrToBlockCrsr();
+ Invalidate();
}
@@ -685,6 +699,7 @@ void SwWrtShell::LeaveBlockMode()
bBlockMode = FALSE;
BlockCrsrToCrsr();
EndSelect();
+ Invalidate();
}
// Einfuegemodus
@@ -699,6 +714,7 @@ void SwWrtShell::SetInsMode( BOOL bOn )
GetView().GetViewFrame()->GetBindings().SetState( aTmp );
StartAction();
EndAction();
+ Invalidate();
}
//Overwrite mode is incompatible with red-lining
void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode )
@@ -743,6 +759,7 @@ void SwWrtShell::EnterSelFrmMode(const Point *pPos)
fnDrag = &SwWrtShell::BeginFrmDrag;
fnEndDrag = &SwWrtShell::UpdateLayoutFrm;
SwBaseShell::SetFrmMode( FLY_DRAG_START, this );
+ Invalidate();
}
@@ -755,6 +772,7 @@ void SwWrtShell::LeaveSelFrmMode()
bStartDrag = FALSE;
Edit();
SwBaseShell::SetFrmMode( FLY_DRAG_END, this );
+ Invalidate();
}
/*------------------------------------------------------------------------
Beschreibung: Rahmengebundenes Macro ausfuehren
@@ -798,6 +816,7 @@ long SwWrtShell::UpdateLayoutFrm(const Point *pPt, BOOL )
long SwWrtShell::ToggleAddMode()
{
bAddMode ? LeaveAddMode(): EnterAddMode();
+ Invalidate();
return !bAddMode;
}
@@ -805,6 +824,7 @@ long SwWrtShell::ToggleAddMode()
long SwWrtShell::ToggleBlockMode()
{
bBlockMode ? LeaveBlockMode(): EnterBlockMode();
+ Invalidate();
return !bBlockMode;
}
@@ -812,6 +832,7 @@ long SwWrtShell::ToggleBlockMode()
long SwWrtShell::ToggleExtMode()
{
bExtMode ? LeaveExtMode() : EnterExtMode();
+ Invalidate();
return !bExtMode;
}
/*
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index a98e8ade9824..cd6bb82739ca 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -70,7 +70,6 @@
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
#include <fmtftn.hxx>
-#include <fmthbsh.hxx>
#include <fmtpdsc.hxx>
#ifndef _WDOCSH_HXX
#include <wdocsh.hxx>
@@ -245,6 +244,7 @@ void SwWrtShell::Insert( const String &rStr )
BOOL bStarted = FALSE, bHasSel = HasSelection(),
bCallIns = bIns /*|| bHasSel*/;
+ bool bDeleted = false;
if( bHasSel || ( !bIns && SelectHiddenRange() ) )
{
@@ -268,7 +268,7 @@ void SwWrtShell::Insert( const String &rStr )
StartUndo(UNDO_REPLACE, &aRewriter);
bStarted = TRUE;
- DelRight();
+ bDeleted = DelRight() != 0;
}
/*
@@ -283,7 +283,8 @@ JP 21.01.98: Ueberschreiben ueberschreibt nur die Selektion, nicht das
}
else
*/
- bCallIns ? SwEditShell::Insert( rStr ) : SwEditShell::Overwrite( rStr );
+ bCallIns ?
+ SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr );
if( bStarted )
@@ -1103,7 +1104,7 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
pDoc->FindNumRulePtr(pColl->GetNumRule( FALSE ).GetValue());
if ( !pDirectCollRule )
{
- pCollRule = 0L;
+ pCollRule = 0;
}
}
// --> OD 2006-11-20 #i71764#
@@ -1141,12 +1142,9 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
{
// check, if numbering of the outline level of the pararaph
// style is active. If not, activate this outline level.
- //nActivateOutlineLvl = pColl->GetOutlineLevel(); //#outline level,zhaojianwei
- //ASSERT( /*nActivateOutlineLvl >= 0 &&*/ nActivateOutlineLvl < MAXLEVEL,
nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(), //<-end,zhaojianwei
"<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
- //if ( /*nActivateOutlineLvl >= 0 &&*/ nActivateOutlineLvl < MAXLEVEL && //#outline level,zhaojianwei
if ( pColl->IsAssignedToListLevelOfOutlineStyle() && //<-end,zhaojianwei
pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
== SVX_NUM_NUMBER_NONE )
@@ -1162,31 +1160,40 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
}
else
{
+ // --> OD 2009-08-27 #i101234#
// activate outline numbering, because from the precondition
// it's known, that <SwEdit::HasNumber()> == FALSE
bActivateOutlineRule = true;
- //nActivateOutlineLvl = pColl->GetOutlineLevel(); //#outline level,zhaojianwei
nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei
}
}
else if ( !pNumRule )
{
- // activate outline numbering, because from the precondition
- // it's known, that <SwEdit::HasNumber()> == FALSE
- bActivateOutlineRule = true;
- //nActivateOutlineLvl = pColl->GetOutlineLevel(); //#outline level,zhaojianwei
+ // --> OD 2009-08-27 #i101234#
+ // Check, if corresponding list level of the outline numbering
+ // has already a numbering format set.
nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei,need further consideration
+ if ( pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
+ == SVX_NUM_NUMBER_NONE )
+ {
+ // activate outline numbering, because from the precondition
+ // it's known, that <SwEdit::HasNumber()> == FALSE
+ bActivateOutlineRule = true;
+ }
+ else
+ {
+ // turning on outline numbering at current cursor position
+ bContinueFoundNumRule = true;
+ }
+ // <--
}
else
{
// check, if numbering of the outline level of the pararaph
// style is active. If not, activate this outline level.
- //nActivateOutlineLvl = pColl->GetOutlineLevel();
nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//#outline level,zhaojianwei
- //ASSERT( /*nActivateOutlineLvl >= 0 &&*/ nActivateOutlineLvl < MAXLEVEL,
ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(),//#outline level,zhaojianwei
"<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
- //if ( /*nActivateOutlineLvl >= 0 &&*/ nActivateOutlineLvl < MAXLEVEL &&
if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&//#outline level,zhaojianwei
pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
== SVX_NUM_NUMBER_NONE )
@@ -1212,12 +1219,12 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
{
if ( !pNumRule->IsAutoRule() )
{
- pNumRule = 0L;
+ pNumRule = 0;
}
else if ( pNumRule == GetDoc()->GetOutlineNumRule() &&
!bActivateOutlineRule && !bContinueFoundNumRule )
{
- pNumRule = 0L;
+ pNumRule = 0;
}
}
// <--
@@ -1229,7 +1236,7 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
if ( !pNumRule )
{
pNumRule = GetDoc()->SearchNumRule( *GetCrsr()->GetPoint(),
- FALSE, bNum, FALSE, 0,
+ false, bNum, false, 0,
sContinuedListId );
bContinueFoundNumRule = pNumRule != 0;
}
@@ -1290,11 +1297,12 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
}
else
{
+ // --> OD 2009-08-27 #i95907#
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ numfunc::GetDefaultPositionAndSpaceMode() );
// --> OD 2008-02-11 #newlistlevelattrs#
- SwNumRule aNumRule( GetUniqueNumRuleName(),
- // --> OD 2008-06-06 #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
- // <--
+ SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode );
+ // <--
// <--
// Zeichenvorlage an die Numerierung haengen
SwCharFmt* pChrFmt;
@@ -1315,9 +1323,10 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
pChrFmt = GetCharFmtFromPool( RES_POOLCHR_BUL_LEVEL );
}
- SwTxtNode * pTxtNode =
- GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
- USHORT nWidthOfTabs = pTxtNode->GetWidthOfLeadingTabs();
+ const SwTxtNode* pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+ const SwTwips nWidthOfTabs = pTxtNode
+ ? pTxtNode->GetWidthOfLeadingTabs()
+ : 0;
GetDoc()->RemoveLeadingWhiteSpace( *GetCrsr()->GetPoint() );
const bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh);
@@ -1339,16 +1348,21 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
}
- if(bHtml && nLvl)
- {
- // 1/2" fuer HTML
- aFmt.SetLSpace(720);
- aFmt.SetAbsLSpace(nLvl * 720);
- }
- else if ( nWidthOfTabs > 0 )
+ // --> OD 2009-08-26 #i95907#
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
- aFmt.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
+ if(bHtml && nLvl)
+ {
+ // 1/2" fuer HTML
+ aFmt.SetLSpace(720);
+ aFmt.SetAbsLSpace(nLvl * 720);
+ }
+ else if ( nWidthOfTabs > 0 )
+ {
+ aFmt.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
+ }
}
+ // <--
// --> FME 2005-01-21 #i38904# Default alignment for
// numbering/bullet should be rtl in rtl paragraph:
@@ -1361,6 +1375,21 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
aNumRule.Set( nLvl, aFmt );
}
+ // --> OD 2009-08-26 #i95907#
+ if ( pTxtNode &&
+ ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ short nTxtNodeFirstLineOffset( 0 );
+ pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset );
+ const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() +
+ nTxtNodeFirstLineOffset;
+ if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 )
+ {
+ const SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs;
+ aNumRule.ChangeIndent( nIndentChange );
+ }
+ }
+ // <--
// --> OD 2008-02-08 #newlistlevelattrs#
// reset indent attribute on applying list style
// --> OD 2008-03-17 #refactorlists#
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
index 42cfb1c3d64d..9141279f141b 100644
--- a/sw/source/ui/wrtsh/wrtsh2.cxx
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -93,10 +93,13 @@ void SwWrtShell::Insert(SwField &rFld)
StartUndo(UNDO_INSERT, &aRewriter);
+ bool bDeleted = false;
if( HasSelection() )
- DelRight();
+ {
+ bDeleted = DelRight() != 0;
+ }
- SwEditShell::Insert(rFld);
+ SwEditShell::Insert2(rFld, bDeleted);
EndUndo(UNDO_INSERT);
EndAllAction();
}
diff --git a/sw/uiconfig/sglobal/accelerator/en-GB/default.xml b/sw/uiconfig/sglobal/accelerator/en-GB/default.xml
index 2bc37195b94c..c07ff3fcf036 100644
--- a/sw/uiconfig/sglobal/accelerator/en-GB/default.xml
+++ b/sw/uiconfig/sglobal/accelerator/en-GB/default.xml
@@ -111,5 +111,5 @@
<accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_DIVIDE" accel:mod1="true" xlink:href=".uno:InsertZWSP"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/uiconfig/sglobal/accelerator/en-US/default.xml b/sw/uiconfig/sglobal/accelerator/en-US/default.xml
index 2bc37195b94c..c07ff3fcf036 100644
--- a/sw/uiconfig/sglobal/accelerator/en-US/default.xml
+++ b/sw/uiconfig/sglobal/accelerator/en-US/default.xml
@@ -111,5 +111,5 @@
<accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_DIVIDE" accel:mod1="true" xlink:href=".uno:InsertZWSP"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/uiconfig/swform/accelerator/en-US/default.xml b/sw/uiconfig/swform/accelerator/en-US/default.xml
index 5abee2cd7fd6..82fcdd073baa 100644
--- a/sw/uiconfig/swform/accelerator/en-US/default.xml
+++ b/sw/uiconfig/swform/accelerator/en-US/default.xml
@@ -116,5 +116,5 @@
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_Y" accel:mod1="true" xlink:href=".uno:Redo"/>
<accel:item accel:code="KEY_Z" accel:mod1="true" xlink:href=".uno:Undo"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/uiconfig/swreport/accelerator/en-GB/default.xml b/sw/uiconfig/swreport/accelerator/en-GB/default.xml
index 0e5e41657cd9..83f88ade9dc1 100644
--- a/sw/uiconfig/swreport/accelerator/en-GB/default.xml
+++ b/sw/uiconfig/swreport/accelerator/en-GB/default.xml
@@ -111,5 +111,5 @@
<accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_DIVIDE" accel:mod1="true" xlink:href=".uno:InsertZWSP"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/uiconfig/swreport/accelerator/en-US/default.xml b/sw/uiconfig/swreport/accelerator/en-US/default.xml
index 0e5e41657cd9..83f88ade9dc1 100644
--- a/sw/uiconfig/swreport/accelerator/en-US/default.xml
+++ b/sw/uiconfig/swreport/accelerator/en-US/default.xml
@@ -111,5 +111,5 @@
<accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_DIVIDE" accel:mod1="true" xlink:href=".uno:InsertZWSP"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/uiconfig/swriter/accelerator/en-GB/default.xml b/sw/uiconfig/swriter/accelerator/en-GB/default.xml
index 22f5da31722c..cb04b7f52a07 100644
--- a/sw/uiconfig/swriter/accelerator/en-GB/default.xml
+++ b/sw/uiconfig/swriter/accelerator/en-GB/default.xml
@@ -111,5 +111,5 @@
<accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_DIVIDE" accel:mod1="true" xlink:href=".uno:InsertZWSP"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/uiconfig/swriter/accelerator/en-US/default.xml b/sw/uiconfig/swriter/accelerator/en-US/default.xml
index 22f5da31722c..cb04b7f52a07 100644
--- a/sw/uiconfig/swriter/accelerator/en-US/default.xml
+++ b/sw/uiconfig/swriter/accelerator/en-US/default.xml
@@ -111,5 +111,5 @@
<accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_DIVIDE" accel:mod1="true" xlink:href=".uno:InsertZWSP"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/uiconfig/swxform/accelerator/en-GB/default.xml b/sw/uiconfig/swxform/accelerator/en-GB/default.xml
index 0e5e41657cd9..83f88ade9dc1 100644
--- a/sw/uiconfig/swxform/accelerator/en-GB/default.xml
+++ b/sw/uiconfig/swxform/accelerator/en-GB/default.xml
@@ -111,5 +111,5 @@
<accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_DIVIDE" accel:mod1="true" xlink:href=".uno:InsertZWSP"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/uiconfig/swxform/accelerator/en-US/default.xml b/sw/uiconfig/swxform/accelerator/en-US/default.xml
index 0e5e41657cd9..83f88ade9dc1 100644
--- a/sw/uiconfig/swxform/accelerator/en-US/default.xml
+++ b/sw/uiconfig/swxform/accelerator/en-US/default.xml
@@ -111,5 +111,5 @@
<accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
<accel:item accel:code="KEY_X" accel:shift="true" accel:mod1="true" xlink:href=".uno:RemoveDirectCharFormats"/>
<accel:item accel:code="KEY_DIVIDE" accel:mod1="true" xlink:href=".uno:InsertZWSP"/>
- <accel:item accel:code="KEY_N" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertAnnotation"/>
</accel:acceleratorlist>
diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk
index 608002af5d21..4b3abf042b8e 100644
--- a/sw/util/makefile.mk
+++ b/sw/util/makefile.mk
@@ -190,6 +190,7 @@ SHL3STDLIBS= \
$(SVLLIB) \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
+ $(I18NISOLANGLIB) \
$(COMPHELPERLIB) \
$(UCBHELPERLIB) \
$(CPPUHELPERLIB) \