summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/SwNumberTree/SwNodeNum.cxx2
-rw-r--r--sw/source/core/access/acccontext.cxx8
-rw-r--r--sw/source/core/access/accframe.cxx4
-rw-r--r--sw/source/core/access/accmap.cxx12
-rw-r--r--sw/source/core/access/accpara.cxx22
-rw-r--r--sw/source/core/access/accportions.cxx2
-rw-r--r--sw/source/core/attr/calbck.cxx9
-rw-r--r--sw/source/core/bastyp/init.cxx20
-rw-r--r--sw/source/core/crsr/crsrsh.cxx22
-rw-r--r--sw/source/core/crsr/crstrvl.cxx7
-rw-r--r--sw/source/core/crsr/swcrsr.cxx15
-rw-r--r--sw/source/core/crsr/trvltbl.cxx2
-rw-r--r--sw/source/core/crsr/viscrs.cxx5
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx100
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx2
-rw-r--r--sw/source/core/doc/DocumentLayoutManager.cxx2
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx55
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx14
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx8
-rw-r--r--sw/source/core/doc/doc.cxx9
-rw-r--r--sw/source/core/doc/docbasic.cxx4
-rw-r--r--sw/source/core/doc/docbm.cxx8
-rw-r--r--sw/source/core/doc/doccomp.cxx97
-rw-r--r--sw/source/core/doc/docdesc.cxx5
-rw-r--r--sw/source/core/doc/docdraw.cxx12
-rw-r--r--sw/source/core/doc/docfmt.cxx2
-rw-r--r--sw/source/core/doc/docftn.cxx10
-rw-r--r--sw/source/core/doc/doclay.cxx8
-rw-r--r--sw/source/core/doc/docnew.cxx2
-rw-r--r--sw/source/core/doc/docnum.cxx23
-rw-r--r--sw/source/core/doc/docsort.cxx28
-rw-r--r--sw/source/core/doc/doctxm.cxx8
-rw-r--r--sw/source/core/doc/fmtcol.cxx2
-rw-r--r--sw/source/core/doc/htmltbl.cxx66
-rw-r--r--sw/source/core/doc/notxtfrm.cxx12
-rw-r--r--sw/source/core/doc/number.cxx6
-rw-r--r--sw/source/core/doc/sortopt.cxx5
-rw-r--r--sw/source/core/doc/tblcpy.cxx8
-rw-r--r--sw/source/core/doc/tblrwcl.cxx24
-rw-r--r--sw/source/core/doc/textboxhelper.cxx100
-rw-r--r--sw/source/core/docnode/ndtbl.cxx39
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx30
-rw-r--r--sw/source/core/docnode/node.cxx19
-rw-r--r--sw/source/core/docnode/section.cxx2
-rw-r--r--sw/source/core/draw/dcontact.cxx18
-rw-r--r--sw/source/core/draw/dflyobj.cxx2
-rw-r--r--sw/source/core/draw/dview.cxx6
-rw-r--r--sw/source/core/edit/autofmt.cxx25
-rw-r--r--sw/source/core/edit/edattr.cxx16
-rw-r--r--sw/source/core/edit/edfld.cxx2
-rw-r--r--sw/source/core/edit/editsh.cxx2
-rw-r--r--sw/source/core/edit/ednumber.cxx2
-rw-r--r--sw/source/core/fields/dbfld.cxx2
-rw-r--r--sw/source/core/fields/ddetbl.cxx8
-rw-r--r--sw/source/core/fields/expfld.cxx16
-rw-r--r--sw/source/core/frmedt/fecopy.cxx6
-rw-r--r--sw/source/core/frmedt/fefly1.cxx16
-rw-r--r--sw/source/core/frmedt/feshview.cxx125
-rw-r--r--sw/source/core/frmedt/fetab.cxx46
-rw-r--r--sw/source/core/frmedt/tblsel.cxx2
-rw-r--r--sw/source/core/graphic/grfatr.cxx2
-rw-r--r--sw/source/core/graphic/ndgrf.cxx29
-rw-r--r--sw/source/core/inc/DocumentContentOperationsManager.hxx3
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx1
-rw-r--r--sw/source/core/inc/SwGrammarMarkUp.hxx2
-rw-r--r--sw/source/core/inc/SwUndoFmt.hxx3
-rw-r--r--sw/source/core/inc/UndoTable.hxx2
-rw-r--r--sw/source/core/inc/cntfrm.hxx19
-rw-r--r--sw/source/core/inc/docsort.hxx2
-rw-r--r--sw/source/core/inc/flyfrm.hxx3
-rw-r--r--sw/source/core/inc/frmtool.hxx2
-rw-r--r--sw/source/core/inc/pagefrm.hxx4
-rw-r--r--sw/source/core/inc/tabfrm.hxx18
-rw-r--r--sw/source/core/inc/tblrwcl.hxx2
-rw-r--r--sw/source/core/inc/txtfrm.hxx2
-rw-r--r--sw/source/core/inc/unometa.hxx2
-rw-r--r--sw/source/core/inc/wrong.hxx6
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx4
-rw-r--r--sw/source/core/layout/atrfrm.cxx141
-rw-r--r--sw/source/core/layout/dbg_lay.cxx2
-rw-r--r--sw/source/core/layout/fly.cxx3
-rw-r--r--sw/source/core/layout/frmtool.cxx18
-rw-r--r--sw/source/core/layout/layact.cxx15
-rw-r--r--sw/source/core/layout/paintfrm.cxx154
-rw-r--r--sw/source/core/layout/tabfrm.cxx38
-rw-r--r--sw/source/core/layout/trvlfrm.cxx6
-rw-r--r--sw/source/core/layout/wsfrm.cxx71
-rw-r--r--sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx4
-rw-r--r--sw/source/core/table/swnewtable.cxx6
-rw-r--r--sw/source/core/table/swtable.cxx27
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx44
-rw-r--r--sw/source/core/text/SwGrammarMarkUp.cxx6
-rw-r--r--sw/source/core/text/frmcrsr.cxx16
-rw-r--r--sw/source/core/text/frmform.cxx27
-rw-r--r--sw/source/core/text/frmpaint.cxx4
-rw-r--r--sw/source/core/text/inftxt.cxx33
-rw-r--r--sw/source/core/text/inftxt.hxx7
-rw-r--r--sw/source/core/text/itradj.cxx4
-rw-r--r--sw/source/core/text/itratr.cxx6
-rw-r--r--sw/source/core/text/itrcrsr.cxx60
-rw-r--r--sw/source/core/text/itrform2.cxx117
-rw-r--r--sw/source/core/text/itrpaint.cxx12
-rw-r--r--sw/source/core/text/itrtxt.cxx10
-rw-r--r--sw/source/core/text/itrtxt.hxx8
-rw-r--r--sw/source/core/text/porfld.cxx28
-rw-r--r--sw/source/core/text/porfly.cxx15
-rw-r--r--sw/source/core/text/porfly.hxx3
-rw-r--r--sw/source/core/text/porglue.cxx2
-rw-r--r--sw/source/core/text/porlay.cxx25
-rw-r--r--sw/source/core/text/porlay.hxx10
-rw-r--r--sw/source/core/text/porlin.cxx6
-rw-r--r--sw/source/core/text/porlin.hxx12
-rw-r--r--sw/source/core/text/pormulti.cxx137
-rw-r--r--sw/source/core/text/pormulti.hxx2
-rw-r--r--sw/source/core/text/porrst.cxx8
-rw-r--r--sw/source/core/text/portxt.cxx2
-rw-r--r--sw/source/core/text/possiz.hxx30
-rw-r--r--sw/source/core/text/redlnitr.cxx6
-rw-r--r--sw/source/core/text/redlnitr.hxx2
-rw-r--r--sw/source/core/text/txtdrop.cxx24
-rw-r--r--sw/source/core/text/txtfld.cxx3
-rw-r--r--sw/source/core/text/txtfly.cxx10
-rw-r--r--sw/source/core/text/txtfrm.cxx16
-rw-r--r--sw/source/core/text/txtftn.cxx2
-rw-r--r--sw/source/core/text/txttab.cxx30
-rw-r--r--sw/source/core/text/wrong.cxx16
-rw-r--r--sw/source/core/tox/ToxTextGenerator.cxx2
-rw-r--r--sw/source/core/tox/tox.cxx8
-rw-r--r--sw/source/core/tox/txmsrt.cxx4
-rw-r--r--sw/source/core/txtnode/SwGrammarContact.cxx8
-rw-r--r--sw/source/core/txtnode/atrfld.cxx27
-rw-r--r--sw/source/core/txtnode/atrftn.cxx4
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx4
-rw-r--r--sw/source/core/txtnode/fntcache.cxx36
-rw-r--r--sw/source/core/txtnode/fntcap.cxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx99
-rw-r--r--sw/source/core/txtnode/swfont.cxx2
-rw-r--r--sw/source/core/txtnode/thints.cxx70
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx2
-rw-r--r--sw/source/core/txtnode/txtedt.cxx103
-rw-r--r--sw/source/core/undo/SwUndoFmt.cxx4
-rw-r--r--sw/source/core/undo/undobj1.cxx2
-rw-r--r--sw/source/core/undo/undraw.cxx2
-rw-r--r--sw/source/core/undo/unnum.cxx2
-rw-r--r--sw/source/core/undo/untbl.cxx18
-rw-r--r--sw/source/core/undo/untblk.cxx6
-rw-r--r--sw/source/core/unocore/unocoll.cxx5
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx30
-rw-r--r--sw/source/core/unocore/unodraw.cxx4
-rw-r--r--sw/source/core/unocore/unofield.cxx4
-rw-r--r--sw/source/core/unocore/unoframe.cxx23
-rw-r--r--sw/source/core/unocore/unoidx.cxx10
-rw-r--r--sw/source/core/unocore/unomap.cxx18
-rw-r--r--sw/source/core/unocore/unomap1.cxx6
-rw-r--r--sw/source/core/unocore/unoobj.cxx78
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx4
-rw-r--r--sw/source/core/unocore/unorefmk.cxx27
-rw-r--r--sw/source/core/unocore/unosett.cxx297
-rw-r--r--sw/source/core/unocore/unostyle.cxx20
-rw-r--r--sw/source/core/unocore/unotbl.cxx23
-rw-r--r--sw/source/core/unocore/unotext.cxx6
-rw-r--r--sw/source/core/unocore/unotextmarkup.cxx8
-rw-r--r--sw/source/core/view/pagepreviewlayout.cxx12
-rw-r--r--sw/source/core/view/vdraw.cxx6
-rw-r--r--sw/source/core/view/viewimp.cxx3
-rw-r--r--sw/source/core/view/viewsh.cxx70
-rw-r--r--sw/source/core/view/vnew.cxx10
-rw-r--r--sw/source/core/view/vprint.cxx2
-rw-r--r--sw/source/filter/ascii/ascatr.cxx43
-rw-r--r--sw/source/filter/ascii/parasc.cxx247
-rw-r--r--sw/source/filter/ascii/wrtasc.cxx22
-rw-r--r--sw/source/filter/ascii/wrtasc.hxx1
-rw-r--r--sw/source/filter/basflt/fltini.cxx21
-rw-r--r--sw/source/filter/basflt/fltshell.cxx225
-rw-r--r--sw/source/filter/basflt/iodetect.cxx8
-rw-r--r--sw/source/filter/html/README42
-rw-r--r--sw/source/filter/html/SwAppletImpl.cxx18
-rw-r--r--sw/source/filter/html/css1atr.cxx4
-rw-r--r--sw/source/filter/html/htmlatr.cxx235
-rw-r--r--sw/source/filter/html/htmlcss1.cxx18
-rw-r--r--sw/source/filter/html/htmlctxt.cxx72
-rw-r--r--sw/source/filter/html/htmldrawreader.cxx6
-rw-r--r--sw/source/filter/html/htmlfld.cxx4
-rw-r--r--sw/source/filter/html/htmlfly.cxx30
-rw-r--r--sw/source/filter/html/htmlfly.hxx27
-rw-r--r--sw/source/filter/html/htmlflywriter.cxx245
-rw-r--r--sw/source/filter/html/htmlform.cxx68
-rw-r--r--sw/source/filter/html/htmlforw.cxx2
-rw-r--r--sw/source/filter/html/htmlftn.cxx18
-rw-r--r--sw/source/filter/html/htmlgrin.cxx8
-rw-r--r--sw/source/filter/html/htmlnum.cxx14
-rw-r--r--sw/source/filter/html/htmlnum.hxx66
-rw-r--r--sw/source/filter/html/htmlnumreader.cxx8
-rw-r--r--sw/source/filter/html/htmlplug.cxx7
-rw-r--r--sw/source/filter/html/htmlreqifreader.cxx162
-rw-r--r--sw/source/filter/html/htmlreqifreader.hxx4
-rw-r--r--sw/source/filter/html/htmlsect.cxx6
-rw-r--r--sw/source/filter/html/htmltab.cxx117
-rw-r--r--sw/source/filter/html/htmltabw.cxx4
-rw-r--r--sw/source/filter/html/parcss1.cxx2
-rw-r--r--sw/source/filter/html/parcss1.hxx16
-rw-r--r--sw/source/filter/html/svxcss1.cxx124
-rw-r--r--sw/source/filter/html/svxcss1.hxx38
-rw-r--r--sw/source/filter/html/swhtml.cxx138
-rw-r--r--sw/source/filter/html/swhtml.hxx112
-rw-r--r--sw/source/filter/html/wrthtml.cxx57
-rw-r--r--sw/source/filter/html/wrthtml.hxx16
-rw-r--r--sw/source/filter/inc/fltini.hxx2
-rw-r--r--sw/source/filter/inc/fltshell.hxx73
-rw-r--r--sw/source/filter/inc/msfilter.hxx2
-rw-r--r--sw/source/filter/inc/wrtswtbl.hxx44
-rw-r--r--sw/source/filter/writer/writer.cxx12
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx12
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx98
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx24
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx45
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx2
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx18
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx8
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx31
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx25
-rw-r--r--sw/source/filter/ww8/ww8graf2.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx133
-rw-r--r--sw/source/filter/ww8/ww8par.hxx15
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx10
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx27
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx16
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx24
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx19
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx3
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx2
-rw-r--r--sw/source/filter/xml/xmlexpit.cxx12
-rw-r--r--sw/source/filter/xml/xmlimp.cxx26
-rw-r--r--sw/source/filter/xml/xmlimpit.cxx45
-rw-r--r--sw/source/filter/xml/xmliteme.cxx33
-rw-r--r--sw/source/filter/xml/xmlitemm.cxx12
-rw-r--r--sw/source/filter/xml/xmlithlp.cxx3
-rw-r--r--sw/source/filter/xml/xmlmeta.cxx2
-rw-r--r--sw/source/filter/xml/xmltble.cxx27
-rw-r--r--sw/source/filter/xml/xmltbli.cxx24
-rw-r--r--sw/source/filter/xml/xmltbli.hxx2
-rw-r--r--sw/source/filter/xml/xmltexte.cxx67
-rw-r--r--sw/source/ui/chrdlg/break.cxx8
-rw-r--r--sw/source/ui/chrdlg/chardlg.cxx8
-rw-r--r--sw/source/ui/chrdlg/drpcps.cxx10
-rw-r--r--sw/source/ui/chrdlg/numpara.cxx6
-rw-r--r--sw/source/ui/chrdlg/swuiccoll.cxx2
-rw-r--r--sw/source/ui/config/mailconfigpage.cxx22
-rw-r--r--sw/source/ui/config/optload.cxx9
-rw-r--r--sw/source/ui/config/optpage.cxx71
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx118
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx12
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.hxx6
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.cxx4
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.hxx2
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.cxx10
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.hxx6
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.cxx2
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.hxx2
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.cxx4
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.hxx2
-rw-r--r--sw/source/ui/dbui/mmresultdialogs.cxx14
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx18
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx28
-rw-r--r--sw/source/ui/envelp/envfmt.cxx6
-rw-r--r--sw/source/ui/envelp/envlop1.cxx4
-rw-r--r--sw/source/ui/envelp/envprt.cxx6
-rw-r--r--sw/source/ui/envelp/envprt.hxx6
-rw-r--r--sw/source/ui/envelp/label1.cxx4
-rw-r--r--sw/source/ui/envelp/labprt.cxx44
-rw-r--r--sw/source/ui/envelp/labprt.hxx3
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx6
-rw-r--r--sw/source/ui/envelp/swuilabimp.hxx4
-rw-r--r--sw/source/ui/fldui/flddb.cxx2
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx6
-rw-r--r--sw/source/ui/fldui/fldvar.cxx2
-rw-r--r--sw/source/ui/fldui/javaedit.cxx21
-rw-r--r--sw/source/ui/frmdlg/column.cxx14
-rw-r--r--sw/source/ui/frmdlg/cption.cxx2
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx43
-rw-r--r--sw/source/ui/frmdlg/wrap.cxx42
-rw-r--r--sw/source/ui/inc/mmresultdialogs.hxx8
-rw-r--r--sw/source/ui/index/cnttab.cxx24
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx51
-rw-r--r--sw/source/ui/misc/bookmark.cxx2
-rw-r--r--sw/source/ui/misc/docfnote.cxx61
-rw-r--r--sw/source/ui/misc/glossary.cxx4
-rw-r--r--sw/source/ui/misc/impfnote.hxx3
-rw-r--r--sw/source/ui/misc/insfnote.cxx23
-rw-r--r--sw/source/ui/misc/linenum.cxx10
-rw-r--r--sw/source/ui/misc/num.cxx2
-rw-r--r--sw/source/ui/misc/outline.cxx16
-rw-r--r--sw/source/ui/misc/pgfnote.cxx4
-rw-r--r--sw/source/ui/misc/pggrid.cxx8
-rw-r--r--sw/source/ui/misc/srtdlg.cxx18
-rw-r--r--sw/source/ui/misc/titlepage.cxx8
-rw-r--r--sw/source/ui/table/colwd.cxx6
-rw-r--r--sw/source/ui/table/convert.cxx24
-rw-r--r--sw/source/ui/table/instable.cxx36
-rw-r--r--sw/source/ui/table/tabledlg.cxx26
-rw-r--r--sw/source/ui/table/tautofmt.cxx4
-rw-r--r--sw/source/uibase/app/appenv.cxx8
-rw-r--r--sw/source/uibase/app/applab.cxx7
-rw-r--r--sw/source/uibase/app/appopt.cxx8
-rw-r--r--sw/source/uibase/app/docsh2.cxx7
-rw-r--r--sw/source/uibase/app/docshini.cxx2
-rw-r--r--sw/source/uibase/app/docst.cxx25
-rw-r--r--sw/source/uibase/app/docstyle.cxx7
-rw-r--r--sw/source/uibase/app/swmodul1.cxx2
-rw-r--r--sw/source/uibase/app/swmodule.cxx18
-rw-r--r--sw/source/uibase/config/modcfg.cxx8
-rw-r--r--sw/source/uibase/config/usrpref.cxx2
-rw-r--r--sw/source/uibase/config/viewopt.cxx2
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx7
-rw-r--r--sw/source/uibase/dbui/dbtree.cxx2
-rw-r--r--sw/source/uibase/dbui/mailmergehelper.cxx12
-rw-r--r--sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx6
-rw-r--r--sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx12
-rw-r--r--sw/source/uibase/dochdl/gloshdl.cxx14
-rw-r--r--sw/source/uibase/docvw/AnnotationMenuButton.cxx2
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx4
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx15
-rw-r--r--sw/source/uibase/docvw/FrameControlsManager.cxx1
-rw-r--r--sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx4
-rw-r--r--sw/source/uibase/docvw/PageBreakWin.cxx4
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx2
-rw-r--r--sw/source/uibase/docvw/SidebarWinAcc.cxx2
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx16
-rw-r--r--sw/source/uibase/docvw/edtwin2.cxx2
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx15
-rw-r--r--sw/source/uibase/envelp/labelcfg.cxx8
-rw-r--r--sw/source/uibase/fldui/fldmgr.cxx12
-rw-r--r--sw/source/uibase/frmdlg/colex.cxx8
-rw-r--r--sw/source/uibase/frmdlg/colmgr.cxx6
-rw-r--r--sw/source/uibase/frmdlg/frmmgr.cxx14
-rw-r--r--sw/source/uibase/inc/FrameControl.hxx5
-rw-r--r--sw/source/uibase/inc/OutlineContentVisibilityWin.hxx1
-rw-r--r--sw/source/uibase/inc/PageBreakWin.hxx2
-rw-r--r--sw/source/uibase/inc/ascfldlg.hxx2
-rw-r--r--sw/source/uibase/inc/bookmark.hxx2
-rw-r--r--sw/source/uibase/inc/break.hxx4
-rw-r--r--sw/source/uibase/inc/column.hxx2
-rw-r--r--sw/source/uibase/inc/convert.hxx6
-rw-r--r--sw/source/uibase/inc/dbinsdlg.hxx6
-rw-r--r--sw/source/uibase/inc/drpcps.hxx4
-rw-r--r--sw/source/uibase/inc/envlop.hxx2
-rw-r--r--sw/source/uibase/inc/fldtdlg.hxx3
-rw-r--r--sw/source/uibase/inc/frmpage.hxx14
-rw-r--r--sw/source/uibase/inc/glossary.hxx4
-rw-r--r--sw/source/uibase/inc/insfnote.hxx3
-rw-r--r--sw/source/uibase/inc/instable.hxx9
-rw-r--r--sw/source/uibase/inc/javaedit.hxx3
-rw-r--r--sw/source/uibase/inc/linenum.hxx2
-rw-r--r--sw/source/uibase/inc/mailconfigpage.hxx4
-rw-r--r--sw/source/uibase/inc/mailmrge.hxx6
-rw-r--r--sw/source/uibase/inc/num.hxx2
-rw-r--r--sw/source/uibase/inc/numpara.hxx4
-rw-r--r--sw/source/uibase/inc/optload.hxx2
-rw-r--r--sw/source/uibase/inc/optpage.hxx14
-rw-r--r--sw/source/uibase/inc/outline.hxx2
-rw-r--r--sw/source/uibase/inc/pgfnote.hxx4
-rw-r--r--sw/source/uibase/inc/pggrid.hxx6
-rw-r--r--sw/source/uibase/inc/redlndlg.hxx3
-rw-r--r--sw/source/uibase/inc/regionsw.hxx26
-rw-r--r--sw/source/uibase/inc/srcedtw.hxx1
-rw-r--r--sw/source/uibase/inc/srtdlg.hxx4
-rw-r--r--sw/source/uibase/inc/swuicnttab.hxx14
-rw-r--r--sw/source/uibase/inc/swuiidxmrk.hxx4
-rw-r--r--sw/source/uibase/inc/tautofmt.hxx2
-rw-r--r--sw/source/uibase/inc/titlepage.hxx6
-rw-r--r--sw/source/uibase/inc/wrap.hxx10
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx6
-rw-r--r--sw/source/uibase/lingu/hhcwrp.cxx13
-rw-r--r--sw/source/uibase/lingu/sdrhhcwrap.cxx2
-rw-r--r--sw/source/uibase/misc/glosdoc.cxx14
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx7
-rw-r--r--sw/source/uibase/misc/swruler.cxx6
-rw-r--r--sw/source/uibase/ribbar/drawbase.cxx2
-rw-r--r--sw/source/uibase/ribbar/inputwin.cxx10
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx27
-rw-r--r--sw/source/uibase/shells/basesh.cxx13
-rw-r--r--sw/source/uibase/shells/drawsh.cxx14
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx2
-rw-r--r--sw/source/uibase/shells/mediash.cxx112
-rw-r--r--sw/source/uibase/shells/tabsh.cxx46
-rw-r--r--sw/source/uibase/shells/textfld.cxx2
-rw-r--r--sw/source/uibase/shells/textsh.cxx15
-rw-r--r--sw/source/uibase/shells/textsh1.cxx6
-rw-r--r--sw/source/uibase/shells/txtcrsr.cxx4
-rw-r--r--sw/source/uibase/shells/txtnum.cxx10
-rw-r--r--sw/source/uibase/sidebar/PageColumnControl.cxx6
-rw-r--r--sw/source/uibase/sidebar/PageFooterPanel.cxx2
-rw-r--r--sw/source/uibase/sidebar/PageFooterPanel.hxx2
-rw-r--r--sw/source/uibase/sidebar/PageHeaderPanel.cxx2
-rw-r--r--sw/source/uibase/sidebar/PageHeaderPanel.hxx2
-rw-r--r--sw/source/uibase/sidebar/PageMarginControl.cxx25
-rw-r--r--sw/source/uibase/sidebar/PageSizeControl.cxx6
-rw-r--r--sw/source/uibase/table/tablepg.hxx20
-rw-r--r--sw/source/uibase/uiview/pview.cxx32
-rw-r--r--sw/source/uibase/uiview/view.cxx57
-rw-r--r--sw/source/uibase/uiview/view0.cxx2
-rw-r--r--sw/source/uibase/uiview/view2.cxx9
-rw-r--r--sw/source/uibase/uiview/viewdraw.cxx4
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx2
-rw-r--r--sw/source/uibase/uiview/viewport.cxx6
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx4
-rw-r--r--sw/source/uibase/uiview/viewstat.cxx6
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx44
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx23
-rw-r--r--sw/source/uibase/uno/unoatxt.cxx2
-rw-r--r--sw/source/uibase/uno/unomod.cxx2
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx6
-rw-r--r--sw/source/uibase/utlui/attrdesc.cxx3
-rw-r--r--sw/source/uibase/utlui/bookctrl.cxx2
-rw-r--r--sw/source/uibase/utlui/content.cxx63
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx22
-rw-r--r--sw/source/uibase/utlui/gloslst.cxx2
-rw-r--r--sw/source/uibase/utlui/initui.cxx8
-rw-r--r--sw/source/uibase/utlui/shdwcrsr.cxx12
-rw-r--r--sw/source/uibase/utlui/uitool.cxx35
-rw-r--r--sw/source/uibase/wrtsh/select.cxx6
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx28
423 files changed, 4610 insertions, 4210 deletions
diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx b/sw/source/core/SwNumberTree/SwNodeNum.cxx
index 6bf92d3eb73a..af92fe21ddc8 100644
--- a/sw/source/core/SwNumberTree/SwNodeNum.cxx
+++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx
@@ -273,7 +273,7 @@ SwNumberTree::tSwNumTreeNumber SwNodeNum::GetStartValue() const
if (nLevel >= 0 && nLevel < MAXLEVEL)
{
- const SwNumFormat * pFormat = pRule->GetNumFormat( static_cast<sal_uInt16>(nLevel));
+ const SwNumFormat * pFormat = pRule->GetNumFormat( o3tl::narrowing<sal_uInt16>(nLevel));
if (pFormat)
aResult = pFormat->GetStart();
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index bb59f3a68044..82859195b12a 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -532,7 +532,7 @@ void SwAccessibleContext::ThrowIfDisposed()
SwAccessibleContext::SwAccessibleContext(std::shared_ptr<SwAccessibleMap> const& pMap,
sal_Int16 const nRole,
const SwFrame *pF )
- : SwAccessibleFrame( pMap->GetVisArea().SVRect(), pF,
+ : SwAccessibleFrame( pMap->GetVisArea(), pF,
pMap->GetShell()->IsPreview() )
, m_pMap(pMap.get())
, m_wMap(pMap)
@@ -830,7 +830,7 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint
if( !GetFrame()->IsRootFrame() )
{
SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root
- Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
+ Point aPixPos( GetMap()->CoreToPixel( aLogBounds ).TopLeft() );
aPixPoint.setX(aPixPoint.getX() + aPixPos.getX());
aPixPoint.setY(aPixPoint.getY() + aPixPos.getY());
}
@@ -905,11 +905,11 @@ awt::Rectangle SwAccessibleContext::getBoundsImpl(bool bRelative)
}
if( !aLogBounds.IsEmpty() )
{
- aPixBounds = GetMap()->CoreToPixel( aLogBounds.SVRect() );
+ aPixBounds = GetMap()->CoreToPixel( aLogBounds );
if( !pParent->IsRootFrame() && bRelative)
{
SwRect aParentLogBounds( GetBounds( *(GetMap()), pParent ) ); // twip rel to doc root
- Point aParentPixPos( GetMap()->CoreToPixel( aParentLogBounds.SVRect() ).TopLeft() );
+ Point aParentPixPos( GetMap()->CoreToPixel( aParentLogBounds ).TopLeft() );
aPixBounds.Move( -aParentPixPos.getX(), -aParentPixPos.getY() );
}
}
diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx
index 0aa31107279d..7b0ff2693e69 100644
--- a/sw/source/core/access/accframe.cxx
+++ b/sw/source/core/access/accframe.cxx
@@ -225,7 +225,7 @@ SwAccessibleChild SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
SwRect aLogBounds( rLower.GetBounds( rAccMap ) );
if( !aLogBounds.IsEmpty() )
{
- tools::Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds.SVRect() ) );
+ tools::Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds ) );
if( aPixBounds.IsInside( rPixPos ) )
aRet = rLower;
}
@@ -256,7 +256,7 @@ SwAccessibleChild SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
SwRect aLogBounds( rLower.GetBounds( rAccMap ) );
if( !aLogBounds.IsEmpty() )
{
- tools::Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds.SVRect() ) );
+ tools::Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds ) );
if( aPixBounds.IsInside( rPixPos ) )
aRet = rLower;
}
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 5605d23ca75d..4479ce52e38c 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -3063,7 +3063,7 @@ Size SwAccessibleMap::LogicToPixel( const Size& rSize ) const
MapMode aSrc( MapUnit::Map100thMM );
MapMode aDest( MapUnit::MapTwip );
Size aSize( OutputDevice::LogicToLogic( rSize, aSrc, aDest ) );
- if (const OutputDevice* pWin = GetShell()->GetWin())
+ if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
{
MapMode aMapMode;
GetMapMode( Point(0,0), aMapMode );
@@ -3182,7 +3182,7 @@ css::uno::Reference< XAccessible >
Point SwAccessibleMap::PixelToCore( const Point& rPoint ) const
{
Point aPoint;
- if (const OutputDevice* pWin = GetShell()->GetWin())
+ if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
{
MapMode aMapMode;
GetMapMode( rPoint, aMapMode );
@@ -3224,17 +3224,17 @@ static void lcl_CorrectRectangle(tools::Rectangle & rRect,
rInGrid.Bottom(), true) );
}
-tools::Rectangle SwAccessibleMap::CoreToPixel( const tools::Rectangle& rRect ) const
+tools::Rectangle SwAccessibleMap::CoreToPixel( const SwRect& rRect ) const
{
tools::Rectangle aRect;
- if (const OutputDevice* pWin = GetShell()->GetWin())
+ if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
{
MapMode aMapMode;
GetMapMode( rRect.TopLeft(), aMapMode );
- aRect = pWin->LogicToPixel( rRect, aMapMode );
+ aRect = pWin->LogicToPixel( rRect.SVRect(), aMapMode );
tools::Rectangle aTmpRect = pWin->PixelToLogic( aRect, aMapMode );
- lcl_CorrectRectangle(aRect, rRect, aTmpRect);
+ lcl_CorrectRectangle(aRect, rRect.SVRect(), aTmpRect);
}
return aRect;
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 51645d24ab1e..ff2afb3aecc5 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -803,13 +803,13 @@ static bool lcl_GetBackgroundColor( Color & rColor,
const SwFrame* pFrame,
SwCursorShell* pCursorSh )
{
- const SvxBrushItem* pBackgrdBrush = nullptr;
+ const SvxBrushItem* pBackgroundBrush = nullptr;
std::optional<Color> xSectionTOXColor;
SwRect aDummyRect;
drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
if ( pFrame &&
- pFrame->GetBackgroundBrush( aFillAttributes, pBackgrdBrush, xSectionTOXColor, aDummyRect, false, /*bConsiderTextBox=*/false ) )
+ pFrame->GetBackgroundBrush( aFillAttributes, pBackgroundBrush, xSectionTOXColor, aDummyRect, false, /*bConsiderTextBox=*/false ) )
{
if ( xSectionTOXColor )
{
@@ -818,7 +818,7 @@ static bool lcl_GetBackgroundColor( Color & rColor,
}
else
{
- rColor = pBackgrdBrush->GetColor();
+ rColor = pBackgroundBrush->GetColor();
return true;
}
}
@@ -1134,10 +1134,10 @@ css::uno::Sequence< css::style::TabStop > SwAccessibleParagraph::GetCurrentTabSt
SwRect aTmpRect(0, 0, tabs[0].Position, 0);
- tools::Rectangle aScreenRect( GetMap()->CoreToPixel( aTmpRect.SVRect() ));
+ tools::Rectangle aScreenRect( GetMap()->CoreToPixel( aTmpRect ));
SwRect aFrameLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
- Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds.SVRect() ).TopLeft() );
+ Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds ).TopLeft() );
aScreenRect.Move( -aFramePixPos.X(), -aFramePixPos.Y() );
tabs[0].Position = aScreenRect.GetWidth();
@@ -2081,10 +2081,10 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
}
- tools::Rectangle aScreenRect( GetMap()->CoreToPixel( aCoreRect.SVRect() ));
+ tools::Rectangle aScreenRect( GetMap()->CoreToPixel( aCoreRect ));
SwRect aFrameLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
- Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds.SVRect() ).TopLeft() );
+ Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds ).TopLeft() );
aScreenRect.Move( -aFramePixPos.getX(), -aFramePixPos.getY() );
// convert into AWT Rectangle
@@ -2116,7 +2116,7 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
}
Point aPoint( rPoint.X, rPoint.Y );
SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root
- Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
+ Point aPixPos( GetMap()->CoreToPixel( aLogBounds ).TopLeft() );
aPoint.setX(aPoint.getX() + aPixPos.getX());
aPoint.setY(aPoint.getY() + aPixPos.getY());
Point aCorePoint( GetMap()->PixelToCore( aPoint ) );
@@ -2515,7 +2515,7 @@ sal_Bool SwAccessibleParagraph::scrollSubstringTo( sal_Int32 nStartIndex,
/* Offset the values relative to the view shell frame */
SwRect aFrameLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
- Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds.SVRect() ).TopLeft() );
+ Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds ).TopLeft() );
sP += aFramePixPos;
eP += aFramePixPos;
@@ -3309,10 +3309,10 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
}
- tools::Rectangle aScreenRect( GetMap()->CoreToPixel( aCursorCoreRect.SVRect() ));
+ tools::Rectangle aScreenRect( GetMap()->CoreToPixel( aCursorCoreRect ));
SwRect aFrameLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
- Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds.SVRect() ).TopLeft() );
+ Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds ).TopLeft() );
aScreenRect.Move( -aFramePixPos.getX(), -aFramePixPos.getY() );
// convert into AWT Rectangle
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 9310a290a184..b1da888d5af7 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -615,7 +615,7 @@ TextFrameIndex SwAccessiblePortionData::FillSpecialPos(
// (if necessary)
size_t nRefLine = FindBreak( m_aLineBreaks, nRefPos );
size_t nMyLine = FindBreak( m_aLineBreaks, nPos );
- sal_uInt16 nLineOffset = static_cast<sal_uInt16>( nMyLine - nRefLine );
+ sal_uInt16 nLineOffset = o3tl::narrowing<sal_uInt16>( nMyLine - nRefLine );
if( nLineOffset != 0 )
nRefPos = m_aLineBreaks[ nMyLine ];
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index a37ee5bef376..3f4253cd2566 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -54,7 +54,6 @@ namespace sw
}
sw::LegacyModifyHint::~LegacyModifyHint() {}
-sw::ModifyChangedHint::~ModifyChangedHint() {}
SwClient::SwClient(SwClient&& o) noexcept
: m_pRegisteredIn(nullptr)
@@ -75,19 +74,19 @@ SwClient::~SwClient()
m_pRegisteredIn->Remove( this );
}
-std::unique_ptr<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoolItem* pOld )
+std::optional<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoolItem* pOld )
{
DBG_TESTSOLARMUTEX();
// this method only handles notification about dying SwModify objects
if( !pOld || pOld->Which() != RES_OBJECTDYING )
- return nullptr;
+ return {};
assert(dynamic_cast<const SwPtrMsgPoolItem*>(pOld));
const SwPtrMsgPoolItem* pDead = static_cast<const SwPtrMsgPoolItem*>(pOld);
if(pDead->pObject != m_pRegisteredIn)
{
// we should only care received death notes from objects we are following
- return nullptr;
+ return {};
}
// I've got a notification from the object I know
SwModify* pAbove = m_pRegisteredIn->GetRegisteredIn();
@@ -102,7 +101,7 @@ std::unique_ptr<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoo
// destroy connection
EndListeningAll();
}
- return std::unique_ptr<sw::ModifyChangedHint>(new sw::ModifyChangedHint(pAbove));
+ return sw::ModifyChangedHint(pAbove);
}
void SwClient::CheckRegistrationFormat(SwFormat& rOld)
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 19d2f12d9a3a..8bc7296b250f 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -147,9 +147,9 @@ sal_uInt16 const aBreakSetRange[] = {
// list attributes ( RES_PARATR_LIST_BEGIN - RES_PARATR_LIST_END ) are not
// included in the paragraph style's itemset.
sal_uInt16 const aTextFormatCollSetRange[] = {
- RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
// FillAttribute support
@@ -168,10 +168,10 @@ sal_uInt16 const aGrfFormatCollSetRange[] = {
// AttrSet range for TextNode
sal_uInt16 const aTextNodeSetRange[] = {
- RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
// FillAttribute support (paragraph FillStyle)
@@ -191,41 +191,43 @@ sal_uInt16 const aNoTextNodeSetRange[] = {
sal_uInt16 const aTableSetRange[] = {
RES_FILL_ORDER, RES_FRM_SIZE,
RES_LR_SPACE, RES_BREAK,
- RES_BACKGROUND, RES_SHADOW,
RES_HORI_ORIENT, RES_HORI_ORIENT,
+ RES_BACKGROUND, RES_SHADOW,
RES_KEEP, RES_KEEP,
RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
RES_FRAMEDIR, RES_FRAMEDIR,
// #i29550#
RES_COLLAPSING_BORDERS, RES_COLLAPSING_BORDERS,
// <-- collapsing
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0
};
sal_uInt16 const aTableLineSetRange[] = {
RES_FILL_ORDER, RES_FRM_SIZE,
+ // HasTextChangesOnly
RES_LR_SPACE, RES_UL_SPACE,
- RES_BACKGROUND, RES_SHADOW,
- RES_ROW_SPLIT, RES_ROW_SPLIT,
+ RES_PRINT, RES_PRINT,
RES_PROTECT, RES_PROTECT,
RES_VERT_ORIENT, RES_VERT_ORIENT,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_ROW_SPLIT, RES_ROW_SPLIT,
RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0
};
sal_uInt16 const aTableBoxSetRange[] = {
RES_FILL_ORDER, RES_FRM_SIZE,
RES_LR_SPACE, RES_UL_SPACE,
- RES_BACKGROUND, RES_SHADOW,
RES_PROTECT, RES_PROTECT,
RES_VERT_ORIENT, RES_VERT_ORIENT,
+ RES_BACKGROUND, RES_SHADOW,
RES_FRAMEDIR, RES_FRAMEDIR,
+ RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG,
RES_BOXATR_BEGIN, RES_BOXATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG,
0
};
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index a7d4d2474613..1ba7d8d71477 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -523,7 +523,7 @@ bool SwCursorShell::UpDown( bool bUp, sal_uInt16 nCnt )
if( !bTableMode )
eUpdateMode = static_cast<CursorFlag>(eUpdateMode
| SwCursorShell::UPDOWN | SwCursorShell::CHKRANGE);
- UpdateCursor( static_cast<sal_uInt16>(eUpdateMode) );
+ UpdateCursor( o3tl::narrowing<sal_uInt16>(eUpdateMode) );
}
}
return bRet;
@@ -1390,7 +1390,7 @@ bool SwCursorShell::GoPrevCursor()
return true;
}
-bool SwCursorShell::GoNextPrevCursorSetSearchLabel(const bool bNext)
+void SwCursorShell::GoNextPrevCursorSetSearchLabel(const bool bNext)
{
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
@@ -1398,10 +1398,13 @@ bool SwCursorShell::GoNextPrevCursorSetSearchLabel(const bool bNext)
{
if( !m_pCurrentCursor->HasMark() )
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
- return false;
+ return;
}
- return bNext ? GoNextCursor() : GoPrevCursor();
+ if (bNext)
+ GoNextCursor();
+ else
+ GoPrevCursor();
}
void SwCursorShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect)
@@ -2435,7 +2438,7 @@ void SwCursorShell::ShellGetFocus()
m_bHasFocus = true;
if( !m_bBasicHideCursor && VisArea().Width() )
{
- UpdateCursor( static_cast<sal_uInt16>( SwCursorShell::CHKRANGE ) );
+ UpdateCursor( o3tl::narrowing<sal_uInt16>( SwCursorShell::CHKRANGE ) );
ShowCursors( m_bSVCursorVis );
}
}
@@ -3351,11 +3354,12 @@ bool SwCursorShell::HasReadonlySel() const
SwWrtShell* pWrtSh = GetDoc()->GetDocShell()->GetWrtShell();
if (pWrtSh)
{
- for(SwPaM& rPaM : GetCursor()->GetRingContainer())
+ for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
{
- rPaM.Normalize();
- SwNodeIndex aPointIdx(rPaM.GetPoint()->nNode.GetNode());
- SwNodeIndex aMarkIdx(rPaM.GetMark()->nNode.GetNode());
+ SwPaM aPaM(*rPaM.GetMark(), *rPaM.GetPoint());
+ aPaM.Normalize();
+ SwNodeIndex aPointIdx(aPaM.GetPoint()->nNode.GetNode());
+ SwNodeIndex aMarkIdx(aPaM.GetMark()->nNode.GetNode());
if (aPointIdx == aMarkIdx)
continue;
// If any nodes in PaM are folded outline content nodes, then set read-only.
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 58bf0b4f9626..3e8056fe8daf 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -375,7 +375,7 @@ void SwCursorShell::GotoTOXMarkBase()
return;
// Take the 1. and get the index type. Ask it for the actual index.
const SwTOXType* pType = aMarks[0]->GetTOXType();
- auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout(), IsReadOnlyAvailable());
+ auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout());
SwCallLink aLk(*this); // watch Cursor-Moves
SwCursorSaveState aSaveState(*m_pCurrentCursor);
assert(pContentFrame->IsTextFrame());
@@ -1164,13 +1164,13 @@ SwOutlineNodes::size_type SwCursorShell::GetOutlinePos(sal_uInt8 nLevel, SwPaM*
return SwOutlineNodes::npos; // no more left
}
-bool SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos,
+void SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos,
bool bWithChildren , bool bKillPams)
{
const SwNodes& rNds = GetDoc()->GetNodes();
const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
if( rOutlNds.empty() )
- return false;
+ return;
CurrShell aCurr( this );
SwCallLink aLk( *this ); // watch Cursor-Moves
@@ -1218,7 +1218,6 @@ bool SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineN
bool bRet = !m_pCurrentCursor->IsSelOvr();
if( bRet )
UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
- return bRet;
}
/// jump to reference marker
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 69388177ab28..2159d3dd2224 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1626,9 +1626,8 @@ bool SwCursor::GoSentence(SentenceMoveType eMoveType, SwRootFrame const*const pL
return bRet;
}
-bool SwCursor::ExpandToSentenceBorders(SwRootFrame const*const pLayout)
+void SwCursor::ExpandToSentenceBorders(SwRootFrame const*const pLayout)
{
- bool bRes = false;
SwTextNode* pStartNd = Start()->nNode.GetNode().GetTextNode();
SwTextNode* pEndNd = End()->nNode.GetNode().GetTextNode();
if (pStartNd && pEndNd)
@@ -1660,21 +1659,15 @@ bool SwCursor::ExpandToSentenceBorders(SwRootFrame const*const pLayout)
// it is allowed to place the PaM just behind the last
// character in the text thus <= ...Len
- bool bChanged = false;
if (nStartPos <= pStartNd->GetText().getLength() && nStartPos >= 0)
{
*GetMark() = SwPosition(*pStartNd, nStartPos);
- bChanged = true;
}
if (nEndPos <= pEndNd->GetText().getLength() && nEndPos >= 0)
{
*GetPoint() = SwPosition(*pEndNd, nEndPos);
- bChanged = true;
}
- if (bChanged && !IsSelOvr())
- bRes = true;
}
- return bRes;
}
bool SwTableCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 /*nMode*/,
@@ -1808,7 +1801,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
// the document. When the cursor is at the end of the visible document and
// right arrow key is pressed Move fails after moving the cursor to the
// end of the document model, which doesn't have a node frame and causes
- // wierd numbers to be displayed in the statusbar page number count. Left
+ // weird numbers to be displayed in the statusbar page number count. Left
// arrow, when in this state, causes a crash without RestoredSavePos() added here.
RestoreSavePos();
break;
@@ -1891,7 +1884,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
{
pTableBox = & pTableBox->FindEndOfRowSpan(
pOldTabSttNode->GetTable(),
- static_cast<sal_uInt16>(pTableBox->getRowSpan() + m_nRowSpanOffset));
+ o3tl::narrowing<sal_uInt16>(pTableBox->getRowSpan() + m_nRowSpanOffset));
SwNodeIndex& rPtIdx = GetPoint()->nNode;
SwNodeIndex aNewIdx( *pTableBox->GetSttNd() );
rPtIdx = aNewIdx;
@@ -2212,7 +2205,7 @@ bool SwCursor::GoPrevNextCell( bool bNext, sal_uInt16 nCnt )
if ( pTableBox && pTableBox->getRowSpan() > 1 )
{
pTableBox = & pTableBox->FindEndOfRowSpan( pTableNd->GetTable(),
- static_cast<sal_uInt16>(pTableBox->getRowSpan() + m_nRowSpanOffset));
+ o3tl::narrowing<sal_uInt16>(pTableBox->getRowSpan() + m_nRowSpanOffset));
SwNodeIndex aNewIdx( *pTableBox->GetSttNd() );
rPtIdx = aNewIdx;
pTableBoxStartNode = rPtIdx.GetNode().FindTableBoxStartNode();
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 5f26c9f23788..8bffbe3505fb 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -61,7 +61,7 @@ bool SwCursorShell::GoNextCell( bool bAppendLine )
pTableNd = IsCursorInTable();
assert (pTableNd);
pTableBox = & pTableBox->FindEndOfRowSpan( pTableNd->GetTable(),
- static_cast<sal_uInt16>(pTableBox->getRowSpan() + pCursor->GetCursorRowSpanOffset() ) );
+ o3tl::narrowing<sal_uInt16>(pTableBox->getRowSpan() + pCursor->GetCursorRowSpanOffset() ) );
pTableBoxStartNode = pTableBox->GetSttNd();
}
}
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 4777b767deb3..280bbae9ef82 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -248,8 +248,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell)
sal_Int32 nBegin = aPos.nContent.GetIndex();
sal_Int32 nLen = 1;
- SwWrongList *pWrong = nullptr;
- pWrong = pNode->GetWrong();
+ SwWrongList *pWrong = pNode->GetWrong();
if (!pWrong)
pWrong = pNode->GetGrammarCheck();
if (pWrong)
@@ -592,7 +591,7 @@ void SwSelPaintRects::Invalidate( const SwRect& rRect )
void SwSelPaintRects::Get1PixelInLogic( const SwViewShell& rSh,
tools::Long* pX, tools::Long* pY )
{
- const OutputDevice* pOut = rSh.GetWin();
+ const OutputDevice* pOut = rSh.GetWin()->GetOutDev();
if ( ! pOut )
pOut = rSh.GetOut();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 88fd7872a41b..02a336e8a0e6 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1220,7 +1220,6 @@ namespace //local functions originally from docfmt.cxx
const SetAttrMode nFlags,
SwUndoAttr *const pUndo,
SwRootFrame const*const pLayout,
- const bool bExpandCharToPara,
SwTextAttr **ppNewTextAttr)
{
// Divide the Sets (for selections in Nodes)
@@ -1348,7 +1347,7 @@ namespace //local functions originally from docfmt.cxx
if (nLevel >= MAXLEVEL)
nLevel = MAXLEVEL - 1;
- SwNumFormat aNumFormat = pNumRule->Get(static_cast<sal_uInt16>(nLevel));
+ SwNumFormat aNumFormat = pNumRule->Get(o3tl::narrowing<sal_uInt16>(nLevel));
SwCharFormat * pCharFormat =
rDoc.FindCharFormatByName(aNumFormat.GetCharFormatName());
@@ -1684,24 +1683,6 @@ namespace //local functions originally from docfmt.cxx
// Only selection in a Node.
if( pStt->nNode == pEnd->nNode )
{
- //The data parameter flag: bExpandCharToPara, comes from the data member of SwDoc,
- //which is set in SW MS Word Binary filter WW8ImplRreader. With this flag on, means that
- //current setting attribute set is a character range properties set and comes from a MS Word
- //binary file, and the setting range include a paragraph end position (0X0D);
- //more specifications, as such property inside the character range properties set recorded in
- //MS Word binary file are dealt and inserted into data model (SwDoc) one by one, so we
- //only dealing the scenario that the char properties set with 1 item inside;
-
- if (bExpandCharToPara && pCharSet && pCharSet->Count() ==1 )
- {
- SwTextNode* pCurrentNd = pStt->nNode.GetNode().GetTextNode();
-
- if (pCurrentNd)
- {
- pCurrentNd->TryCharSetExpandToNum(*pCharSet);
-
- }
- }
DELETECHARSETS
return bRet;
}
@@ -1816,33 +1797,6 @@ namespace //local functions originally from docfmt.cxx
}
}
- //The data parameter flag: bExpandCharToPara, comes from the data member of SwDoc,
- //which is set in SW MS Word Binary filter WW8ImplRreader. With this flag on, means that
- //current setting attribute set is a character range properties set and comes from a MS Word
- //binary file, and the setting range include a paragraph end position (0X0D);
- //more specifications, as such property inside the character range properties set recorded in
- //MS Word binary file are dealt and inserted into data model (SwDoc) one by one, so we
- //only dealing the scenario that the char properties set with 1 item inside;
- if (bExpandCharToPara && pCharSet && pCharSet->Count() ==1)
- {
- SwPosition aStartPos (*rRg.Start());
- SwPosition aEndPos (*rRg.End());
-
- if (aEndPos.nNode.GetNode().GetTextNode() && aEndPos.nContent != aEndPos.nNode.GetNode().GetTextNode()->Len())
- aEndPos.nNode--;
-
- sal_uLong nStart = aStartPos.nNode.GetIndex();
- sal_uLong nEnd = aEndPos.nNode.GetIndex();
- for(; nStart <= nEnd; ++nStart)
- {
- SwNode* pNd = rDoc.GetNodes()[ nStart ];
- if (!pNd || !pNd->IsTextNode())
- continue;
- SwTextNode *pCurrentNd = pNd->GetTextNode();
- pCurrentNd->TryCharSetExpandToNum(*pCharSet);
- }
- }
-
DELETECHARSETS
return (nNodes != 0) || bRet;
}
@@ -2552,7 +2506,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod
return true;
}
-bool DocumentContentOperationsManager::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos )
+void DocumentContentOperationsManager::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos )
{
SwNodeIndex aIdx( rPaM.Start()->nNode );
bool bJoinText = aIdx.GetNode().IsTextNode();
@@ -2575,7 +2529,6 @@ bool DocumentContentOperationsManager::MoveAndJoin( SwPaM& rPaM, SwPosition& rPo
pTextNd->JoinNext();
}
}
- return bRet;
}
// Overwrite only uses the point of the PaM, the mark is ignored; characters
@@ -3375,13 +3328,11 @@ bool DocumentContentOperationsManager::ReplaceRange( SwPaM& rPam, const OUString
return bRet;
}
-///Add a para for the char attribute exp...
bool DocumentContentOperationsManager::InsertPoolItem(
const SwPaM &rRg,
const SfxPoolItem &rHt,
const SetAttrMode nFlags,
SwRootFrame const*const pLayout,
- const bool bExpandCharToPara,
SwTextAttr **ppNewTextAttr)
{
if (utl::ConfigManager::IsFuzzing())
@@ -3397,7 +3348,7 @@ bool DocumentContentOperationsManager::InsertPoolItem(
SfxItemSet aSet( m_rDoc.GetAttrPool(), {{rHt.Which(), rHt.Which()}} );
aSet.Put( rHt );
- const bool bRet = lcl_InsAttr(m_rDoc, rRg, aSet, nFlags, pUndoAttr.get(), pLayout, bExpandCharToPara, ppNewTextAttr);
+ const bool bRet = lcl_InsAttr(m_rDoc, rRg, aSet, nFlags, pUndoAttr.get(), pLayout, ppNewTextAttr);
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
@@ -3422,7 +3373,7 @@ void DocumentContentOperationsManager::InsertItemSet ( const SwPaM &rRg, const S
pUndoAttr.reset(new SwUndoAttr( rRg, rSet, nFlags ));
}
- bool bRet = lcl_InsAttr(m_rDoc, rRg, rSet, nFlags, pUndoAttr.get(), pLayout, /*bExpandCharToPara*/false, /*ppNewTextAttr*/nullptr );
+ bool bRet = lcl_InsAttr(m_rDoc, rRg, rSet, nFlags, pUndoAttr.get(), pLayout, /*ppNewTextAttr*/nullptr );
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
@@ -4572,20 +4523,18 @@ SwFlyFrameFormat* DocumentContentOperationsManager::InsNoTextNode( const SwPosit
}
#define NUMRULE_STATE \
- SfxItemState aNumRuleState = SfxItemState::UNKNOWN; \
- std::shared_ptr<SwNumRuleItem> aNumRuleItem; \
- SfxItemState aListIdState = SfxItemState::UNKNOWN; \
- std::shared_ptr<SfxStringItem> aListIdItem; \
+ std::shared_ptr<SwNumRuleItem> aNumRuleItemHolderIfSet; \
+ std::shared_ptr<SfxStringItem> aListIdItemHolderIfSet; \
#define PUSH_NUMRULE_STATE \
- lcl_PushNumruleState( aNumRuleState, aNumRuleItem, aListIdState, aListIdItem, pDestTextNd );
+ lcl_PushNumruleState( aNumRuleItemHolderIfSet, aListIdItemHolderIfSet, pDestTextNd );
#define POP_NUMRULE_STATE \
- lcl_PopNumruleState( aNumRuleState, aNumRuleItem, aListIdState, aListIdItem, pDestTextNd, rPam );
+ lcl_PopNumruleState( aNumRuleItemHolderIfSet, aListIdItemHolderIfSet, pDestTextNd, rPam );
static void lcl_PushNumruleState(
- SfxItemState &aNumRuleState, std::shared_ptr<SwNumRuleItem>& aNumRuleItem,
- SfxItemState &aListIdState, std::shared_ptr<SfxStringItem>& aListIdItem,
+ std::shared_ptr<SwNumRuleItem>& aNumRuleItemHolderIfSet,
+ std::shared_ptr<SfxStringItem>& aListIdItemHolderIfSet,
const SwTextNode *pDestTextNd )
{
// Safe numrule item at destination.
@@ -4594,23 +4543,21 @@ static void lcl_PushNumruleState(
if (pAttrSet == nullptr)
return;
- const SfxPoolItem * pItem = nullptr;
- aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem);
- if (SfxItemState::SET == aNumRuleState)
+ const SfxPoolItem* pItem(nullptr);
+ if (SfxItemState::SET == pAttrSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem))
{
- aNumRuleItem.reset(&pItem->Clone()->StaticWhichCast(RES_PARATR_NUMRULE));
+ aNumRuleItemHolderIfSet.reset(&pItem->Clone()->StaticWhichCast(RES_PARATR_NUMRULE));
}
- aListIdState = pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem);
- if (SfxItemState::SET == aListIdState)
+ if (SfxItemState::SET == pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem))
{
- aListIdItem.reset(&pItem->Clone()->StaticWhichCast(RES_PARATR_LIST_ID));
+ aListIdItemHolderIfSet.reset(&pItem->Clone()->StaticWhichCast(RES_PARATR_LIST_ID));
}
}
static void lcl_PopNumruleState(
- SfxItemState aNumRuleState, const std::shared_ptr<SwNumRuleItem>& aNumRuleItem,
- SfxItemState aListIdState, const std::shared_ptr<SfxStringItem>& aListIdItem,
+ std::shared_ptr<SwNumRuleItem>& aNumRuleItemHolderIfSet,
+ std::shared_ptr<SfxStringItem>& aListIdItemHolderIfSet,
SwTextNode *pDestTextNd, const SwPaM& rPam )
{
/* If only a part of one paragraph is copied
@@ -4619,17 +4566,18 @@ static void lcl_PopNumruleState(
if ( lcl_MarksWholeNode(rPam) )
return;
- if (SfxItemState::SET == aNumRuleState)
+ if (aNumRuleItemHolderIfSet)
{
- pDestTextNd->SetAttr(*aNumRuleItem);
+ pDestTextNd->SetAttr(*aNumRuleItemHolderIfSet);
}
else
{
pDestTextNd->ResetAttr(RES_PARATR_NUMRULE);
}
- if (SfxItemState::SET == aListIdState)
+
+ if (aListIdItemHolderIfSet)
{
- pDestTextNd->SetAttr(*aListIdItem);
+ pDestTextNd->SetAttr(*aListIdItemHolderIfSet);
}
else
{
@@ -4732,7 +4680,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
std::shared_ptr<SwUnoCursor> const pCopyPam(rDoc.CreateUnoCursor(rPos));
SwTableNumFormatMerge aTNFM( m_rDoc, rDoc );
- std::unique_ptr<std::vector<SwFrameFormat*>> pFlys;
+ std::optional<std::vector<SwFrameFormat*>> pFlys;
std::vector<SwFrameFormat*> const* pFlysAtInsPos;
if (rDoc.GetIDocumentUndoRedo().DoesUndo())
@@ -4743,7 +4691,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
else
{
pFlys = sw::GetFlysAnchoredAt(rDoc, rPos.nNode.GetIndex());
- pFlysAtInsPos = pFlys.get();
+ pFlysAtInsPos = pFlys ? &*pFlys : nullptr;
}
RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index b187e709e9b0..aa52a22be144 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -929,7 +929,7 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
// Hash table for all string replacements is filled on-the-fly.
// Try to fabricate an uneven number.
const SwFieldTypes::size_type nHashSize {(( mpFieldTypes->size() / 7 ) + 1 ) * 7};
- const sal_uInt16 nStrFormatCnt = static_cast<sal_uInt16>(nHashSize);
+ const sal_uInt16 nStrFormatCnt = o3tl::narrowing<sal_uInt16>(nHashSize);
OSL_ENSURE( nStrFormatCnt == nHashSize, "Downcasting to sal_uInt16 lost information!" );
SwHashTable<HashStr> aHashStrTable(nStrFormatCnt);
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx
index d4a92a09a69c..1266e3ea719f 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -135,7 +135,7 @@ SwFrameFormat *DocumentLayoutManager::MakeLayoutFormat( RndStdIds eRequest, cons
m_rDoc.GetNodes().MakeTextSection
( aTmpIdx,
bHeader ? SwHeaderStartNode : SwFooterStartNode,
- m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(static_cast<sal_uInt16>( bHeader
+ m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(o3tl::narrowing<sal_uInt16>( bHeader
? ( eRequest == RndStdIds::HEADERL
? RES_POOLCOLL_HEADERL
: eRequest == RndStdIds::HEADERR
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 1c63619a8e1b..6079ddcc88f2 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -38,6 +38,7 @@
#include <strings.hrc>
#include <swmodule.hxx>
#include <osl/diagnose.h>
+#include <editeng/prntitem.hxx>
using namespace com::sun::star;
@@ -430,6 +431,54 @@ namespace
return nullptr;
}
+ // delete the empty tracked table row (i.e. if it's last tracked deletion was accepted)
+ void lcl_DeleteTrackedTableRow ( SwPosition* pPos )
+ {
+ if ( const SwTableBox* pBox = pPos->nNode.GetNode().GetTableBox() )
+ {
+ const SwTableLine* pLine = pBox->GetUpper();
+ const SvxPrintItem *pHasTextChangesOnlyProp =
+ pLine->GetFrameFormat()->GetAttrSet().GetItem<SvxPrintItem>(RES_PRINT);
+ // table row property "HasTextChangesOnly" is set and its value is false
+ if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() )
+ {
+ bool bEmptyLine = true;
+ const SwTableBoxes & rBoxes = pLine->GetTabBoxes();
+ for (size_t nBox = 0; nBox < rBoxes.size(); ++nBox)
+ {
+ if ( !rBoxes[nBox]->IsEmpty() )
+ {
+ bEmptyLine = false;
+ break;
+ }
+ }
+ if ( bEmptyLine )
+ {
+ SwCursor aCursor( *pPos, nullptr );
+ pPos->GetDoc().DeleteRow( aCursor );
+ }
+ }
+ }
+ }
+
+ // at rejection of a deletion in a table, remove the tracking of the table row
+ void lcl_RemoveTrackingOfTableRow( const SwPosition* pPos )
+ {
+ if ( const SwTableBox* pBox = pPos->nNode.GetNode().GetTableBox() )
+ {
+ const SwTableLine* pLine = pBox->GetUpper();
+ const SvxPrintItem *pHasTextChangesOnlyProp =
+ pLine->GetFrameFormat()->GetAttrSet().GetItem<SvxPrintItem>(RES_PRINT);
+ // table row property "HasTextChangesOnly" is set and its value is false
+ if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() )
+ {
+ SvxPrintItem aUnsetTracking(RES_PRINT, true);
+ SwCursor aCursor( *pPos, nullptr );
+ pPos->GetDoc().SetRowNotTracked( aCursor, aUnsetTracking );
+ }
+ }
+ }
+
bool lcl_AcceptRedline( SwRedlineTable& rArr, SwRedlineTable::size_type& rPos,
bool bCallDelete,
const SwPosition* pSttRng = nullptr,
@@ -565,7 +614,10 @@ namespace
rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld & ~RedlineFlags(RedlineFlags::On | RedlineFlags::Ignore));
if( pCSttNd && pCEndNd )
+ {
rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
+ lcl_DeleteTrackedTableRow( aPam.End() );
+ }
else if (pCSttNd && !pCEndNd)
{
aPam.GetBound().nContent.Assign( nullptr, 0 );
@@ -709,6 +761,9 @@ namespace
if( pRedl->GetExtraData() )
pRedl->GetExtraData()->Reject( *pRedl );
+ // remove tracking of the table row, if needed
+ lcl_RemoveTrackingOfTableRow( updatePaM.End() );
+
switch( eCmp )
{
case SwComparePosition::Inside:
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 6ea5ea058da7..a4251c4a110e 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -90,6 +90,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbClippedPictures(false),
mbBackgroundParaOverDrawings(false),
mbTabOverMargin(false),
+ mbTabOverSpacing(false),
mbTreatSingleColumnBreakAsPageBreak(false),
mbSurroundTextWrapSmall(false),
mbPropLineSpacingShrinksFirstLine(true),
@@ -204,6 +205,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::CLIPPED_PICTURES: return mbClippedPictures;
case DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
case DocumentSettingId::TAB_OVER_MARGIN: return mbTabOverMargin;
+ case DocumentSettingId::TAB_OVER_SPACING: return mbTabOverSpacing;
case DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK: return mbTreatSingleColumnBreakAsPageBreak;
case DocumentSettingId::SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall;
case DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE: return mbPropLineSpacingShrinksFirstLine;
@@ -390,6 +392,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
mbTabOverMargin = value;
break;
+ case DocumentSettingId::TAB_OVER_SPACING:
+ mbTabOverSpacing = value;
+ break;
+
case DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
mbTreatSingleColumnBreakAsPageBreak = value;
break;
@@ -650,7 +656,7 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti
// No mbProtectForm
mbMsWordCompTrailingBlanks = rSource.mbMsWordCompTrailingBlanks;
mbMsWordCompMinLineHeightByFly = rSource.mbMsWordCompMinLineHeightByFly;
- // No mbInvertBorderSpacing
+ mbInvertBorderSpacing = rSource.mbInvertBorderSpacing;
mbCollapseEmptyCellPara = rSource.mbCollapseEmptyCellPara;
mbTabAtLeftIndentForParagraphsInList = rSource.mbTabAtLeftIndentForParagraphsInList;
mbSmallCapsPercentage66 = rSource.mbSmallCapsPercentage66;
@@ -659,6 +665,7 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti
mbClippedPictures = rSource.mbClippedPictures;
mbBackgroundParaOverDrawings = rSource.mbBackgroundParaOverDrawings;
mbTabOverMargin = rSource.mbTabOverMargin;
+ mbTabOverSpacing = rSource.mbTabOverSpacing;
mbTreatSingleColumnBreakAsPageBreak = rSource.mbTreatSingleColumnBreakAsPageBreak;
mbSurroundTextWrapSmall = rSource.mbSurroundTextWrapSmall;
mbPropLineSpacingShrinksFirstLine = rSource.mbPropLineSpacingShrinksFirstLine;
@@ -928,6 +935,11 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const
BAD_CAST(OString::boolean(mbTabOverMargin).getStr()));
(void)xmlTextWriterEndElement(pWriter);
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbTabOverSpacing"));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+ BAD_CAST(OString::boolean(mbTabOverSpacing).getStr()));
+ (void)xmlTextWriterEndElement(pWriter);
+
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbTreatSingleColumnBreakAsPageBreak"));
(void)xmlTextWriterWriteAttribute(
pWriter, BAD_CAST("value"),
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 5df33094c073..ff0657aaff48 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -1753,8 +1753,8 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
}
SvxULSpaceItem aUL( RES_UL_SPACE );
{
- aUL.SetUpper( static_cast<sal_uInt16>(aLR.GetLeft()) );
- aUL.SetLower( static_cast<sal_uInt16>(aLR.GetLeft()) );
+ aUL.SetUpper( o3tl::narrowing<sal_uInt16>(aLR.GetLeft()) );
+ aUL.SetLower( o3tl::narrowing<sal_uInt16>(aLR.GetLeft()) );
}
SwAttrSet aSet( m_rDoc.GetAttrPool(), aPgFrameFormatSetRange );
@@ -1824,8 +1824,8 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
{
lcl_PutStdPageSizeIntoItemSet( m_rDoc, aSet );
aLR.SetRight(o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip));
- aUL.SetUpper( static_cast<sal_uInt16>(aLR.GetRight()) );
- aUL.SetLower( static_cast<sal_uInt16>(aLR.GetRight()) );
+ aUL.SetUpper( o3tl::narrowing<sal_uInt16>(aLR.GetRight()) );
+ aUL.SetLower( o3tl::narrowing<sal_uInt16>(aLR.GetRight()) );
aSet.Put( aLR );
aSet.Put( aUL );
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 9b3b3bb70991..e1929ca2978a 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -503,7 +503,7 @@ sal_uInt16 PostItField_::GetPageNo(
sal_uInt16 nPgNo = pFrame->GetPhyPageNum();
if( rRangeEnum.hasValue( nPgNo, &rPossiblePages ))
{
- rLineNo = static_cast<sal_uInt16>(pFrame->GetLineCount( nPos ) +
+ rLineNo = o3tl::narrowing<sal_uInt16>(pFrame->GetLineCount( nPos ) +
pFrame->GetAllLines() - pFrame->GetThisLines());
rVirtPgNo = pFrame->GetVirtPageNum();
return nPgNo;
@@ -1144,10 +1144,7 @@ static bool lcl_CheckSmartTagsAgain( const SwNodePtr& rpNd, void* )
if( pTextNode )
{
pTextNode->SetSmartTagDirty( true );
- if( pTextNode->GetSmartTags() )
- {
- pTextNode->SetSmartTags( nullptr );
- }
+ pTextNode->ClearSmartTags();
}
return true;
}
@@ -1271,7 +1268,7 @@ void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImp
{
SwTextFormatColl* pMyColl = pNd->GetTextColl();
- const sal_uInt16 nHeadLine = static_cast<sal_uInt16>(
+ const sal_uInt16 nHeadLine = o3tl::narrowing<sal_uInt16>(
!pMyColl->IsAssignedToListLevelOfOutlineStyle()
? RES_POOLCOLL_HEADLINE2
: RES_POOLCOLL_HEADLINE1 );
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index 723cd0881f74..6bf54c6b6e5a 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -213,7 +213,7 @@ sal_uInt16 SwDoc::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCall
}
else if( EXTENDED_STYPE == rMacro.GetScriptType() )
{
- std::unique_ptr<Sequence<Any> > pUnoArgs(new Sequence<Any>());
+ Sequence<Any> aUnoArgs;
Any aRet;
Sequence< sal_Int16 > aOutArgsIndex;
@@ -222,7 +222,7 @@ sal_uInt16 SwDoc::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCall
SAL_INFO("sw", "SwDoc::CallEvent URL is " << rMacro.GetMacName() );
nRet += ERRCODE_NONE == mpDocShell->CallXScript(
- rMacro.GetMacName(), *pUnoArgs,aRet, aOutArgsIndex, aOutArgs) ? 1 : 0;
+ rMacro.GetMacName(), aUnoArgs, aRet, aOutArgsIndex, aOutArgs) ? 1 : 0;
}
// JavaScript calls are ignored
}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index d09bcb6e6046..825785fa9caa 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -60,18 +60,18 @@ IDocumentMarkAccess::iterator::get() const
}
IDocumentMarkAccess::iterator::iterator(std::vector<::sw::mark::MarkBase*>::const_iterator const& rIter)
- : m_pIter(new std::vector<::sw::mark::MarkBase*>::const_iterator(rIter))
+ : m_pIter(rIter)
{
}
IDocumentMarkAccess::iterator::iterator(iterator const& rOther)
- : m_pIter(new std::vector<::sw::mark::MarkBase*>::const_iterator(*rOther.m_pIter))
+ : m_pIter(rOther.m_pIter)
{
}
auto IDocumentMarkAccess::iterator::operator=(iterator const& rOther) -> iterator&
{
- m_pIter.reset(new std::vector<::sw::mark::MarkBase*>::const_iterator(*rOther.m_pIter));
+ m_pIter = rOther.m_pIter;
return *this;
}
@@ -120,7 +120,7 @@ bool IDocumentMarkAccess::iterator::operator!=(iterator const& rOther) const
}
IDocumentMarkAccess::iterator::iterator()
- : m_pIter(new std::vector<::sw::mark::MarkBase*>::const_iterator())
+ : m_pIter(std::in_place)
{
}
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index ac2b3c41d6bd..589f977e4937 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -56,11 +56,12 @@ using std::vector;
namespace {
-class SwCompareLine
+class SwCompareLine final
{
- const SwNode& m_rNode;
+ const SwNode* m_pNode;
public:
- explicit SwCompareLine( const SwNode& rNd ) : m_rNode( rNd ) {}
+ explicit SwCompareLine( const SwNode& rNd ) : m_pNode( &rNd ) {}
+ SwCompareLine() : m_pNode( nullptr ) {}
sal_uLong GetHashValue() const;
bool Compare( const SwCompareLine& rLine ) const;
@@ -73,7 +74,7 @@ public:
bool ChangesInLine( const SwCompareLine& rLine,
std::unique_ptr<SwPaM>& rpInsRing, std::unique_ptr<SwPaM>& rpDelRing ) const;
- const SwNode& GetNode() const { return m_rNode; }
+ const SwNode& GetNode() const { return *m_pNode; }
const SwNode& GetEndNode() const;
@@ -95,7 +96,7 @@ private:
static sal_uLong PrevIdx( const SwNode* pNd );
static sal_uLong NextIdx( const SwNode* pNd );
- vector< SwCompareLine* > m_aLines;
+ vector<SwCompareLine> m_aLines;
bool m_bRecordDiff;
// Truncate beginning and end and add all others to the LinesArray
@@ -142,10 +143,10 @@ public:
}
size_t GetLineCount() const { return m_aLines.size(); }
- const SwCompareLine* GetLine( size_t nLine ) const
+ const SwCompareLine& GetLine( size_t nLine ) const
{ return m_aLines[ nLine ]; }
- void InsertLine( SwCompareLine* pLine )
- { m_aLines.push_back( pLine ); }
+ void InsertLine( SwCompareLine aLine )
+ { m_aLines.push_back( aLine ); }
void SetRedlinesToDoc( bool bUseDocInfo );
};
@@ -185,10 +186,10 @@ class Hash
struct HashData
{
sal_uLong nNext, nHash;
- const SwCompareLine* pLine;
+ SwCompareLine aLine;
HashData()
- : nNext( 0 ), nHash( 0 ), pLine(nullptr) {}
+ : nNext( 0 ), nHash( 0 ) {}
};
std::unique_ptr<sal_uLong[]> m_pHashArr;
@@ -528,7 +529,6 @@ Hash::Hash( sal_uLong nSize )
m_pDataArr.reset( new HashData[ nSize ] );
m_pDataArr[0].nNext = 0;
m_pDataArr[0].nHash = 0;
- m_pDataArr[0].pLine = nullptr;
m_nPrime = primes[0];
for( i = 0; primes[i] < nSize / 3; i++)
@@ -549,9 +549,8 @@ void Hash::CalcHashValue( CompareData& rData )
for( size_t n = 0; n < rData.GetLineCount(); ++n )
{
- const SwCompareLine* pLine = rData.GetLine( n );
- OSL_ENSURE( pLine, "where is the line?" );
- sal_uLong nH = pLine->GetHashValue();
+ const SwCompareLine aLine = rData.GetLine( n );
+ sal_uLong nH = aLine.GetHashValue();
sal_uLong* pFound = &m_pHashArr[ nH % m_nPrime ];
size_t i;
@@ -561,12 +560,12 @@ void Hash::CalcHashValue( CompareData& rData )
i = m_nCount++;
m_pDataArr[i].nNext = *pFound;
m_pDataArr[i].nHash = nH;
- m_pDataArr[i].pLine = pLine;
+ m_pDataArr[i].aLine = aLine;
*pFound = i;
break;
}
else if( m_pDataArr[i].nHash == nH &&
- m_pDataArr[i].pLine->Compare( *pLine ))
+ m_pDataArr[i].aLine.Compare( aLine ))
break;
rData.SetIndex( n, i );
@@ -1012,16 +1011,16 @@ void Compare::ShiftBoundaries( CompareData& rData1, CompareData& rData2 )
sal_uLong SwCompareLine::GetHashValue() const
{
sal_uLong nRet = 0;
- switch( m_rNode.GetNodeType() )
+ switch( m_pNode->GetNodeType() )
{
case SwNodeType::Text:
- nRet = GetTextNodeHashValue( *m_rNode.GetTextNode(), nRet );
+ nRet = GetTextNodeHashValue( *m_pNode->GetTextNode(), nRet );
break;
case SwNodeType::Table:
{
- const SwNode* pEndNd = m_rNode.EndOfSectionNode();
- SwNodeIndex aIdx( m_rNode );
+ const SwNode* pEndNd = m_pNode->EndOfSectionNode();
+ SwNodeIndex aIdx( *m_pNode );
while( &aIdx.GetNode() != pEndNd )
{
if( aIdx.GetNode().IsTextNode() )
@@ -1050,19 +1049,19 @@ sal_uLong SwCompareLine::GetHashValue() const
const SwNode& SwCompareLine::GetEndNode() const
{
- const SwNode* pNd = &m_rNode;
- switch( m_rNode.GetNodeType() )
+ const SwNode* pNd = m_pNode;
+ switch( m_pNode->GetNodeType() )
{
case SwNodeType::Table:
- pNd = m_rNode.EndOfSectionNode();
+ pNd = m_pNode->EndOfSectionNode();
break;
case SwNodeType::Section:
{
- const SwSectionNode& rSNd = static_cast<const SwSectionNode&>(m_rNode);
+ const SwSectionNode& rSNd = static_cast<const SwSectionNode&>(*m_pNode);
const SwSection& rSect = rSNd.GetSection();
if( SectionType::Content != rSect.GetType() || rSect.IsProtect() )
- pNd = m_rNode.EndOfSectionNode();
+ pNd = m_pNode->EndOfSectionNode();
}
break;
default: break;
@@ -1072,7 +1071,7 @@ const SwNode& SwCompareLine::GetEndNode() const
bool SwCompareLine::Compare( const SwCompareLine& rLine ) const
{
- return CompareNode( m_rNode, rLine.m_rNode );
+ return CompareNode( *m_pNode, *rLine.m_pNode );
}
namespace
@@ -1196,15 +1195,15 @@ bool SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd )
OUString SwCompareLine::GetText() const
{
OUString sRet;
- switch( m_rNode.GetNodeType() )
+ switch( m_pNode->GetNodeType() )
{
case SwNodeType::Text:
- sRet = m_rNode.GetTextNode()->GetExpandText(nullptr);
+ sRet = m_pNode->GetTextNode()->GetExpandText(nullptr);
break;
case SwNodeType::Table:
{
- sRet = "Tabelle: " + SimpleTableToText(m_rNode);
+ sRet = "Tabelle: " + SimpleTableToText(*m_pNode);
}
break;
@@ -1212,7 +1211,7 @@ OUString SwCompareLine::GetText() const
{
sRet = "Section - Node:";
- const SwSectionNode& rSNd = static_cast<const SwSectionNode&>(m_rNode);
+ const SwSectionNode& rSNd = static_cast<const SwSectionNode&>(*m_pNode);
const SwSection& rSect = rSNd.GetSection();
switch( rSect.GetType() )
{
@@ -1278,10 +1277,10 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
bool bRet = false;
// Only compare textnodes
- if( SwNodeType::Text == m_rNode.GetNodeType() &&
+ if( SwNodeType::Text == m_pNode->GetNodeType() &&
SwNodeType::Text == rLine.GetNode().GetNodeType() )
{
- SwTextNode& rDstNd = *const_cast<SwTextNode*>(m_rNode.GetTextNode());
+ SwTextNode& rDstNd = *const_cast<SwTextNode*>(m_pNode->GetTextNode());
const SwTextNode& rSrcNd = *rLine.GetNode().GetTextNode();
SwDoc& rDstDoc = rDstNd.GetDoc();
@@ -1486,22 +1485,22 @@ void CompareData::CheckRanges( CompareData& rData )
while( nSrcSttIdx <= nSrcEndIdx )
{
const SwNode* pNd = rSrcNds[ nSrcSttIdx ];
- rData.InsertLine( new SwCompareLine( *pNd ) );
+ rData.InsertLine( SwCompareLine( *pNd ) );
nSrcSttIdx = NextIdx( pNd );
}
while( nDstSttIdx <= nDstEndIdx )
{
const SwNode* pNd = rDstNds[ nDstSttIdx ];
- InsertLine( new SwCompareLine( *pNd ) );
+ InsertLine( SwCompareLine( *pNd ) );
nDstSttIdx = NextIdx( pNd );
}
}
void CompareData::ShowInsert( sal_uLong nStt, sal_uLong nEnd )
{
- SwPaM* pTmp = new SwPaM( GetLine( nStt )->GetNode(), 0,
- GetLine( nEnd-1 )->GetEndNode(), 0,
+ SwPaM* pTmp = new SwPaM( GetLine( nStt ).GetNode(), 0,
+ GetLine( nEnd-1 ).GetEndNode(), 0,
m_pInsertRing.get() );
if( !m_pInsertRing )
m_pInsertRing.reset( pTmp );
@@ -1516,29 +1515,29 @@ void CompareData::ShowDelete(
sal_uLong nInsPos )
{
SwNodeRange aRg(
- rData.GetLine( nStt )->GetNode(), 0,
- rData.GetLine( nEnd-1 )->GetEndNode(), 1 );
+ rData.GetLine( nStt ).GetNode(), 0,
+ rData.GetLine( nEnd-1 ).GetEndNode(), 1 );
sal_uInt16 nOffset = 0;
- const SwCompareLine* pLine = nullptr;
+ std::optional<SwCompareLine> xLine;
if( nInsPos >= 1 )
{
if( GetLineCount() == nInsPos )
{
- pLine = GetLine( nInsPos-1 );
+ xLine = GetLine( nInsPos-1 );
nOffset = 1;
}
else
- pLine = GetLine( nInsPos );
+ xLine = GetLine( nInsPos );
}
const SwNode* pLineNd;
- if( pLine )
+ if( xLine )
{
if( nOffset )
- pLineNd = &pLine->GetEndNode();
+ pLineNd = &xLine->GetEndNode();
else
- pLineNd = &pLine->GetNode();
+ pLineNd = &xLine->GetNode();
}
else
{
@@ -1599,12 +1598,12 @@ void CompareData::CheckForChangesInLine( const CompareData& rData,
if( i )
{
- const SwCompareLine* pDstLn = GetLine( nThisStt + nDstFrom - 1 );
- const SwCompareLine* pSrcLn = rData.GetLine( nStt + nSrcFrom - 1 );
+ const SwCompareLine aDstLn = GetLine( nThisStt + nDstFrom - 1 );
+ const SwCompareLine aSrcLn = rData.GetLine( nStt + nSrcFrom - 1 );
// Show differences in detail for lines that
// were matched as only slightly different
- if( !pDstLn->ChangesInLine( *pSrcLn, m_pInsertRing, m_pDelRing ) )
+ if( !aDstLn.ChangesInLine( aSrcLn, m_pInsertRing, m_pDelRing ) )
{
ShowInsert( nThisStt + nDstFrom - 1, nThisStt + nDstFrom );
ShowDelete( rData, nStt + nSrcFrom - 1, nStt + nSrcFrom,
@@ -2169,8 +2168,8 @@ bool LineArrayComparator::Compare( int nIdx1, int nIdx2 ) const
return false;
}
- const SwTextNode *pTextNd1 = m_rData1.GetLine( m_nFirst1 + nIdx1 )->GetNode().GetTextNode();
- const SwTextNode *pTextNd2 = m_rData2.GetLine( m_nFirst2 + nIdx2 )->GetNode().GetTextNode();
+ const SwTextNode *pTextNd1 = m_rData1.GetLine( m_nFirst1 + nIdx1 ).GetNode().GetTextNode();
+ const SwTextNode *pTextNd2 = m_rData2.GetLine( m_nFirst2 + nIdx2 ).GetNode().GetTextNode();
if( !pTextNd1 || !pTextNd2
|| ( CmpOptions.bUseRsid && !pTextNd1->CompareParRsid( *pTextNd2 ) ) )
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index fb7211dbae3b..6b63e7a300c3 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -107,8 +107,8 @@ static void lcl_DefaultPageFormat( sal_uInt16 nPoolFormatId,
SvxLRSpaceItem aLR( RES_LR_SPACE );
SvxULSpaceItem aUL( RES_UL_SPACE );
- aUL.SetUpper( static_cast<sal_uInt16>(nMinTop) );
- aUL.SetLower( static_cast<sal_uInt16>(nMinBottom) );
+ aUL.SetUpper( o3tl::narrowing<sal_uInt16>(nMinTop) );
+ aUL.SetLower( o3tl::narrowing<sal_uInt16>(nMinBottom) );
aLR.SetRight( nMinRight );
aLR.SetLeft( nMinLeft );
@@ -753,6 +753,7 @@ void SwDoc::DelPageDesc( size_t i, bool bBroadcast )
PreDelPageDesc(&rDel); // #i7983#
m_PageDescs.erase(m_PageDescs.begin() + i);
+ delete &rDel;
getIDocumentState().SetModified();
}
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index c450f4213dc3..609b174072e0 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -135,7 +135,7 @@ static void lcl_AdjustPositioningAttr( SwDrawFrameFormat* _pFrameFormat,
}
// use geometry of drawing object
- const SwRect aObjRect = _rSdrObj.GetSnapRect();
+ const tools::Rectangle aObjRect = _rSdrObj.GetSnapRect();
if ( bVert )
{
@@ -172,9 +172,9 @@ static void lcl_AdjustPositioningAttr( SwDrawFrameFormat* _pFrameFormat,
const SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj( &_rSdrObj );
if ( auto pAnchoredDrawObj = dynamic_cast<const SwAnchoredDrawObject*>( pAnchoredObj) )
{
- const SwRect aObjRect = _rSdrObj.GetSnapRect();
+ const tools::Rectangle aObjRect = _rSdrObj.GetSnapRect();
const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
- ->SetLastObjRect( aObjRect.SVRect() );
+ ->SetLastObjRect( aObjRect );
}
}
}
@@ -199,7 +199,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
std::unique_ptr<SwUndoDrawGroup> pUndo;
if (GetIDocumentUndoRedo().DoesUndo())
- pUndo.reset(new SwUndoDrawGroup( static_cast<sal_uInt16>(rMrkList.GetMarkCount()), *this));
+ pUndo.reset(new SwUndoDrawGroup( o3tl::narrowing<sal_uInt16>(rMrkList.GetMarkCount()), *this));
// #i53320#
bool bGroupMembersNotPositioned( false );
@@ -335,7 +335,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView )
pFormatsAndObjs[i].emplace_back( pFormat, pSubObj );
if( bUndo )
- pUndo->AddObj( static_cast<sal_uInt16>(i2), pFormat );
+ pUndo->AddObj( o3tl::narrowing<sal_uInt16>(i2), pFormat );
}
}
}
@@ -419,7 +419,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
{
std::unique_ptr<SwUndoDrawDelete> pUndo;
if (GetIDocumentUndoRedo().DoesUndo())
- pUndo.reset(new SwUndoDrawDelete( static_cast<sal_uInt16>(rMrkList.GetMarkCount()), *this ));
+ pUndo.reset(new SwUndoDrawDelete( o3tl::narrowing<sal_uInt16>(rMrkList.GetMarkCount()), *this ));
// Destroy ContactObjects, save formats.
for( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 8b1b4b2a9bc0..bd0fb7dff196 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1675,7 +1675,7 @@ void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
const int nListLevel = pTNd->GetActualListLevel();
if ( nListLevel >= 0 )
{
- const SwNumFormat& rFormat = pRule->Get(static_cast<sal_uInt16>(nListLevel));
+ const SwNumFormat& rFormat = pRule->Get(o3tl::narrowing<sal_uInt16>(nListLevel));
if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
aLS.SetTextLeft( rFormat.GetIndentAt() );
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 286f0b4ad47f..7f2b30ddc615 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -106,7 +106,7 @@ SwPageDesc* SwEndNoteInfo::GetPageDesc(SwDoc& rDoc) const
{
if(!m_pPageDesc)
{
- m_pPageDesc = rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( static_cast<sal_uInt16>(
+ m_pPageDesc = rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( o3tl::narrowing<sal_uInt16>(
m_bEndNote ? RES_POOLPAGE_ENDNOTE : RES_POOLPAGE_FOOTNOTE ) );
m_aDepends.StartListening(m_pPageDesc);
}
@@ -139,7 +139,7 @@ void SwEndNoteInfo::SetFootnoteTextColl(SwTextFormatColl& rFormat)
SwCharFormat* SwEndNoteInfo::GetCharFormat(SwDoc& rDoc) const
{
- auto pCharFormatFromDoc = rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( static_cast<sal_uInt16>(
+ auto pCharFormatFromDoc = rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( o3tl::narrowing<sal_uInt16>(
m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
if (m_pCharFormat != pCharFormatFromDoc)
{
@@ -172,7 +172,7 @@ namespace
void SwEndNoteInfo::SetCharFormat(SwCharFormat* pFormat)
{
lcl_ResetPoolIdForDocAndSync(
- static_cast<sal_uInt16>(m_bEndNote
+ o3tl::narrowing<sal_uInt16>(m_bEndNote
? RES_POOLCHR_ENDNOTE
: RES_POOLCHR_FOOTNOTE),
pFormat,
@@ -181,7 +181,7 @@ void SwEndNoteInfo::SetCharFormat(SwCharFormat* pFormat)
SwCharFormat* SwEndNoteInfo::GetAnchorCharFormat(SwDoc& rDoc) const
{
- auto pAnchorFormatFromDoc = rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( static_cast<sal_uInt16>(
+ auto pAnchorFormatFromDoc = rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( o3tl::narrowing<sal_uInt16>(
m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
if(m_pAnchorFormat != pAnchorFormatFromDoc)
{
@@ -195,7 +195,7 @@ SwCharFormat* SwEndNoteInfo::GetAnchorCharFormat(SwDoc& rDoc) const
void SwEndNoteInfo::SetAnchorCharFormat(SwCharFormat* pFormat)
{
lcl_ResetPoolIdForDocAndSync(
- static_cast<sal_uInt16>(m_bEndNote
+ o3tl::narrowing<sal_uInt16>(m_bEndNote
? RES_POOLCHR_ENDNOTE_ANCHOR
: RES_POOLCHR_FOOTNOTE_ANCHOR),
pFormat,
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 2da94ef4699c..556ff77fdb78 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -311,7 +311,7 @@ SwFlyFrameFormat* SwDoc::MakeFlySection( RndStdIds eAnchorType,
if( !pFrameFormat )
pFrameFormat = getIDocumentStylePoolAccess().GetFrameFormatFromPool( RES_POOLFRM_FRAME );
- sal_uInt16 nCollId = static_cast<sal_uInt16>(
+ sal_uInt16 nCollId = o3tl::narrowing<sal_uInt16>(
GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE) ? RES_POOLCOLL_TEXT : RES_POOLCOLL_FRAME );
/* If there is no adjust item in the paragraph style for the content node of the new fly section
@@ -1571,11 +1571,11 @@ bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const
checkFormats.push_back( pFormat );
}
#endif
- std::vector<SwFrameFormat*> const*const pFlys(pFlyNd->GetAnchoredFlys());
+ std::vector<SwFrameFormat*> const & rFlys(pFlyNd->GetAnchoredFlys());
bool bFound(false);
- for (size_t i = 0; pFlys && i < pFlys->size(); ++i)
+ for (size_t i = 0; i < rFlys.size(); ++i)
{
- const SwFrameFormat *const pFormat = (*pFlys)[i];
+ const SwFrameFormat *const pFormat = rFlys[i];
const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
if( pIdx && pFlyNd == &pIdx->GetNode() )
{
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index a674beb9fde6..ae2f24a92a8a 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -845,10 +845,10 @@ void SwDoc::ReplaceDefaults(const SwDoc& rSource)
// copy property defaults
const sal_uInt16 aRangeOfDefaults[] =
{
- RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
XATTR_START, XATTR_END-1,
0
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 5e287e84f19d..95461208e954 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -246,7 +246,7 @@ bool SwDoc::OutlineUpDown(const SwPaM& rPam, short nOffset,
n++;
SwTextFormatColl *aTmpColl =
- getIDocumentStylePoolAccess().GetTextCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n));
+ getIDocumentStylePoolAccess().GetTextCollFromPool(o3tl::narrowing<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n));
if( aTmpColl->IsAssignedToListLevelOfOutlineStyle() &&
aTmpColl->GetAssignedOutlineStyleLevel() == n )
@@ -275,7 +275,7 @@ bool SwDoc::OutlineUpDown(const SwPaM& rPam, short nOffset,
n--;
SwTextFormatColl *aTmpColl =
- getIDocumentStylePoolAccess().GetTextCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n));
+ getIDocumentStylePoolAccess().GetTextCollFromPool(o3tl::narrowing<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n));
if( aTmpColl->IsAssignedToListLevelOfOutlineStyle() &&
aTmpColl->GetAssignedOutlineStyleLevel() == n )
@@ -1163,10 +1163,9 @@ void SwDoc::StopNumRuleAnimations( const OutputDevice* pOut )
}
}
-bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
+void SwDoc::ReplaceNumRule( const SwPosition& rPos,
const OUString& rOldRule, const OUString& rNewRule )
{
- bool bRet = false;
SwNumRule *pOldRule = FindNumRulePtr( rOldRule ),
*pNewRule = FindNumRulePtr( rNewRule );
if( pOldRule && pNewRule && pOldRule != pNewRule )
@@ -1185,16 +1184,6 @@ bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
if ( !aTextNodeList.empty() )
{
SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : nullptr );
- sal_uInt16 nChgFormatLevel = 0;
- for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
- {
- const SwNumFormat& rOldFormat = pOldRule->Get( n ),
- & rNewFormat = pNewRule->Get( n );
-
- if( rOldFormat.GetAbsLSpace() != rNewFormat.GetAbsLSpace() ||
- rOldFormat.GetFirstLineOffset() != rNewFormat.GetFirstLineOffset() )
- nChgFormatLevel |= ( 1 << n );
- }
const SwTextNode* pGivenTextNode = rPos.nNode.GetNode().GetTextNode();
SwNumRuleItem aRule( rNewRule );
@@ -1211,12 +1200,8 @@ bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
}
GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
getIDocumentState().SetModified();
-
- bRet = true;
}
}
-
- return bRet;
}
namespace
@@ -2556,7 +2541,7 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) c
if( sNm.startsWith( aName ) )
{
// Determine Number and set the Flag
- nNum = static_cast<sal_uInt16>(sNm.copy( nNmLen ).toInt32());
+ nNum = o3tl::narrowing<sal_uInt16>(sNm.copy( nNmLen ).toInt32());
if( nNum-- && nNum < mpNumRuleTable->size() )
pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
}
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 25a664d17bf8..fbed71be7f1e 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -57,7 +57,7 @@ SwDoc* SwSortElement::pDoc = nullptr;
const FlatFndBox* SwSortElement::pBox = nullptr;
CollatorWrapper* SwSortElement::pSortCollator = nullptr;
lang::Locale* SwSortElement::pLocale = nullptr;
-OUString* SwSortElement::pLastAlgorithm = nullptr;
+std::optional<OUString> SwSortElement::xLastAlgorithm;
LocaleDataWrapper* SwSortElement::pLclData = nullptr;
// List of all sorted elements
@@ -87,8 +87,7 @@ void SwSortElement::Finit()
pOptions = nullptr;
delete pLocale;
pLocale = nullptr;
- delete pLastAlgorithm;
- pLastAlgorithm = nullptr;
+ xLastAlgorithm.reset();
delete pSortCollator;
pSortCollator = nullptr;
delete pLclData;
@@ -121,8 +120,8 @@ int SwSortElement::keycompare(const SwSortElement& rCmp, sal_uInt16 nKey) const
// The actual comparison
const SwSortElement *pOrig, *pCmp;
- const SwSortKey* pSrtKey = pOptions->aKeys[ nKey ].get();
- if( pSrtKey->eSortOrder == SwSortOrder::Ascending )
+ const SwSortKey& rSrtKey = pOptions->aKeys[ nKey ];
+ if( rSrtKey.eSortOrder == SwSortOrder::Ascending )
{
pOrig = this;
pCmp = &rCmp;
@@ -133,7 +132,7 @@ int SwSortElement::keycompare(const SwSortElement& rCmp, sal_uInt16 nKey) const
pCmp = this;
}
- if( pSrtKey->bIsNumeric )
+ if( rSrtKey.bIsNumeric )
{
double n1 = pOrig->GetValue( nKey );
double n2 = pCmp->GetValue( nKey );
@@ -142,13 +141,10 @@ int SwSortElement::keycompare(const SwSortElement& rCmp, sal_uInt16 nKey) const
}
else
{
- if( !pLastAlgorithm || *pLastAlgorithm != pSrtKey->sSortType )
+ if( !xLastAlgorithm || *xLastAlgorithm != rSrtKey.sSortType )
{
- if( pLastAlgorithm )
- *pLastAlgorithm = pSrtKey->sSortType;
- else
- pLastAlgorithm = new OUString( pSrtKey->sSortType );
- pSortCollator->loadCollatorAlgorithm( *pLastAlgorithm,
+ xLastAlgorithm = rSrtKey.sSortType;
+ pSortCollator->loadCollatorAlgorithm( *xLastAlgorithm,
*pLocale,
pOptions->bIgnoreCase ? SW_COLLATOR_IGNORES : 0 );
}
@@ -196,7 +192,7 @@ OUString SwSortTextElement::GetKey(sal_uInt16 nId) const
const OUString& rStr = pTextNd->GetText();
sal_Unicode nDeli = pOptions->cDeli;
- sal_uInt16 nDCount = pOptions->aKeys[nId]->nColumnId, i = 1;
+ sal_uInt16 nDCount = pOptions->aKeys[nId].nColumnId, i = 1;
sal_Int32 nStart = 0;
// Find the delimiter
@@ -228,7 +224,7 @@ SwSortBoxElement::SwSortBoxElement( sal_uInt16 nRC )
OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const
{
const FndBox_* pFndBox;
- sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1;
+ sal_uInt16 nCol = pOptions->aKeys[nKey].nColumnId-1;
if( SwSortDirection::Rows == pOptions->eDirection )
pFndBox = pBox->GetBox(nCol, nRow); // Sort rows
@@ -260,7 +256,7 @@ OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const
double SwSortBoxElement::GetValue( sal_uInt16 nKey ) const
{
const FndBox_* pFndBox;
- sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1;
+ sal_uInt16 nCol = pOptions->aKeys[nKey].nColumnId-1;
if( SwSortDirection::Rows == pOptions->eDirection )
pFndBox = pBox->GetBox(nCol, nRow); // Sort rows
@@ -555,7 +551,7 @@ bool SwDoc::SortTable(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
std::multiset<SwSortBoxElement> aSortList;
// When sorting, do not include the first row if the HeaderLine is repeated
- for( sal_uInt16 i = static_cast<sal_uInt16>(nStart); i < nCount; ++i)
+ for( sal_uInt16 i = o3tl::narrowing<sal_uInt16>(nStart); i < nCount; ++i)
{
aSortList.insert(SwSortBoxElement(i));
}
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index d8e7d30e80e1..a8916a113a05 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1520,7 +1520,7 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType,
std::unique_ptr<SwTOXPara> pNew( MakeSwTOXSortTabBase<SwTOXPara>(
pLayout, *pCNd, eMyType,
( USHRT_MAX != nSetLevel )
- ? static_cast<sal_uInt16>(nSetLevel)
+ ? o3tl::narrowing<sal_uInt16>(nSetLevel)
: FORM_ALPHA_DELIMITER ) );
InsertSorted( std::move(pNew) );
}
@@ -1570,7 +1570,7 @@ void SwTOXBaseSection::UpdateTable(const SwTextNode* pOwnChapterNode,
if( pOutlNd->GetTextColl()->IsAssignedToListLevelOfOutlineStyle())
{
const int nTmp = pOutlNd->GetTextColl()->GetAttrOutlineLevel();
- pNew->SetLevel(static_cast<sal_uInt16>(nTmp));
+ pNew->SetLevel(o3tl::narrowing<sal_uInt16>(nTmp));
}
}
}
@@ -1717,7 +1717,9 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
const SwTOXInternational& rIntl )
{
// collect starts end ends of main entry character style
- std::unique_ptr< std::vector<sal_uInt16> > xCharStyleIdx(pMainEntryNums ? new std::vector<sal_uInt16> : nullptr);
+ std::optional< std::vector<sal_uInt16> > xCharStyleIdx;
+ if (pMainEntryNums)
+ xCharStyleIdx.emplace();
OUString sSrchStr
= OUStringChar(C_NUM_REPL) + SwTOXMark::S_PAGE_DELI + OUStringChar(C_NUM_REPL);
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 6a91ac469294..a0dcda5cff88 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -588,7 +588,7 @@ void SwTextFormatColl::SetAttrOutlineLevel( int nLevel)
{
OSL_ENSURE( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTextFormatColl: Level Out Of Range" );
SetFormatAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL,
- static_cast<sal_uInt16>(nLevel) ) );
+ o3tl::narrowing<sal_uInt16>(nLevel) ) );
}
int SwTextFormatColl::GetAttrOutlineLevel() const
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 67dc9b9c56b5..41a10d34c10b 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -314,7 +314,7 @@ sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByVisArea( const SwDoc& rDoc )
SwViewShell const *pVSh = rDoc.getIDocumentLayoutAccess().GetCurrentViewShell();
if( pVSh )
{
- return static_cast<sal_uInt16>(pVSh->GetBrowseWidth());
+ return o3tl::narrowing<sal_uInt16>(pVSh->GetBrowseWidth());
}
return 0;
@@ -328,7 +328,7 @@ sal_uInt16 SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc )
{
const SwFrame *pPageFrame = pRootFrame->GetLower();
if( pPageFrame )
- return static_cast<sal_uInt16>(pPageFrame->getFramePrintArea().Width());
+ return o3tl::narrowing<sal_uInt16>(pPageFrame->getFramePrintArea().Width());
}
// #i91658#
@@ -367,7 +367,7 @@ sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTabFrame(
rTabFrame.CalcFlyOffsets( nUpperDummy, nLeftOffset, nRightOffset );
nWidth -= (nLeftOffset + nRightOffset);
- return static_cast<sal_uInt16>(std::min(nWidth, SwTwips(SAL_MAX_UINT16)));
+ return o3tl::narrowing<sal_uInt16>(std::min(nWidth, SwTwips(SAL_MAX_UINT16)));
}
sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTable( const SwDoc& rDoc ) const
@@ -985,7 +985,7 @@ void SwHTMLTableLayout::AutoLayoutPass1()
{
// the next column gets the rest
sal_uInt16 nColWidth =
- static_cast<sal_uInt16>((pColumn->GetMax() * nRelLeft) / nFixMax);
+ o3tl::narrowing<sal_uInt16>((pColumn->GetMax() * nRelLeft) / nFixMax);
pColumn->SetWidthOption( nColWidth );
}
}
@@ -1112,8 +1112,8 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
{
sal_uLong nAbsLeftFillL = nAbsLeftFill, nAbsRightFillL = nAbsRightFill;
- m_nRelLeftFill = static_cast<sal_uInt16>((nAbsLeftFillL * nRelAvail) / nAbsAvail);
- m_nRelRightFill = static_cast<sal_uInt16>((nAbsRightFillL * nRelAvail) / nAbsAvail);
+ m_nRelLeftFill = o3tl::narrowing<sal_uInt16>((nAbsLeftFillL * nRelAvail) / nAbsAvail);
+ m_nRelRightFill = o3tl::narrowing<sal_uInt16>((nAbsRightFillL * nRelAvail) / nAbsAvail);
nAbsAvail -= (nAbsLeftFill + nAbsRightFill);
if( nRelAvail )
@@ -1145,7 +1145,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
// Let's play such games now anyway. We had a graphic in a 1% wide
// table and it didn't fit in of course.
- nAbsTabWidth = static_cast<sal_uInt16>( (static_cast<sal_uLong>(nAbsAvail) * m_nWidthOption) / 100 );
+ nAbsTabWidth = o3tl::narrowing<sal_uInt16>( (static_cast<sal_uLong>(nAbsAvail) * m_nWidthOption) / 100 );
if( IsTopTable() &&
( /*MayBeInFlyFrame() ||*/ static_cast<sal_uLong>(nAbsTabWidth) > m_nMin ) )
{
@@ -1214,17 +1214,17 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
if( nColMin <= USHRT_MAX )
{
pColumn->SetAbsColWidth(
- static_cast<sal_uInt16>((nColMin * nAbsTabWidth) / m_nMin) );
+ o3tl::narrowing<sal_uInt16>((nColMin * nAbsTabWidth) / m_nMin) );
pColumn->SetRelColWidth(
- static_cast<sal_uInt16>((nColMin * m_nRelTabWidth) / m_nMin) );
+ o3tl::narrowing<sal_uInt16>((nColMin * m_nRelTabWidth) / m_nMin) );
}
else
{
double nColMinD = nColMin;
pColumn->SetAbsColWidth(
- static_cast<sal_uInt16>((nColMinD * nAbsTabWidth) / m_nMin) );
+ o3tl::narrowing<sal_uInt16>((nColMinD * nAbsTabWidth) / m_nMin) );
pColumn->SetRelColWidth(
- static_cast<sal_uInt16>((nColMinD * m_nRelTabWidth) / m_nMin) );
+ o3tl::narrowing<sal_uInt16>((nColMinD * m_nRelTabWidth) / m_nMin) );
}
nAbs = nAbs + pColumn->GetAbsColWidth();
@@ -1251,17 +1251,17 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
if( nColMin <= USHRT_MAX )
{
pColumn->SetAbsColWidth(
- static_cast<sal_uInt16>((((nColMin-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
+ o3tl::narrowing<sal_uInt16>((((nColMin-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
pColumn->SetRelColWidth(
- static_cast<sal_uInt16>((((nColMin-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
+ o3tl::narrowing<sal_uInt16>((((nColMin-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
}
else
{
double nColMinD = nColMin;
pColumn->SetAbsColWidth(
- static_cast<sal_uInt16>((((nColMinD-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
+ o3tl::narrowing<sal_uInt16>((((nColMinD-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
pColumn->SetRelColWidth(
- static_cast<sal_uInt16>((((nColMinD-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
+ o3tl::narrowing<sal_uInt16>((((nColMinD-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
}
nAbs = nAbs + pColumn->GetAbsColWidth();
@@ -1284,7 +1284,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
// No fixed width, use the maximum.
if( !nAbsTabWidth )
- nAbsTabWidth = static_cast<sal_uInt16>(m_nMax);
+ nAbsTabWidth = o3tl::narrowing<sal_uInt16>(m_nMax);
// A top table may also get wider then the available space.
if( nAbsTabWidth > nAbsAvail )
@@ -1301,7 +1301,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
{
if (nAbsAvail == 0)
throw o3tl::divide_by_zero();
- m_nRelTabWidth = static_cast<sal_uInt16>((nAbsTabWidthL * nRelAvail) / nAbsAvail);
+ m_nRelTabWidth = o3tl::narrowing<sal_uInt16>((nAbsTabWidthL * nRelAvail) / nAbsAvail);
}
else
m_nRelTabWidth = nAbsTabWidth;
@@ -1339,7 +1339,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
// The column keeps its width.
nFixedCols++;
sal_uLong nColMax = pColumn->GetMax();
- pColumn->SetAbsColWidth( static_cast<sal_uInt16>(nColMax) );
+ pColumn->SetAbsColWidth( o3tl::narrowing<sal_uInt16>(nColMax) );
sal_uLong nRelColWidth =
(nColMax * m_nRelTabWidth) / nAbsTabWidth;
@@ -1349,10 +1349,10 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
nRelColWidth++;
else if( nChkWidth > nColMax )
nRelColWidth--;
- pColumn->SetRelColWidth( static_cast<sal_uInt16>(nRelColWidth) );
+ pColumn->SetRelColWidth( o3tl::narrowing<sal_uInt16>(nRelColWidth) );
- nAbs = nAbs + static_cast<sal_uInt16>(nColMax);
- nRel = nRel + static_cast<sal_uInt16>(nRelColWidth);
+ nAbs = nAbs + o3tl::narrowing<sal_uInt16>(nColMax);
+ nRel = nRel + o3tl::narrowing<sal_uInt16>(nRelColWidth);
}
}
@@ -1381,9 +1381,9 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
{
sal_uLong nColMax = pColumn->GetMax();
pColumn->SetAbsColWidth(
- static_cast<sal_uInt16>((nColMax * nDistAbsTabWidth) / nDistMax) );
+ o3tl::narrowing<sal_uInt16>((nColMax * nDistAbsTabWidth) / nDistMax) );
pColumn->SetRelColWidth(
- static_cast<sal_uInt16>((nColMax * nDistRelTabWidth) / nDistMax) );
+ o3tl::narrowing<sal_uInt16>((nColMax * nDistRelTabWidth) / nDistMax) );
}
nAbs = nAbs + pColumn->GetAbsColWidth();
nRel = nRel + pColumn->GetRelColWidth();
@@ -1400,9 +1400,9 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
{
sal_uLong nColMax = GetColumn( i )->GetMax();
GetColumn( i )->SetAbsColWidth(
- static_cast<sal_uInt16>((nColMax * nAbsTabWidth) / m_nMax) );
+ o3tl::narrowing<sal_uInt16>((nColMax * nAbsTabWidth) / m_nMax) );
GetColumn( i )->SetRelColWidth(
- static_cast<sal_uInt16>((nColMax * m_nRelTabWidth) / m_nMax) );
+ o3tl::narrowing<sal_uInt16>((nColMax * m_nRelTabWidth) / m_nMax) );
}
}
}
@@ -1413,7 +1413,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
if( !nAbsTabWidth )
nAbsTabWidth = nAbsAvail;
if( nAbsTabWidth < m_nMin )
- nAbsTabWidth = static_cast<sal_uInt16>(m_nMin);
+ nAbsTabWidth = o3tl::narrowing<sal_uInt16>(m_nMin);
if( nAbsTabWidth > nAbsAvail )
{
@@ -1427,7 +1427,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
{
if (nAbsAvail == 0)
throw o3tl::divide_by_zero();
- m_nRelTabWidth = static_cast<sal_uInt16>((nAbsTabWidthL * nRelAvail) / nAbsAvail);
+ m_nRelTabWidth = o3tl::narrowing<sal_uInt16>((nAbsTabWidthL * nRelAvail) / nAbsAvail);
}
else
m_nRelTabWidth = nAbsTabWidth;
@@ -1442,10 +1442,10 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
? (nAbsColWidth * m_nRelTabWidth) / nAbsTabWidth
: nAbsColWidth;
- GetColumn( i )->SetAbsColWidth( static_cast<sal_uInt16>(nAbsColWidth) );
- GetColumn( i )->SetRelColWidth( static_cast<sal_uInt16>(nRelColWidth) );
- nAbs = nAbs + static_cast<sal_uInt16>(nAbsColWidth);
- nRel = nRel + static_cast<sal_uInt16>(nRelColWidth);
+ GetColumn( i )->SetAbsColWidth( o3tl::narrowing<sal_uInt16>(nAbsColWidth) );
+ GetColumn( i )->SetRelColWidth( o3tl::narrowing<sal_uInt16>(nRelColWidth) );
+ nAbs = nAbs + o3tl::narrowing<sal_uInt16>(nAbsColWidth);
+ nRel = nRel + o3tl::narrowing<sal_uInt16>(nRelColWidth);
}
GetColumn( m_nCols-1 )->SetAbsColWidth( nAbsTabWidth - nAbs );
GetColumn( m_nCols-1 )->SetRelColWidth( m_nRelTabWidth - nRel );
@@ -1462,8 +1462,8 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
// Calculate the width of additional cells we use for
// aligning inner tables.
- sal_uInt16 nAbsDist = static_cast<sal_uInt16>(nAbsAvail-nAbsTabWidth);
- sal_uInt16 nRelDist = static_cast<sal_uInt16>(nRelAvail-m_nRelTabWidth);
+ sal_uInt16 nAbsDist = o3tl::narrowing<sal_uInt16>(nAbsAvail-nAbsTabWidth);
+ sal_uInt16 nRelDist = o3tl::narrowing<sal_uInt16>(nRelAvail-m_nRelTabWidth);
sal_uInt16 nParentInhAbsLeftSpace = 0, nParentInhAbsRightSpace = 0;
// Calculate the size and position of the additional cells.
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index c0b8984e6cf4..e4f2e071afba 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -131,7 +131,7 @@ static void lcl_PaintReplacement( const SwRect &rRect, const OUString &rText,
else if ( !rURL.GetURL().isEmpty() )
bVisited = rSh.GetDoc()->IsVisitedURL( rURL.GetURL() );
- SwFormat *pFormat = rSh.GetDoc()->getIDocumentStylePoolAccess().GetFormatFromPool( static_cast<sal_uInt16>
+ SwFormat *pFormat = rSh.GetDoc()->getIDocumentStylePoolAccess().GetFormatFromPool( o3tl::narrowing<sal_uInt16>
(bVisited ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL ) );
aCol = pFormat->GetColor().GetValue();
eUnderline = pFormat->GetUnderline().GetLineStyle();
@@ -141,7 +141,7 @@ static void lcl_PaintReplacement( const SwRect &rRect, const OUString &rText,
aFont.SetColor( aCol );
const BitmapEx& rBmp = const_cast<SwViewShell&>(rSh).GetReplacementBitmap(bDefect);
- Graphic::DrawEx( rSh.GetOut(), rText, aFont, rBmp, rRect.Pos(), rRect.SSize() );
+ Graphic::DrawEx(*rSh.GetOut(), rText, aFont, rBmp, rRect.Pos(), rRect.SSize());
}
SwNoTextFrame::SwNoTextFrame(SwNoTextNode * const pNode, SwFrame* pSib )
@@ -200,7 +200,7 @@ static void lcl_ClearArea( const SwFrame &rFrame,
{
for( const auto &rRegion : aRegion )
{
- ::DrawGraphic( pItem, &rOut, aOrigRect, rRegion );
+ ::DrawGraphic(pItem, rOut, aOrigRect, rRegion);
}
}
}
@@ -1212,7 +1212,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
else if( pShell->GetWin() && pOut->IsVirtual() )
{
pVout = pOut;
- pOut = pShell->GetWin();
+ pOut = pShell->GetWin()->GetOutDev();
}
else
pVout = nullptr;
@@ -1260,7 +1260,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
: nullptr);
// tdf#130951 caution - target may be Window, use the correct OutputDevice
OutputDevice* pTarget(pShell->isOutputToWindow()
- ? pShell->GetWin()
+ ? pShell->GetWin()->GetOutDev()
: pShell->GetOut());
SdrPageWindow* pPageWindow(nullptr != pPageView && nullptr != pTarget
? pPageView->FindPageWindow(*pTarget)
@@ -1380,7 +1380,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
if ( pGraphic && pGraphic->GetType() != GraphicType::NONE )
{
- pGraphic->Draw( pOut, aPosition, aSize );
+ pGraphic->Draw(*pOut, aPosition, aSize);
// shade the representation if the object is activated outplace
uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index ecd1b119b95e..eb84b1b63a68 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -659,7 +659,7 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
if (nLevel < MAXLEVEL)
{
- const SwNumFormat& rMyNFormat = Get( static_cast<sal_uInt16>(nLevel) );
+ const SwNumFormat& rMyNFormat = Get( o3tl::narrowing<sal_uInt16>(nLevel) );
{
css::lang::Locale aLocale( LanguageTag::convertToLocale(nLang));
@@ -789,7 +789,7 @@ OUString SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
if (nListLevel >= MAXLEVEL)
nListLevel = MAXLEVEL - 1;
- SwNumFormat aFormat( Get( static_cast<sal_uInt16>(nListLevel) ) );
+ SwNumFormat aFormat( Get( o3tl::narrowing<sal_uInt16>(nListLevel) ) );
bMakeNumStringForPhantom = aFormat.IsEnumeration() &&
SVX_NUM_NUMBER_NONE != aFormat.GetNumberingType();
@@ -834,7 +834,7 @@ OUString SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
if ( bInclSuperiorNumLabels && pWorkingNodeNum->GetLevelInListTree() > 0 )
{
- sal_uInt8 n = Get( static_cast<sal_uInt16>(pWorkingNodeNum->GetLevelInListTree()) ).GetIncludeUpperLevels();
+ sal_uInt8 n = Get( o3tl::narrowing<sal_uInt16>(pWorkingNodeNum->GetLevelInListTree()) ).GetIncludeUpperLevels();
pWorkingNodeNum = dynamic_cast<SwNodeNum*>(pWorkingNodeNum->GetParent());
// skip parents, whose list label is already contained in the actual list label.
while ( pWorkingNodeNum && n > 1 )
diff --git a/sw/source/core/doc/sortopt.cxx b/sw/source/core/doc/sortopt.cxx
index 06ac058568af..b5fc62ba845d 100644
--- a/sw/source/core/doc/sortopt.cxx
+++ b/sw/source/core/doc/sortopt.cxx
@@ -45,16 +45,13 @@ SwSortOptions::SwSortOptions()
}
SwSortOptions::SwSortOptions(const SwSortOptions& rOpt) :
+ aKeys( rOpt.aKeys ),
eDirection( rOpt.eDirection ),
cDeli( rOpt.cDeli ),
nLanguage( rOpt.nLanguage ),
bTable( rOpt.bTable ),
bIgnoreCase( rOpt.bIgnoreCase )
{
- for(auto const & pKey : rOpt.aKeys)
- {
- aKeys.push_back( std::make_unique<SwSortKey>(*pKey) );
- }
}
SwSortOptions::~SwSortOptions()
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 6bc270801873..337c7bcef619 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -225,7 +225,7 @@ namespace
}
if( bNoSelection && mnStartCol < USHRT_MAX )
{
- sal_uInt16 nIdx = std::min(mnStartCol, static_cast<sal_uInt16>(maLines[0].size()));
+ sal_uInt16 nIdx = std::min(mnStartCol, o3tl::narrowing<sal_uInt16>(maLines[0].size()));
mnStartCol = std::accumulate(maLines[0].begin(), maLines[0].begin() + nIdx, sal_uInt16(0),
[](sal_uInt16 sum, const BoxSpanInfo& rInfo) { return sum + rInfo.mnColSpan; });
}
@@ -298,7 +298,7 @@ namespace
aInfo.mbSelected = true;
if( mnStartCol == USHRT_MAX )
{
- mnStartCol = static_cast<sal_uInt16>(maLines[nLine].size());
+ mnStartCol = o3tl::narrowing<sal_uInt16>(maLines[nLine].size());
if( pSelBoxes->size() < 2 )
{
pSelBoxes = nullptr;
@@ -352,7 +352,7 @@ namespace
const sal_uInt16 nLineCount = rLines.size();
if( nLineCount < mnAddLine )
mnAddLine = nLineCount;
- sal_uInt16 nLine = static_cast<sal_uInt16>(maLines.size());
+ sal_uInt16 nLine = o3tl::narrowing<sal_uInt16>(maLines.size());
maLines.resize( nLine + mnAddLine );
while( mnAddLine )
{
@@ -591,7 +591,7 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox,
: RES_POOLCOLL_TABLE_HDLN == nPoolId ) )
{
SwTextFormatColl* pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(
- static_cast<sal_uInt16>(
+ o3tl::narrowing<sal_uInt16>(
RES_POOLCOLL_TABLE == nPoolId
? RES_POOLCOLL_TABLE_HDLN
: RES_POOLCOLL_TABLE ) );
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 818782a5ff1b..18eab679a289 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -672,7 +672,7 @@ void DeleteBox_( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo,
// JP 02.04.97: 1st part for Bug 36271
// First the left/right edges
- if( nDelPos + 1 < static_cast<sal_uInt16>(rTableBoxes.size()) )
+ if( nDelPos + 1 < o3tl::narrowing<sal_uInt16>(rTableBoxes.size()) )
{
SwTableBox* pNxtBox = rTableBoxes[ nDelPos + 1 ];
const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrameFormat()->GetBox();
@@ -698,7 +698,7 @@ void DeleteBox_( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo,
SwTableBox* pPrvBox = rTableBoxes[ nDelPos - 1 ];
const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrameFormat()->GetBox();
- SwTableBox* pNxtBox = nDelPos + 1 < static_cast<sal_uInt16>(rTableBoxes.size())
+ SwTableBox* pNxtBox = nDelPos + 1 < o3tl::narrowing<sal_uInt16>(rTableBoxes.size())
? rTableBoxes[ nDelPos + 1 ] : nullptr;
if( pPrvBox->GetSttNd() && !rPrvBoxItem.GetRight() &&
@@ -854,7 +854,7 @@ lcl_FndNxtPrvDelBox( const SwTableLines& rTableLns,
--*pCurPos;
pAllDelBoxes->erase( pAllDelBoxes->begin() + nFndPos );
}
- } while( bNxt ? ( nLinePos + 1 < static_cast<sal_uInt16>(rTableLns.size()) ) : nLinePos != 0 );
+ } while( bNxt ? ( nLinePos + 1 < o3tl::narrowing<sal_uInt16>(rTableLns.size()) ) : nLinePos != 0 );
return pFndBox;
}
@@ -897,7 +897,7 @@ lcl_SaveUpperLowerBorder( SwTable& rTable, const SwTableBox& rBox,
pPrvBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth,
nLnPos, false, pAllDelBoxes, pCurPos );
- if( nLnPos + 1 < static_cast<sal_uInt16>(pTableLns->size()) ) // Successor?
+ if( nLnPos + 1 < o3tl::narrowing<sal_uInt16>(pTableLns->size()) ) // Successor?
pNxtBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth,
nLnPos, true, pAllDelBoxes, pCurPos );
@@ -1371,7 +1371,7 @@ static void lcl_Merge_MoveBox(FndBox_ & rFndBox, InsULPara *const pULPara)
{
// if there are Boxes behind it, move them
nPos = pFndTableBox->GetUpper()->GetBoxPos( pFndTableBox );
- if( nPos +1 < static_cast<sal_uInt16>(pBoxes->size()) )
+ if( nPos +1 < o3tl::narrowing<sal_uInt16>(pBoxes->size()) )
{
nInsPos = pULPara->pInsLine->GetTabBoxes().size();
lcl_CpyBoxes( nPos+1, pBoxes->size(),
@@ -1444,7 +1444,7 @@ static void lcl_Merge_MoveLine(FndLine_& rFndLine, InsULPara *const pULPara)
}
else
// If there are Lines after it, move them
- if( (nPos = pLines->GetPos( pFndLn )) + 1 < static_cast<sal_uInt16>(pLines->size()) )
+ if( (nPos = pLines->GetPos( pFndLn )) + 1 < o3tl::narrowing<sal_uInt16>(pLines->size()) )
{
nInsPos = pULPara->pInsBox->GetTabLines().size();
lcl_CpyLines( nPos+1, pLines->size(), *pLines,
@@ -1479,7 +1479,7 @@ static void lcl_Merge_MoveLine(FndLine_& rFndLine, InsULPara *const pULPara)
}
else
// If there are Lines after it, move them
- if( (nPos = pLines->GetPos( pFndLn )) + 1 < static_cast<sal_uInt16>(pLines->size()) )
+ if( (nPos = pLines->GetPos( pFndLn )) + 1 < o3tl::narrowing<sal_uInt16>(pLines->size()) )
lcl_CpyLines( nPos+1, pLines->size(), *pLines,
pLMBox );
lcl_CalcWidth( pLMBox ); // calculate the Box's width
@@ -1678,7 +1678,7 @@ static sal_uInt16 lcl_GetBoxOffset( const FndBox_& rBox )
{
if (pBox==pCmp)
break;
- nRet = nRet + static_cast<sal_uInt16>(pCmp->GetFrameFormat()->GetFrameSize().GetWidth());
+ nRet = nRet + o3tl::narrowing<sal_uInt16>(pCmp->GetFrameFormat()->GetFrameSize().GetWidth());
}
pBox = pBox->GetUpper()->GetUpper();
} while( pBox );
@@ -1690,7 +1690,7 @@ static sal_uInt16 lcl_GetLineWidth( const FndLine_& rLine )
sal_uInt16 nRet = 0;
for( auto n = rLine.GetBoxes().size(); n; )
{
- nRet = nRet + static_cast<sal_uInt16>(rLine.GetBoxes()[--n]->GetBox()
+ nRet = nRet + o3tl::narrowing<sal_uInt16>(rLine.GetBoxes()[--n]->GetBox()
->GetFrameFormat()->GetFrameSize().GetWidth());
}
return nRet;
@@ -2202,7 +2202,7 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTable,
{
nFndPos = GetBoxPos( pSrchBox );
if( USHRT_MAX != nFndPos &&
- nFndPos + 1 != static_cast<sal_uInt16>(GetTabBoxes().size()) )
+ nFndPos + 1 != o3tl::narrowing<sal_uInt16>(GetTabBoxes().size()) )
{
pBox = GetTabBoxes()[ nFndPos + 1 ];
while( !pBox->GetTabLines().empty() )
@@ -2216,7 +2216,7 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTable,
nFndPos = GetUpper()->GetTabLines().GetPos( pLine );
OSL_ENSURE( USHRT_MAX != nFndPos, "Line is not in the Table" );
// Is there another Line?
- if( nFndPos+1 >= static_cast<sal_uInt16>(GetUpper()->GetTabLines().size()) )
+ if( nFndPos+1 >= o3tl::narrowing<sal_uInt16>(GetUpper()->GetTabLines().size()) )
return GetUpper()->GetUpper()->FindNextBox( rTable, GetUpper(), bOvrTableLns );
pLine = GetUpper()->GetTabLines()[nFndPos+1];
}
@@ -2224,7 +2224,7 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTable,
{
// Search for the next Line in the Table
nFndPos = rTable.GetTabLines().GetPos( pLine );
- if( nFndPos + 1 >= static_cast<sal_uInt16>(rTable.GetTabLines().size()) )
+ if( nFndPos + 1 >= o3tl::narrowing<sal_uInt16>(rTable.GetTabLines().size()) )
return nullptr; // there are no more Boxes
pLine = rTable.GetTabLines()[ nFndPos+1 ];
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 72676dcf777f..984d28a64bfc 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -38,6 +38,9 @@
#include <sal/log.hxx>
#include <tools/UnitConversion.hxx>
#include <svx/swframetypes.hxx>
+#include <drawdoc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <DocumentDrawModelManager.hxx>
#include <com/sun/star/document/XActionLockable.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
@@ -135,6 +138,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, bool bCopyText)
pShape->SetFormatAttr(aSet);
}
+ DoTextBoxZOrderCorrection(pShape);
// Also initialize the properties, which are not constant, but inherited from the shape's ones.
uno::Reference<drawing::XShape> xShape(pShape->FindRealSdrObject()->getUnoShape(),
uno::UNO_QUERY);
@@ -542,7 +546,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, std::u16string_view rP
syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(eMode2));
}
else
- SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled property: "
+ SAL_INFO("sw.core", "SwTextBoxHelper::syncProperty: unhandled property: "
<< static_cast<OUString>(rPropertyName));
}
@@ -575,7 +579,7 @@ void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID,
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::getProperty: unhandled member-id: "
- << static_cast<sal_uInt16>(nMemberID));
+ << o3tl::narrowing<sal_uInt16>(nMemberID));
break;
}
}
@@ -633,7 +637,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled member-id: "
- << static_cast<sal_uInt16>(nMemberID)
+ << o3tl::narrowing<sal_uInt16>(nMemberID)
<< " (which-id: " << nWID << ")");
break;
}
@@ -650,7 +654,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled member-id: "
- << static_cast<sal_uInt16>(nMemberID)
+ << o3tl::narrowing<sal_uInt16>(nMemberID)
<< " (which-id: " << nWID << ")");
break;
}
@@ -674,7 +678,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled member-id: "
- << static_cast<sal_uInt16>(nMemberID)
+ << o3tl::narrowing<sal_uInt16>(nMemberID)
<< " (which-id: " << nWID << ")");
break;
}
@@ -714,7 +718,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled member-id: "
- << static_cast<sal_uInt16>(nMemberID)
+ << o3tl::narrowing<sal_uInt16>(nMemberID)
<< " (which-id: " << nWID << ")");
break;
}
@@ -743,7 +747,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled member-id: "
- << static_cast<sal_uInt16>(nMemberID)
+ << o3tl::narrowing<sal_uInt16>(nMemberID)
<< " (which-id: " << nWID << ")");
break;
}
@@ -768,7 +772,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled member-id: "
- << static_cast<sal_uInt16>(nMemberID)
+ << o3tl::narrowing<sal_uInt16>(nMemberID)
<< " (which-id: " << nWID << ")");
break;
}
@@ -787,15 +791,15 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled member-id: "
- << static_cast<sal_uInt16>(nMemberID)
+ << o3tl::narrowing<sal_uInt16>(nMemberID)
<< " (which-id: " << nWID << ")");
break;
}
break;
default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled which-id: "
- << nWID << " (member-id: " << static_cast<sal_uInt16>(nMemberID)
- << ")");
+ << nWID << " (member-id: "
+ << o3tl::narrowing<sal_uInt16>(nMemberID) << ")");
break;
}
@@ -1016,16 +1020,8 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
if (aTextBoxSet.Count())
pFormat->GetDoc()->SetFlyFrameAttr(*pFormat, aTextBoxSet);
-}
-SwFrameFormat* SwTextBoxHelper::getShapeFormat(uno::Reference<drawing::XShape> xShape)
-{
- if (xShape)
- if (auto pShape = dynamic_cast<SwXShape*>(xShape.get()))
- if (SwFrameFormat* pFormat = pShape->GetFrameFormat())
- return pFormat;
- SAL_WARN("sw.core", "SwTextBoxHelper::getShapeFormat: No Shape Format!");
- return nullptr;
+ DoTextBoxZOrderCorrection(&rShape);
}
void SwTextBoxHelper::updateTextBoxMargin(SdrObject* pObj)
@@ -1075,6 +1071,7 @@ bool SwTextBoxHelper::setWrapThrough(SwFrameFormat* pShape)
{
if (auto pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT))
{
+ ::sw::UndoGuard const UndoGuard(pShape->GetDoc()->GetIDocumentUndoRedo());
if (auto xFrame = SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat))
try
{
@@ -1119,6 +1116,7 @@ bool SwTextBoxHelper::changeAnchor(SwFrameFormat* pShape)
{
try
{
+ ::sw::UndoGuard const UndoGuard(pShape->GetDoc()->GetIDocumentUndoRedo());
uno::Reference<beans::XPropertySet> const xPropertySet(
SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat),
uno::UNO_QUERY);
@@ -1185,7 +1183,7 @@ bool SwTextBoxHelper::changeAnchor(SwFrameFormat* pShape)
}
}
- return doTextBoxPositioning(pShape);
+ return doTextBoxPositioning(pShape) && DoTextBoxZOrderCorrection(pShape);
}
}
return false;
@@ -1197,6 +1195,7 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape)
{
if (auto pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT))
{
+ ::sw::UndoGuard const UndoGuard(pShape->GetDoc()->GetIDocumentUndoRedo());
if (pShape->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
{
tools::Rectangle aRect(getTextRectangle(pShape, false));
@@ -1259,19 +1258,68 @@ std::optional<bool> SwTextBoxHelper::isAnchorTypeDifferent(SwFrameFormat* pShape
bool SwTextBoxHelper::isTextBoxShapeHasValidTextFrame(SwFrameFormat* pShape)
{
- OUString sErrMsg;
if (pShape && pShape->Which() == RES_DRAWFRMFMT)
if (auto pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT))
if (pFormat && pFormat->Which() == RES_FLYFRMFMT)
return true;
else
- sErrMsg = "Shape do not have valid textframe!";
+ SAL_WARN("sw.core", "SwTextBoxHelper::isTextBoxShapeHasValidTextFrame: "
+ "Shape does not have valid textframe!");
else
- sErrMsg = "Shape do not have associated frame!";
+ SAL_WARN("sw.core", "SwTextBoxHelper::isTextBoxShapeHasValidTextFrame: "
+ "Shape does not have associated frame!");
else
- sErrMsg = "Not valid shape!";
+ SAL_WARN("sw.core", "SwTextBoxHelper::isTextBoxShapeHasValidTextFrame: Not valid shape!");
+ return false;
+}
+
+bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape)
+{
+ if (isTextBoxShapeHasValidTextFrame(pShape))
+ {
+ if (SdrObject* pShpObj = pShape->FindRealSdrObject())
+ {
+ if (SdrObject* pFrmObj
+ = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT)->FindRealSdrObject())
+ {
+ // Get the draw model from the doc
+ SwDrawModel* pDrawModel
+ = pShape->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
+ if (pDrawModel)
+ {
+ // Not really sure this will work all page, but it seems it will.
+ auto pPage = pDrawModel->GetPage(0);
+ // Recalc all Zorders
+ pPage->RecalcObjOrdNums();
+ // If the shape is behind the frame, is good, but if there are some objects
+ // between of them that is wrong so put the frame exactly one level higher
+ // than the shape.
+ if (pFrmObj->GetOrdNum() > pShpObj->GetOrdNum())
+ pPage->SetObjectOrdNum(pFrmObj->GetOrdNum(), pShpObj->GetOrdNum() + 1);
+ else
+ // Else, if the frame is behind the shape, bring to the front of it.
+ while (pFrmObj->GetOrdNum() <= pShpObj->GetOrdNum())
+ {
+ pPage->SetObjectOrdNum(pFrmObj->GetOrdNum(), pFrmObj->GetOrdNum() + 1);
+ // If there is any problem with the indexes, do not run over the infinity
+ if (pPage->GetObjCount() == pFrmObj->GetOrdNum())
+ break;
+ }
+ pPage->RecalcObjOrdNums();
+ return true; // Success
+ }
+ SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+ "No Valid Draw model for SdrObject for the shape!");
+ }
+ SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+ "No Valid SdrObject for the frame!");
+ }
+ SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+ "No Valid SdrObject for the shape!");
+ }
+ SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+ "No Valid TextFrame!");
- SAL_WARN("sw.core", "SwTextBoxHelper::isTextBoxShapeHasValidTextFrame: " << sErrMsg);
return false;
}
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 389923d6f415..a17ce9b3e041 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -362,7 +362,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTableOpts,
if( GetIDocumentUndoRedo().DoesUndo() )
{
GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoInsTable>( rPos, nCols, nRows, static_cast<sal_uInt16>(eAdjust),
+ std::make_unique<SwUndoInsTable>( rPos, nCols, nRows, o3tl::narrowing<sal_uInt16>(eAdjust),
rInsTableOpts, pTAFormat, pColArr,
aTableName));
}
@@ -651,7 +651,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
{
GetIDocumentUndoRedo().StartUndo( SwUndoId::TEXTTOTABLE, nullptr );
pUndo = new SwUndoTextToTable( aOriginal, rInsTableOpts, cCh,
- static_cast<sal_uInt16>(eAdjust), pTAFormat );
+ o3tl::narrowing<sal_uInt16>(eAdjust), pTAFormat );
GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
// Do not add splitting the TextNode to the Undo history
@@ -759,14 +759,14 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
{
sal_uInt8 nBoxArrLen = pTAFormat ? 16 : 4;
std::unique_ptr< DfltBoxAttrList_t > aBoxFormatArr1;
- std::unique_ptr< std::vector<SwTableBoxFormat*> > aBoxFormatArr2;
+ std::optional< std::vector<SwTableBoxFormat*> > aBoxFormatArr2;
if( bUseBoxFormat )
{
aBoxFormatArr1.reset(new DfltBoxAttrList_t( nBoxArrLen, nullptr ));
}
else
{
- aBoxFormatArr2.reset(new std::vector<SwTableBoxFormat*>( nBoxArrLen, nullptr ));
+ aBoxFormatArr2 = std::vector<SwTableBoxFormat*>( nBoxArrLen, nullptr );
}
SfxItemSet aCharSet( GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1>{} );
@@ -1041,13 +1041,13 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
{
// sw_redlinehide: no idea if this makes any sense...
TextFrameIndex const nPos(aFInfo.GetFrame()->MapModelToView(pTextNd, nChPos));
- aPosArr.push_back( static_cast<sal_uInt16>(
+ aPosArr.push_back( o3tl::narrowing<sal_uInt16>(
aFInfo.GetCharPos(nPos+TextFrameIndex(1), false)) );
}
}
aPosArr.push_back(
- static_cast<sal_uInt16>(aFInfo.GetFrame()->IsVertical() ?
+ o3tl::narrowing<sal_uInt16>(aFInfo.GetFrame()->IsVertical() ?
aFInfo.GetFrame()->getFramePrintArea().Bottom() :
aFInfo.GetFrame()->getFramePrintArea().Right()) );
@@ -2921,7 +2921,7 @@ void SwCollectTableLineBoxes::AddBox( const SwTableBox& rBox )
m_aPositionArr.push_back(m_nWidth);
SwTableBox* p = const_cast<SwTableBox*>(&rBox);
m_Boxes.push_back(p);
- m_nWidth = m_nWidth + static_cast<sal_uInt16>(rBox.GetFrameFormat()->GetFrameSize().GetWidth());
+ m_nWidth = m_nWidth + o3tl::narrowing<sal_uInt16>(rBox.GetFrameFormat()->GetFrameSize().GetWidth());
}
const SwTableBox* SwCollectTableLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
@@ -2944,7 +2944,7 @@ const SwTableBox* SwCollectTableLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
if( n >= m_aPositionArr.size() )
--n;
- m_nWidth = m_nWidth + static_cast<sal_uInt16>(rBox.GetFrameFormat()->GetFrameSize().GetWidth());
+ m_nWidth = m_nWidth + o3tl::narrowing<sal_uInt16>(rBox.GetFrameFormat()->GetFrameSize().GetWidth());
pRet = m_Boxes[ n ];
}
return pRet;
@@ -3051,15 +3051,11 @@ void sw_BoxSetSplitBoxFormats( SwTableBox* pBox, SwCollectTableLineBoxes* pSplPa
}
else
{
- sal_uInt16 const aTableSplitBoxSetRange[] {
- RES_LR_SPACE, RES_UL_SPACE,
- RES_BACKGROUND, RES_SHADOW,
- RES_PROTECT, RES_PROTECT,
- RES_VERT_ORIENT, RES_VERT_ORIENT,
- 0 };
-
SfxItemSet aTmpSet( pFormat->GetDoc()->GetAttrPool(),
- aTableSplitBoxSetRange );
+ svl::Items<RES_LR_SPACE, RES_UL_SPACE,
+ RES_PROTECT, RES_PROTECT,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ RES_BACKGROUND, RES_SHADOW>{} );
aTmpSet.Put( pFormat->GetAttrSet() );
if( aTmpSet.Count() )
pBox->ClaimFrameFormat()->SetFormatAttr( aTmpSet );
@@ -3097,16 +3093,16 @@ void sw_BoxSetSplitBoxFormats( SwTableBox* pBox, SwCollectTableLineBoxes* pSplPa
* Boxes' Max; but only if Size is using absolute
* values (USHRT_MAX)
*/
-bool SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnMode,
+void SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnMode,
bool bCalcNewSize )
{
SwNode* pNd = &rPos.nNode.GetNode();
SwTableNode* pTNd = pNd->FindTableNode();
if( !pTNd || pNd->IsTableNode() )
- return false;
+ return;
if( dynamic_cast<const SwDDETable*>( &pTNd->GetTable() ) != nullptr)
- return false;
+ return;
SwTable& rTable = pTNd->GetTable();
rTable.SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>()); // Delete HTML Layout
@@ -3235,8 +3231,6 @@ bool SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnM
GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pNew);
getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
-
- return nullptr != pNew;
}
static bool lcl_ChgTableSize( SwTable& rTable )
@@ -3973,7 +3967,7 @@ SwTableFormat* SwDoc::FindTableFormatByName( std::u16string_view rName, bool bAl
return const_cast<SwTableFormat*>(static_cast<const SwTableFormat*>(pRet));
}
-bool SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
+void SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
SwTwips nAbsDiff, SwTwips nRelDiff )
{
SwTableNode* pTableNd = const_cast<SwTableNode*>(rCurrentBox.GetSttNd()->FindTableNode());
@@ -4017,7 +4011,6 @@ bool SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightTy
{
getIDocumentState().SetModified();
}
- return bRet;
}
bool SwDoc::IsNumberFormat( const OUString& rString, sal_uInt32& F_Index, double& fOutNumber )
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 6d2a677712be..3df6b3272cee 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -536,6 +536,32 @@ bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::unique_ptr<SvxBrushI
return bRet;
}
+void SwDoc::SetRowNotTracked( const SwCursor& rCursor, const SvxPrintItem &rNew )
+{
+ SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ if( !pTableNd )
+ return;
+
+ std::vector<SwTableLine*> aRowArr; // For Lines collecting
+ ::lcl_CollectLines( aRowArr, rCursor, true );
+
+ if( aRowArr.empty() )
+ return;
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoAttrTable>(*pTableNd));
+ }
+
+ std::vector<std::unique_ptr<SwTableFormatCmp>> aFormatCmp;
+ aFormatCmp.reserve( std::max( 255, static_cast<int>(aRowArr.size()) ) );
+
+ for( auto pLn : aRowArr )
+ ::lcl_ProcessRowAttr( aFormatCmp, pLn, rNew );
+
+ getIDocumentState().SetModified();
+}
+
static void InsertCell( std::vector<SwCellFrame*>& rCellArr, SwCellFrame* pCellFrame )
{
if( rCellArr.end() == std::find( rCellArr.begin(), rCellArr.end(), pCellFrame ) )
@@ -1277,7 +1303,7 @@ sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor )
const SwFormatVertOrient &rOri =
aBoxes[i]->GetFrameFormat()->GetVertOrient();
if( USHRT_MAX == nAlign )
- nAlign = static_cast<sal_uInt16>(rOri.GetVertOrient());
+ nAlign = o3tl::narrowing<sal_uInt16>(rOri.GetVertOrient());
else if( rOri.GetVertOrient() != nAlign )
{
nAlign = USHRT_MAX;
@@ -1313,7 +1339,7 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrame *pCell )
// To compensate for the accuracy of calculation later on in SwTable::SetTabCols
// we keep adding up a little.
nRet += COLFUZZY;
- return static_cast<sal_uInt16>(std::max( SwTwips(MINLAY), nRet ));
+ return o3tl::narrowing<sal_uInt16>(std::max( SwTwips(MINLAY), nRet ));
}
/* The Line is within the Selection but not outlined by the TabCols.
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 809ecd349c81..4f7b18ba3a68 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -347,7 +347,7 @@ SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNdType )
SwNode::~SwNode()
{
- assert(!m_pAnchoredFlys || GetDoc().IsInDtor()); // must all be deleted
+ assert(m_aAnchoredFlys.empty() || GetDoc().IsInDtor()); // must all be deleted
InvalidateInSwCache(RES_OBJECTDYING);
assert(!IsInCache());
}
@@ -2119,11 +2119,7 @@ void SwNode::AddAnchoredFly(SwFrameFormat *const pFlyFormat)
assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
// check node type, cf. SwFormatAnchor::SetAnchor()
assert(IsTextNode() || IsStartNode() || IsTableNode());
- if (!m_pAnchoredFlys)
- {
- m_pAnchoredFlys.reset(new std::vector<SwFrameFormat*>);
- }
- m_pAnchoredFlys->push_back(pFlyFormat);
+ m_aAnchoredFlys.push_back(pFlyFormat);
}
void SwNode::RemoveAnchoredFly(SwFrameFormat *const pFlyFormat)
@@ -2132,14 +2128,9 @@ void SwNode::RemoveAnchoredFly(SwFrameFormat *const pFlyFormat)
// cannot assert this in Remove because it is called when new anchor is already set
// assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
assert(IsTextNode() || IsStartNode() || IsTableNode());
- assert(m_pAnchoredFlys);
- auto it(std::find(m_pAnchoredFlys->begin(), m_pAnchoredFlys->end(), pFlyFormat));
- assert(it != m_pAnchoredFlys->end());
- m_pAnchoredFlys->erase(it);
- if (m_pAnchoredFlys->empty())
- {
- m_pAnchoredFlys.reset();
- }
+ auto it(std::find(m_aAnchoredFlys.begin(), m_aAnchoredFlys.end(), pFlyFormat));
+ assert(it != m_aAnchoredFlys.end());
+ m_aAnchoredFlys.erase(it);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index c65afd1e5749..9d300621da0e 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -947,7 +947,7 @@ void SwSectionFormat::UpdateParent()
if(bIsHidden == pSection->IsHiddenFlag())
{
- SwMsgPoolItem aMsgItem(static_cast<sal_uInt16>(bIsHidden
+ SwMsgPoolItem aMsgItem(o3tl::narrowing<sal_uInt16>(bIsHidden
? RES_SECTION_HIDDEN
: RES_SECTION_NOT_HIDDEN));
CallSwClientNotify(sw::LegacyModifyHint(&aMsgItem, &aMsgItem));
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 9ae68e2a05ef..1f0632850ad2 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -897,7 +897,7 @@ SdrObject* SwDrawContact::GetDrawObjectByAnchorFrame( const SwFrame& _rAnchorFra
return pRetDrawObj;
}
-void SwDrawContact::NotifyBackgrdOfAllVirtObjs(const tools::Rectangle* pOldBoundRect)
+void SwDrawContact::NotifyBackgroundOfAllVirtObjs(const tools::Rectangle* pOldBoundRect)
{
for(const auto& rpDrawVirtObj : maDrawVirtObjs)
{
@@ -1127,7 +1127,7 @@ void SwDrawContact::Changed_( const SdrObject& rObj,
lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
// --> #i36181# - background of 'virtual'
// drawing objects have also been notified.
- NotifyBackgrdOfAllVirtObjs( pOldBoundRect );
+ NotifyBackgroundOfAllVirtObjs( pOldBoundRect );
}
DisconnectFromLayout( false );
mbMasterObjCleared = true;
@@ -1237,7 +1237,7 @@ void SwDrawContact::Changed_( const SdrObject& rObj,
SwFrameFormat::tLayoutDir eLayoutDir =
pAnchoredDrawObj->GetFrameFormat().GetLayoutDir();
// use geometry of drawing object
- SwRect aObjRect( rObj.GetSnapRect() );
+ tools::Rectangle aObjRect( rObj.GetSnapRect() );
// If drawing object is a member of a group, the adjustment
// of the positioning and the alignment attributes has to
// be done for the top group object.
@@ -1311,9 +1311,9 @@ void SwDrawContact::Changed_( const SdrObject& rObj,
// #i34748# - use new method
// <SwAnchoredDrawObject::SetLastObjRect(..)>.
const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
- ->SetLastObjRect( aObjRect.SVRect() );
+ ->SetLastObjRect( aObjRect );
}
- else if ( aObjRect.SSize() != aOldObjRect.GetSize() )
+ else if ( aObjRect.GetSize() != aOldObjRect.GetSize() )
{
InvalidateObjs_();
// #i35007# - notify anchor frame
@@ -1426,7 +1426,7 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
ConnectToLayout(pNewAnchorFormat);
// notify background of drawing objects
lcl_NotifyBackgroundOfObj(*this, *GetMaster(), pOldRect);
- NotifyBackgrdOfAllVirtObjs(pOldRect);
+ NotifyBackgroundOfAllVirtObjs(pOldRect);
const SwFormatAnchor* pOldAnchorFormat = pLegacyHint->m_pOld ? lcl_getAnchorFormat(*pLegacyHint->m_pOld) : nullptr;
if(!pOldAnchorFormat || (pOldAnchorFormat->GetAnchorId() != pNewAnchorFormat->GetAnchorId()))
@@ -1482,7 +1482,7 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
assert(!"<SwDraw Contact::Modify(..)> - unhandled attribute?");
}
lcl_NotifyBackgroundOfObj(*this, *GetMaster(), nullptr);
- NotifyBackgrdOfAllVirtObjs(nullptr);
+ NotifyBackgroundOfAllVirtObjs(nullptr);
InvalidateObjs_(bUpdateSortedObjsList);
}
@@ -1651,7 +1651,7 @@ void SwDrawContact::DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer )
{
const tools::Rectangle aOldRect( maAnchoredDrawObj.GetObjRectWithSpaces().SVRect() );
lcl_NotifyBackgroundOfObj( *this, *GetMaster(), &aOldRect );
- NotifyBackgrdOfAllVirtObjs( &aOldRect );
+ NotifyBackgroundOfAllVirtObjs( &aOldRect );
}
// remove 'virtual' drawing objects from writer
@@ -1990,7 +1990,7 @@ void SwDrawContact::ChkPage()
SwPageFrame* pPg = ( maAnchoredDrawObj.GetAnchorFrame() &&
maAnchoredDrawObj.GetAnchorFrame()->IsPageFrame() )
? GetPageFrame()
- : FindPage( GetMaster()->GetCurrentBoundRect() );
+ : FindPage( SwRect(GetMaster()->GetCurrentBoundRect()) );
if ( GetPageFrame() == pPg )
return;
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 93a66ba6b625..41cea972ee05 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -1112,7 +1112,7 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
// need to save aOutRect to FrameArea, will be restored to aOutRect in
// SwVirtFlyDrawObj::NbcMove currently for TransformableSwFrames
SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*GetFlyFrame());
- aFrm.setSwRect(m_aOutRect);
+ aFrm.setSwRect(SwRect(m_aOutRect));
}
// keep old hack - not clear what happens here
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index dfa884e80db5..b2ad0f39c14e 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -243,8 +243,10 @@ void SwDrawView::AddCustomHdl()
}
// add anchor handle:
- maHdlList.AddHdl( std::make_unique<SwSdrHdl>( aPos, ( pAnch->IsVertical() && !pAnch->IsVertLR() ) ||
- pAnch->IsRightToLeft() ) );
+ std::unique_ptr<SdrHdl> hdl = std::make_unique<SwSdrHdl>( aPos, ( pAnch->IsVertical() && !pAnch->IsVertLR() ) ||
+ pAnch->IsRightToLeft() );
+ hdl->SetObjHdlNum(maHdlList.GetHdlCount());
+ maHdlList.AddHdl(std::move(hdl));
}
SdrObject* SwDrawView::GetMaxToTopObj( SdrObject* pObj ) const
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 637f507734a4..12df8e7383e9 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -345,11 +345,8 @@ bool SwAutoFormat::HasObjects(const SwTextFrame & rFrame)
SwNodeIndex node(*rFrame.GetTextNodeFirst());
do
{
- if (node.GetNode().GetAnchoredFlys() != nullptr)
- {
- assert(!node.GetNode().GetAnchoredFlys()->empty());
+ if (!node.GetNode().GetAnchoredFlys().empty())
return true;
- }
++node;
}
while (sw::FrameContainsNode(rFrame, node.GetIndex()));
@@ -639,7 +636,7 @@ bool SwAutoFormat::DoTable()
case '+':
case '|':
- aPosArr.push_back( static_cast<sal_uInt16>(aInfo.GetCharPos(n)) );
+ aPosArr.push_back( o3tl::narrowing<sal_uInt16>(aInfo.GetCharPos(n)) );
break;
default:
@@ -665,7 +662,7 @@ bool SwAutoFormat::DoTable()
{
eHori = text::HoriOrientation::NONE;
// then - as last - we need to add the current frame width into the array
- aPosArr.push_back( static_cast<sal_uInt16>(m_pCurTextFrame->getFrameArea().Width()) );
+ aPosArr.push_back( o3tl::narrowing<sal_uInt16>(m_pCurTextFrame->getFrameArea().Width()) );
}
else
eHori = text::HoriOrientation::LEFT;
@@ -908,7 +905,7 @@ CHECK_ROMAN_1:
if( nMod5 == ((3 * nVal) + n10 ) ||
nMod5 == ((4 * nVal) + n10 ) ||
nLast == n10 )
- nStart = static_cast<sal_uInt16>(nStart + (n10 * 8));
+ nStart = o3tl::narrowing<sal_uInt16>(nStart + (n10 * 8));
else if( nMod5 == 0 ||
nMod5 == (1 * nVal) ||
nMod5 == (2 * nVal) )
@@ -927,7 +924,7 @@ CHECK_ROMAN_5:
int nMod = nStart % nVal;
int n10 = nVal / 5;
if( n10 == nMod )
- nStart = static_cast<sal_uInt16>(nStart + (3 * n10));
+ nStart = o3tl::narrowing<sal_uInt16>(nStart + (3 * n10));
else if( 0 == nMod )
nStart = nStart + nVal;
else
@@ -1590,7 +1587,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
else
{
bChgBullet = true;
- SetColl( static_cast<sal_uInt16>(RES_POOLCOLL_BULLET_LEVEL1 + ( std::min( nLvl, cnNumBullColls ) * 4 )) );
+ SetColl( o3tl::narrowing<sal_uInt16>(RES_POOLCOLL_BULLET_LEVEL1 + ( std::min( nLvl, cnNumBullColls ) * 4 )) );
}
}
else
@@ -1627,7 +1624,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
{
SwNumFormat aFormat( aRule.Get( nLvl ) );
aFormat.SetPrefix( aPrefix.getToken( 0, u'\x0001', nPrefixIdx ));
- aFormat.SetStart( static_cast<sal_uInt16>(aPrefix.getToken( 0, u'\x0001', nPrefixIdx ).toInt32()));
+ aFormat.SetStart( o3tl::narrowing<sal_uInt16>(aPrefix.getToken( 0, u'\x0001', nPrefixIdx ).toInt32()));
aFormat.SetSuffix( aPostfix.getToken( 0, u'\x0001' ));
aFormat.SetIncludeUpperLevels( 0 );
@@ -1652,7 +1649,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
if( !n )
aFormat.SetPrefix( aPrefix.getToken( 0, u'\x0001', nPrefixIdx )); // token 0, read only on first loop
- aFormat.SetStart( static_cast<sal_uInt16>(aPrefix.getToken( 0, u'\x0001', nPrefixIdx ).toInt32() ));
+ aFormat.SetStart( o3tl::narrowing<sal_uInt16>(aPrefix.getToken( 0, u'\x0001', nPrefixIdx ).toInt32() ));
aFormat.SetSuffix( aPostfix.getToken( 0, u'\x0001', nPostfixIdx ));
aFormat.SetIncludeUpperLevels( MAXLEVEL );
if( n < aNumTypes.getLength() )
@@ -1687,7 +1684,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
}
}
else if( !m_aFlags.bAFormatByInput )
- SetColl( static_cast<sal_uInt16>(RES_POOLCOLL_NUM_LEVEL1 + ( std::min( nLvl, cnNumBullColls ) * 4 ) ));
+ SetColl( o3tl::narrowing<sal_uInt16>(RES_POOLCOLL_NUM_LEVEL1 + ( std::min( nLvl, cnNumBullColls ) * 4 ) ));
else
bChgEnum = false;
}
@@ -1811,7 +1808,7 @@ void SwAutoFormat::BuildNegIndent( SwTwips nSpaces )
|| (!nTextPos && IsBlanksInString(*m_pCurTextFrame))
|| IsSentenceAtEnd(*m_pCurTextFrame);
- SetColl( static_cast<sal_uInt16>( nTextPos
+ SetColl( o3tl::narrowing<sal_uInt16>( nTextPos
? RES_POOLCOLL_CONFRONTATION
: RES_POOLCOLL_TEXT_NEGIDENT ) );
@@ -1889,7 +1886,7 @@ void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl )
m_pDoc->GetDocumentRedlineManager().SetAutoFormatRedlineComment( &sText );
}
- SetColl( static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + nLvl ), true );
+ SetColl( o3tl::narrowing<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + nLvl ), true );
if( m_aFlags.bAFormatByInput )
{
SwTextFormatColl& rNxtColl = m_pCurTextFrame->GetTextNodeForParaProps()->GetTextColl()->GetNextTextFormatColl();
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index dc8769f2a61a..6ab5a3ae9ad8 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -93,7 +93,7 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
nListLevel = MAXLEVEL - 1;
const OUString & aCharFormatName =
- pNumRule->Get(static_cast<sal_uInt16>(nListLevel)).GetCharFormatName();
+ pNumRule->Get(o3tl::narrowing<sal_uInt16>(nListLevel)).GetCharFormatName();
SwCharFormat * pCharFormat =
GetDoc()->FindCharFormatByName(aCharFormatName);
@@ -185,7 +185,7 @@ void SwEditShell::GetCurParAttr( SfxItemSet& rSet) const
GetPaMParAttr( GetCursor(), rSet );
}
-bool SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const
+void SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const
{
// number of nodes the function has explored so far
sal_uInt16 numberOfLookup = 0;
@@ -236,11 +236,9 @@ bool SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const
// if the maximum number of node that can be inspected has been reached
if (numberOfLookup >= getMaxLookup())
- return false;
+ return;
}
}
-
- return true;
}
SwTextFormatColl* SwEditShell::GetCurTextFormatColl( ) const
@@ -504,7 +502,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
bool bRet = true;
const SvxTabStopItem& rTabItem = GetDoc()->GetDefault( RES_PARATR_TABSTOP );
- sal_uInt16 nDefDist = static_cast<sal_uInt16>(rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134);
+ sal_uInt16 nDefDist = o3tl::narrowing<sal_uInt16>(rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134);
if( !nDefDist )
return false;
@@ -533,10 +531,10 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
SwFrame* pFrame = pCNd->getLayoutFrame( GetLayout() );
if ( pFrame )
{
- const sal_uInt16 nFrameWidth = static_cast<sal_uInt16>( pFrame->IsVertical() ?
+ const sal_uInt32 nFrameWidth = o3tl::narrowing<sal_uInt32>( pFrame->IsVertical() ?
pFrame->getFrameArea().Height() :
pFrame->getFrameArea().Width() );
- bRet = nFrameWidth > ( nNext + MM50 );
+ bRet = o3tl::narrowing<SwTwips>(nFrameWidth) > ( nNext + MM50 );
}
else
bRet = false;
@@ -614,7 +612,7 @@ static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout,
if (nListLevel >= MAXLEVEL)
nListLevel = MAXLEVEL - 1;
- const SwNumFormat &rNumFormat = pNumRule->Get( static_cast<sal_uInt16>(nListLevel) );
+ const SwNumFormat &rNumFormat = pNumRule->Get( o3tl::narrowing<sal_uInt16>(nListLevel) );
if( SVX_NUM_BITMAP != rNumFormat.GetNumberingType() )
{
if ( SVX_NUM_CHAR_SPECIAL == rNumFormat.GetNumberingType() )
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 837f37b94e20..b6bb9055f23d 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -46,7 +46,7 @@ size_t SwEditShell::GetFieldTypeCount(SwFieldIds nResId ) const
if(nResId == SwFieldIds::Unknown)
{
- return static_cast<sal_uInt16>(pFieldTypes->size());
+ return o3tl::narrowing<sal_uInt16>(pFieldTypes->size());
}
// all types with the same ResId
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 9be63fb05251..eea6cd397b86 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -812,7 +812,7 @@ void SwEditShell::SetNumberingRestart()
nListLevel = MAXLEVEL - 1;
bIsNodeNum = pTextNd->GetNum()->GetNumber() ==
- pNumRule->Get( static_cast<sal_uInt16>(nListLevel) ).GetStart();
+ pNumRule->Get( o3tl::narrowing<sal_uInt16>(nListLevel) ).GetStart();
}
if (bIsNodeNum)
{
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index af7ec8178e41..cd4458c276dd 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -900,7 +900,7 @@ sal_uInt16 SwEditShell::GetNodeNumStart( SwPaM* pPaM ) const
// return USHRT_MAX, if no list restart value is found.
if ( pTextNd && pTextNd->HasAttrListRestartValue() )
{
- return static_cast<sal_uInt16>(pTextNd->GetAttrListRestartValue());
+ return o3tl::narrowing<sal_uInt16>(pTextNd->GetAttrListRestartValue());
}
return USHRT_MAX;
}
diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx
index b93c30d8f8f4..cb849d8f6230 100644
--- a/sw/source/core/fields/dbfld.cxx
+++ b/sw/source/core/fields/dbfld.cxx
@@ -665,7 +665,7 @@ void SwDBNumSetField::Evaluate(const SwDoc& rDoc)
if( m_bCondValid && pMgr && pMgr->IsInMerge() &&
pMgr->IsDataSourceOpen(aTmpData.sDataSource, aTmpData.sCommand, true))
{ // condition OK -> adjust current Set
- pMgr->ToRecordId(std::max(static_cast<sal_uInt16>(m_aPar2.toInt32()), sal_uInt16(1))-1);
+ pMgr->ToRecordId(std::max(o3tl::narrowing<sal_uInt16>(m_aPar2.toInt32()), sal_uInt16(1))-1);
}
}
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 1be2200fae3b..f4b959014575 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -175,7 +175,7 @@ SwDDEFieldType* SwDDETable::GetDDEFieldType()
return m_pDDEType;
}
-bool SwDDETable::NoDDETable()
+void SwDDETable::NoDDETable()
{
// search table node
OSL_ENSURE( GetFrameFormat(), "No FrameFormat" );
@@ -183,11 +183,11 @@ bool SwDDETable::NoDDETable()
// Is this the correct NodesArray? (because of UNDO)
if( m_aLines.empty() )
- return false;
+ return;
OSL_ENSURE( !GetTabSortBoxes().empty(), "Table without content?" );
SwNode* pNd = const_cast<SwNode*>(static_cast<SwNode const *>(GetTabSortBoxes()[0]->GetSttNd()));
if( !pNd->GetNodes().IsDocNodes() )
- return false;
+ return;
SwTableNode* pTableNd = pNd->FindTableNode();
OSL_ENSURE( pTableNd, "Where is the table?");
@@ -206,8 +206,6 @@ bool SwDDETable::NoDDETable()
m_pDDEType->DecRefCnt();
pTableNd->SetNewTable( std::move(pNewTable) ); // replace table
-
- return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index ceea88941ddb..8b6917094f89 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -472,7 +472,7 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
break;
case FIELD_PROP_USHORT1:
rAny >>= nTmp;
- m_nSubType = static_cast<sal_uInt16>(nTmp);
+ m_nSubType = o3tl::narrowing<sal_uInt16>(nTmp);
break;
case FIELD_PROP_PAR1:
{
@@ -484,7 +484,7 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
case FIELD_PROP_SUBTYPE:
nTmp = lcl_APIToSubType(rAny);
if( nTmp >=0 )
- SetSubType( static_cast<sal_uInt16>((GetSubType() & 0xff00) | nTmp));
+ SetSubType( o3tl::narrowing<sal_uInt16>((GetSubType() & 0xff00) | nTmp));
break;
case FIELD_PROP_BOOL2:
if(*o3tl::doAccess<bool>(rAny))
@@ -697,7 +697,7 @@ void SwSetExpFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
{
sal_Int32 nSet = lcl_APIToSubType(rAny);
if(nSet >=0)
- SetType(static_cast<sal_uInt16>(nSet));
+ SetType(o3tl::narrowing<sal_uInt16>(nSet));
}
break;
case FIELD_PROP_PAR2:
@@ -985,13 +985,13 @@ sal_Int32 SwGetExpField::GetReferenceTextPos( const SwFormatField& rFormat, SwDo
static const sal_uInt16 nIds[] =
{
- RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
RES_CHRATR_FONT, RES_CHRATR_FONT,
- RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
- RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT,
- 0, 0
+ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ 0
};
SwAttrSet aSet(rDoc.GetAttrPool(), nIds);
rTextNode.GetParaAttr(aSet, nRet, nRet+1);
@@ -1109,7 +1109,7 @@ bool SwSetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
case FIELD_PROP_SUBTYPE:
nTmp32 = lcl_APIToSubType(rAny);
if(nTmp32 >= 0)
- SetSubType(static_cast<sal_uInt16>((GetSubType() & 0xff00) | nTmp32));
+ SetSubType(o3tl::narrowing<sal_uInt16>((GetSubType() & 0xff00) | nTmp32));
break;
case FIELD_PROP_PAR3:
rAny >>= maPText;
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 99fad85445a4..bb6aa4a12654 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1246,7 +1246,7 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf )
GDIMetaFile aMtf;
aMtf.Record( pVirtDev.get() );
- aGrf.Draw( pVirtDev, aPt, aSz );
+ aGrf.Draw(*pVirtDev, aPt, aSz);
aMtf.Stop();
aMtf.SetPrefMapMode( aTmp );
aMtf.SetPrefSize( aSz );
@@ -1264,13 +1264,13 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf )
// Otherwise it could happen that for vector graphics
// many MB's of memory are allocated.
const Size aSz( GetSelectedFlyFrame()->getFramePrintArea().SSize() );
- ScopedVclPtrInstance< VirtualDevice > pVirtDev(*GetWin());
+ ScopedVclPtrInstance< VirtualDevice > pVirtDev(*GetWin()->GetOutDev());
MapMode aTmp( MapUnit::MapTwip );
pVirtDev->SetMapMode( aTmp );
if( pVirtDev->SetOutputSize( aSz ) )
{
- aGrf.Draw( pVirtDev.get(), Point(), aSz );
+ aGrf.Draw(*pVirtDev, Point(), aSz);
rGrf = pVirtDev->GetBitmapEx( Point(), aSz );
}
else
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index db5f4dd33419..18e46f9bce47 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -48,6 +48,8 @@
#include <IDocumentUndoRedo.hxx>
#include <IDocumentState.hxx>
#include <IDocumentLayoutAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
+#include <redline.hxx>
#include <dview.hxx>
#include <dflyobj.hxx>
#include <dcontact.hxx>
@@ -890,6 +892,16 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName,
if( pFrame )
{
+ // add a redline to the anchor point at tracked insertion of picture
+ if ( IsRedlineOn() )
+ {
+ SwPosition aPos(*pFormat->GetAnchor().GetContentAnchor());
+ SwPaM aPaM(aPos.nNode.GetNode(), aPos.nContent.GetIndex(),
+ aPos.nNode.GetNode(), aPos.nContent.GetIndex() + 1);
+ GetDoc()->getIDocumentRedlineAccess().AppendRedline(
+ new SwRangeRedline( RedlineType::Insert, aPaM ), true);
+ }
+
// fdo#36681: Invalidate the content and layout to refresh
// the picture anchoring properly
SwPageFrame* pPageFrame = pFrame->FindPageFrameOfAnchor();
@@ -1276,7 +1288,7 @@ SwRect SwFEShell::GetFlyRect() const
SwRect SwFEShell::GetObjRect() const
{
if( Imp()->HasDrawView() )
- return Imp()->GetDrawView()->GetAllMarkedRect();
+ return SwRect(Imp()->GetDrawView()->GetAllMarkedRect());
else
{
SwRect aRect;
@@ -1618,7 +1630,7 @@ const SwFrameFormat* SwFEShell::GetFormatFromObj( const Point& rPt, SwRect** pRe
else if ( pObj->GetUserCall() ) //not for group objects
pRet = static_cast<SwDrawContact*>(pObj->GetUserCall())->GetFormat();
if(pRet && pRectToFill)
- **pRectToFill = pObj->GetCurrentBoundRect();
+ **pRectToFill = SwRect(pObj->GetCurrentBoundRect());
}
pDView->SetHitTolerancePixel( nOld );
}
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 31c30e3c31ec..9bdd23b856cf 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1056,6 +1056,55 @@ void SwFEShell::SelectionToTop( bool bTop )
else
Imp()->GetDrawView()->MovMarkedToTop();
::lcl_NotifyNeighbours( &rMrkList );
+
+ // Does the selection contain a textbox?
+ for (size_t i = 0; i < rMrkList.GetMarkCount(); i++)
+ if (auto pObj = rMrkList.GetMark(i)->GetMarkedSdrObj())
+ // Get the textbox-shape
+ if (auto pFormat = FindFrameFormat(pObj))
+ {
+ // If it has not textframe skip...
+ if (!SwTextBoxHelper::isTextBoxShapeHasValidTextFrame(pFormat))
+ continue;
+ // If it has a textframe so it is a textbox, get its page
+ if (auto pDrwModel
+ = pFormat->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel())
+ // Not really understood why everything is on page 0...
+ // but it is easier to handle sdrobjects, that's true
+ if (auto pPage = pDrwModel->GetPage(0))
+ {
+ // nShift: it means how many layers the pObj have to be shifted up,
+ // in order not to interfere with other shapes and textboxes.
+ // Situations:
+ // - The next shape has textframe: This shape have to shifted with
+ // two layers.
+ // - The next shape has not got textframe: This shape have to be
+ // shifted only one layer up.
+ // - The next shape is null:
+ // - This shape is already at heaven: Only the textframe have
+ // to be adjusted.
+ sal_uInt32 nShift = 0;
+ // Get the one level higher object (note: can be nullptr!)
+ const auto pNextObj = pPage->SetObjectOrdNum(pObj->GetOrdNum() + 1, pObj->GetOrdNum() + 1);
+ // If there is a higher object (not null)...
+ if (pNextObj)
+ {
+ // One level shift is necessary
+ nShift++;
+ // If this object is a textbox, two level increasing needed
+ // (one for the shape and one for the frame)
+ if (auto pNextFormat = FindFrameFormat(pNextObj))
+ if (SwTextBoxHelper::isTextBox(pNextFormat, RES_DRAWFRMFMT)
+ || SwTextBoxHelper::isTextBox(pNextFormat, RES_FLYFRMFMT))
+ nShift++;
+ }
+ // Set the new z-order.
+ pPage->SetObjectOrdNum(pObj->GetOrdNum(), pObj->GetOrdNum() + nShift);
+ }
+ // The shape is on the right level, correct the layer of the frame
+ SwTextBoxHelper::DoTextBoxZOrderCorrection(pFormat);
+ }
+
GetDoc()->getIDocumentState().SetModified();
EndAllAction();
}
@@ -1076,6 +1125,36 @@ void SwFEShell::SelectionToBottom( bool bBottom )
else
Imp()->GetDrawView()->MovMarkedToBtm();
::lcl_NotifyNeighbours( &rMrkList );
+
+ // If the selection has textbox
+ for(size_t i = 0; i < rMrkList.GetMarkCount(); i++)
+ if (auto pObj = rMrkList.GetMark(i)->GetMarkedSdrObj())
+ // Get the shape of the textbox
+ if (auto pFormat = FindFrameFormat(pObj))
+ {
+ // If the shape has not textframes skip.
+ if (!SwTextBoxHelper::isTextBoxShapeHasValidTextFrame(pFormat))
+ continue;
+ // If has, move the shape to correct level with...
+ if (auto pDrwModel
+ = pFormat->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel())
+ if (auto pPage = pDrwModel->GetPage(0))
+ {
+ const auto pNextObj = pPage->SetObjectOrdNum(pObj->GetOrdNum() - 1, pObj->GetOrdNum() - 1);
+ // If there is a lower object (not null)...
+ if (pNextObj)
+ {
+ // If the lower has no textframe, just do nothing, else move by one lower
+ if (auto pNextFormat = FindFrameFormat(pNextObj))
+ if (SwTextBoxHelper::isTextBox(pNextFormat, RES_DRAWFRMFMT)
+ || SwTextBoxHelper::isTextBox(pNextFormat, RES_FLYFRMFMT))
+ pPage->SetObjectOrdNum(pObj->GetOrdNum(), pObj->GetOrdNum() - 1);
+ }
+ }
+ // And set correct layer for the selected textbox.
+ SwTextBoxHelper::DoTextBoxZOrderCorrection(pFormat);
+ }
+
GetDoc()->getIDocumentState().SetModified();
EndAllAction();
}
@@ -1139,6 +1218,9 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId )
SvxOpaqueItem aOpa( pFormat->GetOpaque() );
aOpa.SetValue( nLayerId == rIDDMA.GetHellId() );
pFormat->SetFormatAttr( aOpa );
+ // If pObj has textframe, put its textframe to the right level
+ if (auto pTextBx = FindFrameFormat(pObj))
+ SwTextBoxHelper::DoTextBoxZOrderCorrection(pTextBx);
}
}
}
@@ -1679,7 +1761,7 @@ bool SwFEShell::GotoObj( bool bNext, GotoObjFlags eType )
{
SelectObj( Point(), 0, const_cast<SdrObject*>(pBest) );
if( !ActionPend() )
- MakeVisible( pBest->GetCurrentBoundRect() );
+ MakeVisible( SwRect(pBest->GetCurrentBoundRect()) );
}
CallChgLnk();
return true;
@@ -2051,12 +2133,6 @@ bool SwFEShell::ImpEndCreate()
GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(bRestore);
}
- Point aRelNullPt;
- if( OBJ_CAPTION == nIdent )
- aRelNullPt = static_cast<SdrCaptionObj&>(rSdrObj).GetTailPos();
- else
- aRelNullPt = rBound.TopLeft();
-
aSet.Put( aAnch );
aSet.Put( SwFormatSurround( css::text::WrapTextMode_THROUGH ) );
// OD 2004-03-30 #i26791# - set horizontal position
@@ -2596,7 +2672,7 @@ void SwFEShell::MakeSelVisible()
Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() )
{
GetCurrFrame(); // just to trigger formatting in case the selected object is not formatted.
- MakeVisible( Imp()->GetDrawView()->GetAllMarkedRect() );
+ MakeVisible( SwRect(Imp()->GetDrawView()->GetAllMarkedRect()) );
}
else
SwCursorShell::MakeSelVisible();
@@ -2744,12 +2820,6 @@ void SwFEShell::CheckUnboundObjects()
pPage = pLast;
OSL_ENSURE( pPage, "Page not found." );
- // Alien identifier should roll into the default,
- // Duplications are possible!!
- sal_uInt16 nIdent =
- Imp()->GetDrawView()->GetCurrentObjInventor() == SdrInventor::Default ?
- Imp()->GetDrawView()->GetCurrentObjIdentifier() : 0xFFFF;
-
SwFormatAnchor aAnch;
{
const SwContentFrame *const pAnch = ::FindAnchor(pPage, aPt, true);
@@ -2767,15 +2837,6 @@ void SwFEShell::CheckUnboundObjects()
SfxItemSet aSet( GetAttrPool(), svl::Items<RES_FRM_SIZE, RES_FRM_SIZE,
RES_SURROUND, RES_ANCHOR>{} );
aSet.Put( aAnch );
-
- Point aRelNullPt;
-
- if( OBJ_CAPTION == nIdent )
- aRelNullPt = static_cast<SdrCaptionObj*>(pObj)->GetTailPos();
- else
- aRelNullPt = rBound.TopLeft();
-
- aSet.Put( aAnch );
aSet.Put( SwFormatSurround( css::text::WrapTextMode_THROUGH ) );
SwFrameFormat* pFormat = getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::DRAW_OBJECT, &aSet );
@@ -3157,7 +3218,7 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect
ImpEndCreate();
}
-/** SwFEShell::GetShapeBackgrd
+/** SwFEShell::GetShapeBackground
method determines background color of the page the selected drawing
object is on and returns this color.
If no color is found, because no drawing object is selected or ...,
@@ -3166,24 +3227,24 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect
@returns an object of class Color
*/
-Color SwFEShell::GetShapeBackgrd() const
+Color SwFEShell::GetShapeBackground() const
{
Color aRetColor;
// check, if a draw view exists
- OSL_ENSURE( Imp()->GetDrawView(), "wrong usage of SwFEShell::GetShapeBackgrd - no draw view!");
+ OSL_ENSURE( Imp()->GetDrawView(), "wrong usage of SwFEShell::GetShapeBackground - no draw view!");
if( Imp()->GetDrawView() )
{
// determine list of selected objects
const SdrMarkList* pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
// check, if exactly one object is selected.
- OSL_ENSURE( pMrkList->GetMarkCount() == 1, "wrong usage of SwFEShell::GetShapeBackgrd - no selected object!");
+ OSL_ENSURE( pMrkList->GetMarkCount() == 1, "wrong usage of SwFEShell::GetShapeBackground - no selected object!");
if ( pMrkList->GetMarkCount() == 1)
{
// get selected object
const SdrObject *pSdrObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
// check, if selected object is a shape (drawing object)
- OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr, "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!");
+ OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr, "wrong usage of SwFEShell::GetShapeBackground - selected object is not a drawing object!");
if ( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr )
{
// determine page frame of the frame the shape is anchored.
@@ -3196,7 +3257,7 @@ Color SwFEShell::GetShapeBackgrd() const
OSL_ENSURE( pPageFrame, "inconsistent model - no page!");
if ( pPageFrame )
{
- aRetColor = pPageFrame->GetDrawBackgrdColor();
+ aRetColor = pPageFrame->GetDrawBackgroundColor();
}
}
}
@@ -3219,19 +3280,19 @@ bool SwFEShell::IsShapeDefaultHoriTextDirR2L() const
bool bRet = false;
// check, if a draw view exists
- OSL_ENSURE( Imp()->GetDrawView(), "wrong usage of SwFEShell::GetShapeBackgrd - no draw view!");
+ OSL_ENSURE( Imp()->GetDrawView(), "wrong usage of SwFEShell::GetShapeBackground - no draw view!");
if( Imp()->GetDrawView() )
{
// determine list of selected objects
const SdrMarkList* pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
// check, if exactly one object is selected.
- OSL_ENSURE( pMrkList->GetMarkCount() == 1, "wrong usage of SwFEShell::GetShapeBackgrd - no selected object!");
+ OSL_ENSURE( pMrkList->GetMarkCount() == 1, "wrong usage of SwFEShell::GetShapeBackground - no selected object!");
if ( pMrkList->GetMarkCount() == 1)
{
// get selected object
const SdrObject *pSdrObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
// check, if selected object is a shape (drawing object)
- OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr, "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!");
+ OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr, "wrong usage of SwFEShell::GetShapeBackground - selected object is not a drawing object!");
if ( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr )
{
// determine page frame of the frame the shape is anchored.
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 1a44707f43c3..cb8cec705604 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -32,7 +32,9 @@
#include <fmtornt.hxx>
#include <frmatr.hxx>
#include <fesh.hxx>
+#include <wrtsh.hxx>
#include <doc.hxx>
+#include <docsh.hxx>
#include <IDocumentState.hxx>
#include <IDocumentLayoutAccess.hxx>
#include <cntfrm.hxx>
@@ -325,6 +327,34 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
}
CurrShell aCurr( this );
+
+ // tracked deletion: remove only textbox content,
+ // and set IsNoTracked table line property to false
+ if ( GetDoc()->GetDocShell()->IsChangeRecording() )
+ {
+ StartUndo(bCompleteTable ? SwUndoId::UI_TABLE_DELETE : SwUndoId::ROW_DELETE);
+ StartAllAction();
+
+ SvxPrintItem aNotTracked(RES_PRINT, false);
+ GetDoc()->SetRowNotTracked( *getShellCursor( false ), aNotTracked );
+
+ if ( SwWrtShell* pWrtShell = dynamic_cast<SwWrtShell*>(this) )
+ pWrtShell->SelectTableRow();
+
+ SwEditShell* pEditShell = GetDoc()->GetEditShell();
+ SwRedlineTable::size_type nPrev = pEditShell->GetRedlineCount();
+ pEditShell->Delete();
+
+ EndAllActionAndCall();
+ EndUndo(bCompleteTable ? SwUndoId::UI_TABLE_DELETE : SwUndoId::ROW_DELETE);
+
+ // track row deletion only if there were tracked text changes
+ // FIXME redline count can be the same in special cases, e.g. adding a
+ // new tracked deletion with removing an own tracked insertion...
+ if ( nPrev != pEditShell->GetRedlineCount() )
+ return true;
+ }
+
StartAllAction();
// search for boxes via the layout
@@ -534,10 +564,10 @@ void SwFEShell::GetTabCols_(SwTabCols &rToFill, const SwFrame *pBox) const
}
if ( !bDel &&
- m_pColumnCache->pLastCols->GetLeftMin () == static_cast<sal_uInt16>(nLeftMin) &&
- m_pColumnCache->pLastCols->GetLeft () == static_cast<sal_uInt16>(aRectFnSet.GetLeft(pTab->getFramePrintArea())) &&
- m_pColumnCache->pLastCols->GetRight () == static_cast<sal_uInt16>(aRectFnSet.GetRight(pTab->getFramePrintArea()))&&
- m_pColumnCache->pLastCols->GetRightMax() == static_cast<sal_uInt16>(nRightMax) - m_pColumnCache->pLastCols->GetLeftMin() )
+ m_pColumnCache->pLastCols->GetLeftMin () == o3tl::narrowing<sal_uInt16>(nLeftMin) &&
+ m_pColumnCache->pLastCols->GetLeft () == o3tl::narrowing<sal_uInt16>(aRectFnSet.GetLeft(pTab->getFramePrintArea())) &&
+ m_pColumnCache->pLastCols->GetRight () == o3tl::narrowing<sal_uInt16>(aRectFnSet.GetRight(pTab->getFramePrintArea()))&&
+ m_pColumnCache->pLastCols->GetRightMax() == o3tl::narrowing<sal_uInt16>(nRightMax) - m_pColumnCache->pLastCols->GetLeftMin() )
{
if (m_pColumnCache->pLastCellFrame != pBox)
{
@@ -1169,19 +1199,19 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const
return false;
}
-bool SwFEShell::SetTableStyle(const OUString& rStyleName)
+void SwFEShell::SetTableStyle(const OUString& rStyleName)
{
// make sure SwDoc has the style
SwTableAutoFormat *pTableFormat = GetDoc()->GetTableStyles().FindAutoFormat(rStyleName);
if (!pTableFormat)
- return false;
+ return;
SwTableNode *pTableNode = const_cast<SwTableNode*>(IsCursorInTable());
if (!pTableNode)
- return false;
+ return;
// set the name & update
- return UpdateTableStyleFormatting(pTableNode, false, &rStyleName);
+ UpdateTableStyleFormatting(pTableNode, false, &rStyleName);
}
// AutoFormat for the table/table selection
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 067786a6c2a2..e5aae5f1a945 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2364,7 +2364,7 @@ void FndBox_::MakeFrames( SwTable &rTable )
i >= 0 && !pSibling; --i )
{
SwTableLine *pLine = m_pLineBehind ? m_pLineBehind :
- rTable.GetTabLines()[static_cast<sal_uInt16>(i)];
+ rTable.GetTabLines()[o3tl::narrowing<sal_uInt16>(i)];
SwIterator<SwRowFrame,SwFormat> aIter( *pLine->GetFrameFormat() );
pSibling = aIter.First();
while ( pSibling && (
diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx
index 703a06d69d3d..b267a55c19d2 100644
--- a/sw/source/core/graphic/grfatr.cxx
+++ b/sw/source/core/graphic/grfatr.cxx
@@ -332,7 +332,7 @@ bool SwDrawModeGrf::PutValue( const uno::Any& rVal,
sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal );
if(eVal >= 0 && eVal <= sal_uInt16(GraphicDrawMode::Watermark))
{
- SetEnumValue(static_cast<sal_uInt16>(eVal));
+ SetEnumValue(o3tl::narrowing<sal_uInt16>(eVal));
return true;
}
return false;
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 83e8a33a3527..680f142ef1d6 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -775,10 +775,31 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
rGA.SetMirrorFlags( nMirror );
const SwCropGrf& rCrop = rSet.GetCropGrf();
- rGA.SetCrop( convertTwipToMm100( rCrop.GetLeft() ),
- convertTwipToMm100( rCrop.GetTop() ),
- convertTwipToMm100( rCrop.GetRight() ),
- convertTwipToMm100( rCrop.GetBottom() ));
+
+ tools::Long nCropLeft = rCrop.GetLeft();
+ tools::Long nCropTop = rCrop.GetTop();
+ tools::Long nCropRight = rCrop.GetRight();
+ tools::Long nCropBottom = rCrop.GetBottom();
+
+ // take mirroring of crop values into consideration
+ // while cropping a flipped image. otherwise,
+ // cropping will crop the opposite side of the image.
+ if (rGA.GetMirrorFlags() & BmpMirrorFlags::Vertical)
+ {
+ nCropTop = rCrop.GetBottom();
+ nCropBottom = rCrop.GetTop();
+ }
+
+ if (rGA.GetMirrorFlags() & BmpMirrorFlags::Horizontal)
+ {
+ nCropLeft = rCrop.GetRight();
+ nCropRight = rCrop.GetLeft();
+ }
+
+ rGA.SetCrop( convertTwipToMm100( nCropLeft ),
+ convertTwipToMm100( nCropTop ),
+ convertTwipToMm100( nCropRight ),
+ convertTwipToMm100( nCropBottom ));
const SwRotationGrf& rRotation = rSet.GetRotationGrf();
rGA.SetRotation( rRotation.GetValue() );
diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx
index 3df39532978c..b3cabeb85dab 100644
--- a/sw/source/core/inc/DocumentContentOperationsManager.hxx
+++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx
@@ -54,7 +54,7 @@ public:
bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) override;
- bool MoveAndJoin(SwPaM&, SwPosition&) override;
+ void MoveAndJoin(SwPaM&, SwPosition&) override;
bool Overwrite(const SwPaM &rRg, const OUString& rStr) override;
@@ -89,7 +89,6 @@ public:
bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
const SetAttrMode nFlags = SetAttrMode::DEFAULT,
SwRootFrame const* pLayout = nullptr,
- bool bExpandCharToPara = false,
SwTextAttr **ppNewTextAttr = nullptr) override;
void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 387be04a4c15..19e55d5ede47 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -153,6 +153,7 @@ class DocumentSettingManager final :
bool mbClippedPictures;
bool mbBackgroundParaOverDrawings;
bool mbTabOverMargin;
+ bool mbTabOverSpacing;
bool mbTreatSingleColumnBreakAsPageBreak; // tdf#76349
bool mbSurroundTextWrapSmall;
bool mbPropLineSpacingShrinksFirstLine; // fdo#79602
diff --git a/sw/source/core/inc/SwGrammarMarkUp.hxx b/sw/source/core/inc/SwGrammarMarkUp.hxx
index 86f0b55bd5c4..efefadf83a30 100644
--- a/sw/source/core/inc/SwGrammarMarkUp.hxx
+++ b/sw/source/core/inc/SwGrammarMarkUp.hxx
@@ -50,7 +50,7 @@ public:
/* SwWrongList::Move() + handling of maSentence */
void MoveGrammar(sal_Int32 nPos, sal_Int32 nDiff);
/* SwWrongList::SplitList() + handling of maSentence */
- SwGrammarMarkUp* SplitGrammarList(sal_Int32 nSplitPos);
+ std::unique_ptr<SwGrammarMarkUp> SplitGrammarList(sal_Int32 nSplitPos);
/* SwWrongList::JoinList() + handling of maSentence */
void JoinGrammarList(SwGrammarMarkUp* pNext, sal_Int32 nInsertPos);
/* SwWrongList::ClearList() + handling of maSentence */
diff --git a/sw/source/core/inc/SwUndoFmt.hxx b/sw/source/core/inc/SwUndoFmt.hxx
index b91eec91d539..f02776339c90 100644
--- a/sw/source/core/inc/SwUndoFmt.hxx
+++ b/sw/source/core/inc/SwUndoFmt.hxx
@@ -23,6 +23,7 @@
#include <undobj.hxx>
#include <swundo.hxx>
#include <numrule.hxx>
+#include <memory>
class SwDoc;
class SwTextFormatColl;
@@ -36,7 +37,7 @@ protected:
OUString m_sDerivedFrom;
SwDoc& m_rDoc;
mutable OUString m_sNewName;
- SfxItemSet * m_pNewSet;
+ std::unique_ptr<SfxItemSet> m_pNewSet;
sal_uInt16 m_nId; // FormatId related
bool m_bAuto;
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 81b4780b9792..c15f0f10ca1c 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -175,7 +175,7 @@ class SwUndoTableNdsChg : public SwUndo
BoxMove(sal_uLong idx, bool moved=false) : index(idx), hasMoved(moved) {};
bool operator<(const BoxMove& other) const { return index < other.index; };
};
- std::unique_ptr< std::set<BoxMove> > m_pNewSttNds;
+ std::optional< std::set<BoxMove> > m_xNewSttNds;
std::unique_ptr<SwUndoSaveSections> m_pDelSects;
tools::Long m_nMin, m_nMax; // for redo of delete column
sal_uLong m_nSttNode;
diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index 937f40c1751e..9cb57a9e1b39 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -33,6 +33,23 @@ class SwTextFrame;
// implemented in cntfrm.cxx, used in cntfrm.cxx and crsrsh.cxx
extern bool GetFrameInPage( const SwContentFrame*, SwWhichPage, SwPosPage, SwPaM* );
+enum class SwContentFrameInvFlags : sal_uInt8
+{
+ NONE = 0x00,
+ SetCompletePaint = 0x01,
+ InvalidatePos = 0x02,
+ InvalidateSize = 0x04,
+ InvalidateSectPrt = 0x08,
+ InvalidateNextPrt = 0x10,
+ InvalidatePrevPrt = 0x20,
+ InvalidateNextPos = 0x40,
+ SetNextCompletePaint = 0x80,
+};
+
+namespace o3tl {
+ template<> struct typed_flags<SwContentFrameInvFlags> : is_typed_flags<SwContentFrameInvFlags, 0xff> {};
+}
+
class SAL_DLLPUBLIC_RTTI SwContentFrame: public SwFrame, public SwFlowFrame
{
friend void MakeNxt( SwFrame *pFrame, SwFrame *pNxt ); // calls MakePrtArea
@@ -46,7 +63,7 @@ class SAL_DLLPUBLIC_RTTI SwContentFrame: public SwFrame, public SwFlowFrame
virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
- void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
+ void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, SwContentFrameInvFlags &,
SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool& ) override;
diff --git a/sw/source/core/inc/docsort.hxx b/sw/source/core/inc/docsort.hxx
index f18775b3c7a5..a92754db521b 100644
--- a/sw/source/core/inc/docsort.hxx
+++ b/sw/source/core/inc/docsort.hxx
@@ -63,7 +63,7 @@ struct SwSortElement
static const FlatFndBox* pBox;
static CollatorWrapper* pSortCollator;
static css::lang::Locale* pLocale;
- static OUString* pLastAlgorithm;
+ static std::optional<OUString> xLastAlgorithm;
static LocaleDataWrapper* pLclData;
static void Init( SwDoc*, const SwSortOptions& rOpt, FlatFndBox const * = nullptr );
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index 399bbbe913fe..47017e71e50e 100644
--- a/sw/source/core/inc/flyfrm.hxx
+++ b/sw/source/core/inc/flyfrm.hxx
@@ -131,6 +131,7 @@ protected:
bool m_bLayout :1; ///< RndStdIds::FLY_AT_PAGE, RndStdIds::FLY_AT_FLY, at page or at frame
bool m_bAutoPosition :1; ///< RndStdIds::FLY_AT_CHAR, anchored at character
bool m_bDeleted :1; ///< Anchored to a tracked deletion
+ size_t m_nAuthor; ///< Redline author index for colored crossing out
friend class SwNoTextFrame; // is allowed to call NotifyBackground
@@ -217,6 +218,8 @@ public:
bool IsFlyAtContentFrame() const { return m_bAtCnt; }
bool IsDeleted() const { return m_bDeleted; }
void SetDeleted(bool bDeleted) { m_bDeleted = bDeleted; }
+ void SetAuthor( size_t nAuthor ) { m_nAuthor = nAuthor; }
+ size_t GetAuthor() const { return m_nAuthor; }
bool IsNotifyBack() const { return m_bNotifyBack; }
void SetNotifyBack() { m_bNotifyBack = true; }
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index b1cccfd2af4d..6481e6c0be6f 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -79,7 +79,7 @@ void AppendAllObjs(const SwFrameFormats* pTable, const SwFrame* pSib);
// transparency, saved in the color of the brush item.
void DrawGraphic(
const SvxBrushItem *,
- vcl::RenderContext *,
+ vcl::RenderContext &,
const SwRect &rOrg,
const SwRect &rOut,
const sal_uInt8 nGrfNum = GRFNUM_NO,
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 7156bec34157..73d81a6895b5 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -238,14 +238,14 @@ public:
bool IsInvalidAutoCompleteWords() const { return m_bInvalidAutoCmplWrds; }
bool IsInvalidWordCount() const { return m_bInvalidWordCount; }
- /** SwPageFrame::GetDrawBackgrdColor
+ /** SwPageFrame::GetDrawBackgroundColor
determine the color, that is respectively will be drawn as background
for the page frame.
@return reference to an instance of class Color
*/
- Color GetDrawBackgrdColor() const;
+ Color GetDrawBackgroundColor() const;
/** paint margin area of a page
diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index 88bd6a82b0fb..97745968fcad 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -26,6 +26,22 @@ class SwTable;
class SwBorderAttrs;
class SwAttrSetChg;
+enum class SwTabFrameInvFlags : sal_uInt8
+{
+ NONE = 0x00,
+ InvalidatePrt = 0x02,
+ InvalidateIndNextPrt = 0x04,
+ InvalidatePrevPrt = 0x08,
+ SetIndNextCompletePaint = 0x10,
+ InvalidateBrowseWidth = 0x20,
+ InvalidatePos = 0x40,
+ InvalidateNextPos = 0x80,
+};
+
+namespace o3tl {
+ template<> struct typed_flags<SwTabFrameInvFlags> : is_typed_flags<SwTabFrameInvFlags, 0xfe> {};
+}
+
/// SwTabFrame is one table in the document layout, containing rows (which contain cells).
class SwTabFrame final: public SwLayoutFrame, public SwFlowFrame
{
@@ -96,7 +112,7 @@ class SwTabFrame final: public SwLayoutFrame, public SwFlowFrame
void UpdateAttr_(
const SfxPoolItem*,
- const SfxPoolItem*, sal_uInt8 &,
+ const SfxPoolItem*, SwTabFrameInvFlags &,
SwAttrSetChg *pa = nullptr,
SwAttrSetChg *pb = nullptr );
diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx
index cc1f0a514769..addc40804f74 100644
--- a/sw/source/core/inc/tblrwcl.hxx
+++ b/sw/source/core/inc/tblrwcl.hxx
@@ -126,7 +126,7 @@ struct SwGCLineBorder
SwGCLineBorder( const SwTableBox& rBox )
: pLines( &rBox.GetTabLines() ), pShareFormats(nullptr), nLinePos( 0 ) {}
- bool IsLastLine() const { return nLinePos + 1 >= static_cast<sal_uInt16>(pLines->size()); }
+ bool IsLastLine() const { return nLinePos + 1 >= o3tl::narrowing<sal_uInt16>(pLines->size()); }
};
class SwGCBorder_BoxBrd
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index abef52f448aa..0a2f4fbbd2bc 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -578,7 +578,7 @@ public:
virtual void CheckDirection( bool bVert ) override;
/// Returns the sum of line height in pLine
- sal_uInt16 GetParHeight() const;
+ sal_uInt32 GetParHeight() const;
inline SwTextFrame *GetFollow();
inline const SwTextFrame *GetFollow() const;
diff --git a/sw/source/core/inc/unometa.hxx b/sw/source/core/inc/unometa.hxx
index ea4c3e66836c..ca298fcd8f63 100644
--- a/sw/source/core/inc/unometa.hxx
+++ b/sw/source/core/inc/unometa.hxx
@@ -263,7 +263,7 @@ public:
void getPrefixAndSuffix(
const css::uno::Reference< css::frame::XModel>& xModel,
const css::uno::Reference< css::rdf::XMetadatable>& xMetaField,
- OUString *const o_pPrefix, OUString *const o_pSuffix);
+ OUString *const o_pPrefix, OUString *const o_pSuffix, OUString *const o_pShadowColor);
#endif // INCLUDED_SW_SOURCE_CORE_INC_UNOMETA_HXX
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index dcd8503ef6aa..0a2f010b4f38 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -28,7 +28,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <vector>
-
+#include <memory>
#include <optional>
#include <tools/color.hxx>
@@ -305,7 +305,7 @@ public:
// Divide the list into two part, the wrong words until nSplitPos will be
// removed and transferred to a new SwWrongList.
- SwWrongList* SplitList( sal_Int32 nSplitPos );
+ std::unique_ptr<SwWrongList> SplitList( sal_Int32 nSplitPos );
// Join the next SwWrongList, nInsertPos is my own text length, where
// the other wrong list has to be inserted.
void JoinList( SwWrongList* pNext, sal_Int32 nInsertPos );
@@ -320,7 +320,7 @@ public:
return nIdx < maList.size() ? maList[nIdx].mnPos : 0;
}
- sal_uInt16 Count() const { return static_cast<sal_uInt16>(maList.size()); }
+ sal_uInt16 Count() const { return o3tl::narrowing<sal_uInt16>(maList.size()); }
void Insert( const OUString& rType,
css::uno::Reference< css::container::XStringKeyMap > const & xPropertyBag,
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 93773c255fd7..8110b5120c74 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -619,7 +619,7 @@ SwRect SwAnchoredDrawObject::GetObjRect() const
{
// use geometry of drawing object
//return GetDrawObj()->GetCurrentBoundRect();
- return GetDrawObj()->GetSnapRect();
+ return SwRect(GetDrawObj()->GetSnapRect());
}
namespace
@@ -745,7 +745,7 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const
pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);
}
}
- return GetDrawObj()->GetCurrentBoundRect();
+ return SwRect(GetDrawObj()->GetCurrentBoundRect());
}
// --> #i68520#
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index fe29ecfe2faa..5e7d6100bc0e 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <com/sun/star/text/ColumnSeparatorStyle.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
@@ -78,6 +81,7 @@
#include <unomid.h>
#include <strings.hrc>
#include <svx/svdundo.hxx>
+#include <svx/SvxXTextColumns.hxx>
#include <sortedobjs.hxx>
#include <HandleAnchorNodeChg.hxx>
#include <calbck.hxx>
@@ -85,6 +89,7 @@
#include <drawdoc.hxx>
#include <hints.hxx>
#include <frameformats.hxx>
+#include <unoprnms.hxx>
#include <ndtxt.hxx>
@@ -1073,7 +1078,81 @@ bool SwFormatCol::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
}
else
{
- uno::Reference< text::XTextColumns > xCols = new SwXTextColumns(*this);
+ uno::Reference<text::XTextColumns> xCols(SvxXTextColumns_createInstance(),
+ css::uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xProps(xCols, css::uno::UNO_QUERY_THROW);
+
+ if (GetNumCols() > 0)
+ {
+ xCols->setColumnCount(GetNumCols());
+ const sal_uInt16 nItemGutterWidth = GetGutterWidth();
+ sal_Int32 nAutoDistance = IsOrtho() ? USHRT_MAX == nItemGutterWidth
+ ? DEF_GUTTER_WIDTH
+ : static_cast<sal_Int32>(nItemGutterWidth)
+ : 0;
+ nAutoDistance = convertTwipToMm100(nAutoDistance);
+ xProps->setPropertyValue(UNO_NAME_AUTOMATIC_DISTANCE, uno::Any(nAutoDistance));
+
+ if (!IsOrtho())
+ {
+ auto aTextColumns = xCols->getColumns();
+ text::TextColumn* pColumns = aTextColumns.getArray();
+ const SwColumns& rCols = GetColumns();
+ for (sal_Int32 i = 0; i < aTextColumns.getLength(); ++i)
+ {
+ const SwColumn* pCol = &rCols[i];
+
+ pColumns[i].Width = pCol->GetWishWidth();
+ pColumns[i].LeftMargin = convertTwipToMm100(pCol->GetLeft());
+ pColumns[i].RightMargin = convertTwipToMm100(pCol->GetRight());
+ }
+ xCols->setColumns(aTextColumns); // sets "IsAutomatic" property to false
+ }
+ }
+ uno::Any aVal;
+ aVal <<= o3tl::narrowing<sal_Int32>(GetLineWidth());
+ xProps->setPropertyValue(UNO_NAME_SEPARATOR_LINE_WIDTH, aVal);
+ aVal <<= GetLineColor();
+ xProps->setPropertyValue(UNO_NAME_SEPARATOR_LINE_COLOR, aVal);
+ aVal <<= static_cast<sal_Int32>(GetLineHeight());
+ xProps->setPropertyValue(UNO_NAME_SEPARATOR_LINE_RELATIVE_HEIGHT, aVal);
+ aVal <<= GetLineAdj() != COLADJ_NONE;
+ xProps->setPropertyValue(UNO_NAME_SEPARATOR_LINE_IS_ON, aVal);
+ sal_Int16 nStyle;
+ switch (GetLineStyle())
+ {
+ case SvxBorderLineStyle::SOLID:
+ nStyle = css::text::ColumnSeparatorStyle::SOLID;
+ break;
+ case SvxBorderLineStyle::DOTTED:
+ nStyle = css::text::ColumnSeparatorStyle::DOTTED;
+ break;
+ case SvxBorderLineStyle::DASHED:
+ nStyle = css::text::ColumnSeparatorStyle::DASHED;
+ break;
+ case SvxBorderLineStyle::NONE:
+ default:
+ nStyle = css::text::ColumnSeparatorStyle::NONE;
+ break;
+ }
+ aVal <<= nStyle;
+ xProps->setPropertyValue(UNO_NAME_SEPARATOR_LINE_STYLE, aVal);
+ style::VerticalAlignment eAlignment;
+ switch (GetLineAdj())
+ {
+ case COLADJ_TOP:
+ eAlignment = style::VerticalAlignment_TOP;
+ break;
+ case COLADJ_BOTTOM:
+ eAlignment = style::VerticalAlignment_BOTTOM;
+ break;
+ case COLADJ_CENTER:
+ case COLADJ_NONE:
+ default:
+ eAlignment = style::VerticalAlignment_MIDDLE;
+ }
+ aVal <<= eAlignment;
+ xProps->setPropertyValue(UNO_NAME_SEPARATOR_LINE_VERTIVAL_ALIGNMENT, aVal);
rVal <<= xCols;
}
return true;
@@ -1098,7 +1177,7 @@ bool SwFormatCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
const text::TextColumn* pArray = aSetColumns.getConstArray();
m_aColumns.clear();
//max count is 64k here - this is something the array can't do
- sal_uInt16 nCount = std::min( static_cast<sal_uInt16>(aSetColumns.getLength()),
+ sal_uInt16 nCount = std::min( o3tl::narrowing<sal_uInt16>(aSetColumns.getLength()),
sal_uInt16(0x3fff) );
sal_uInt16 nWidthSum = 0;
// #101224# one column is no column
@@ -1117,24 +1196,33 @@ bool SwFormatCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
m_nWidth = nWidthSum;
m_bOrtho = false;
- auto pSwColums = comphelper::getUnoTunnelImplementation<SwXTextColumns>(xCols);
- if(pSwColums)
+ if (uno::Reference<beans::XPropertySet> xProps{ xCols, css::uno::UNO_QUERY })
{
- m_bOrtho = pSwColums->IsAutomaticWidth();
- m_nLineWidth = pSwColums->GetSepLineWidth();
- m_aLineColor = pSwColums->GetSepLineColor();
- m_nLineHeight = pSwColums->GetSepLineHeightRelative();
- switch ( pSwColums->GetSepLineStyle() )
+ xProps->getPropertyValue(UNO_NAME_IS_AUTOMATIC) >>= m_bOrtho;
+ xProps->getPropertyValue(UNO_NAME_SEPARATOR_LINE_WIDTH) >>= m_nLineWidth;
+ xProps->getPropertyValue(UNO_NAME_SEPARATOR_LINE_COLOR) >>= m_aLineColor;
+ if (sal_Int32 nHeight;
+ xProps->getPropertyValue(UNO_NAME_SEPARATOR_LINE_RELATIVE_HEIGHT) >>= nHeight)
+ m_nLineHeight = nHeight;
+ switch (xProps->getPropertyValue(UNO_NAME_SEPARATOR_LINE_STYLE).get<sal_Int16>())
{
default:
- case 0: m_eLineStyle = SvxBorderLineStyle::NONE; break;
- case 1: m_eLineStyle = SvxBorderLineStyle::SOLID; break;
- case 2: m_eLineStyle = SvxBorderLineStyle::DOTTED; break;
- case 3: m_eLineStyle = SvxBorderLineStyle::DASHED; break;
+ case css::text::ColumnSeparatorStyle::NONE:
+ m_eLineStyle = SvxBorderLineStyle::NONE;
+ break;
+ case css::text::ColumnSeparatorStyle::SOLID:
+ m_eLineStyle = SvxBorderLineStyle::SOLID;
+ break;
+ case css::text::ColumnSeparatorStyle::DOTTED:
+ m_eLineStyle = SvxBorderLineStyle::DOTTED;
+ break;
+ case css::text::ColumnSeparatorStyle::DASHED:
+ m_eLineStyle = SvxBorderLineStyle::DASHED;
+ break;
}
- if(!pSwColums->GetSepLineIsOn())
+ if (!xProps->getPropertyValue(UNO_NAME_SEPARATOR_LINE_IS_ON).get<bool>())
m_eAdj = COLADJ_NONE;
- else switch(pSwColums->GetSepLineVertAlign())
+ else switch (xProps->getPropertyValue(UNO_NAME_SEPARATOR_LINE_VERTIVAL_ALIGNMENT).get<style::VerticalAlignment>())
{
case style::VerticalAlignment_TOP: m_eAdj = COLADJ_TOP; break;
case style::VerticalAlignment_MIDDLE: m_eAdj = COLADJ_CENTER; break;
@@ -2269,7 +2357,7 @@ bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
sal_Int16 nTmp = 0;
bRet = (rVal >>= nTmp);
if( bRet && (nTmp >= 0) )
- SetLines( static_cast<sal_uInt16>(nTmp) );
+ SetLines( o3tl::narrowing<sal_uInt16>(nTmp) );
else
bRet = false;
}
@@ -2301,15 +2389,15 @@ bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEHEIGHT )
{
nTmp = std::max<sal_Int32>(nTmp, MIN_TEXTGRID_SIZE);
- SetBaseHeight( static_cast<sal_uInt16>(nTmp) );
+ SetBaseHeight( o3tl::narrowing<sal_uInt16>(nTmp) );
}
else if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEWIDTH )
{
nTmp = std::max<sal_Int32>(nTmp, MIN_TEXTGRID_SIZE);
- SetBaseWidth( static_cast<sal_uInt16>(nTmp) );
+ SetBaseWidth( o3tl::narrowing<sal_uInt16>(nTmp) );
}
else
- SetRubyHeight( static_cast<sal_uInt16>(nTmp) );
+ SetRubyHeight( o3tl::narrowing<sal_uInt16>(nTmp) );
}
else
bRet = false;
@@ -3582,14 +3670,11 @@ void CheckAnchoredFlyConsistency(SwDoc const& rDoc)
for (sal_uLong i = 0; i != count; ++i)
{
SwNode const*const pNode(rNodes[i]);
- std::vector<SwFrameFormat*> const*const pFlys(pNode->GetAnchoredFlys());
- if (pFlys)
+ std::vector<SwFrameFormat*> const & rFlys(pNode->GetAnchoredFlys());
+ for (const auto& rpFly : rFlys)
{
- for (const auto& rpFly : *pFlys)
- {
- SwFormatAnchor const& rAnchor((*rpFly).GetAnchor(false));
- assert(&rAnchor.GetContentAnchor()->nNode.GetNode() == pNode);
- }
+ SwFormatAnchor const& rAnchor((*rpFly).GetAnchor(false));
+ assert(&rAnchor.GetContentAnchor()->nNode.GetNode() == pNode);
}
}
SwFrameFormats const*const pSpzFrameFormats(rDoc.GetSpzFrameFormats());
@@ -3609,8 +3694,8 @@ void CheckAnchoredFlyConsistency(SwDoc const& rDoc)
else
{
SwNode & rNode(rAnchor.GetContentAnchor()->nNode.GetNode());
- std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
- assert(std::find(pFlys->begin(), pFlys->end(), *it) != pFlys->end());
+ std::vector<SwFrameFormat*> const& rFlys(rNode.GetAnchoredFlys());
+ assert(std::find(rFlys.begin(), rFlys.end(), *it) != rFlys.end());
switch (rAnchor.GetAnchorId())
{
case RndStdIds::FLY_AT_FLY:
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index 4f1bc42ecc18..6391f97343d8 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -409,7 +409,7 @@ void SwImplProtocol::CheckLine( OString& rLine )
}
break;
case 5:
- m_nMaxLines = static_cast<sal_uInt16>(nVal);
+ m_nMaxLines = o3tl::narrowing<sal_uInt16>(nVal);
break;
case 6:
m_aVars.push_back(nVal);
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index bf01c3b1dc7a..8181bd623d39 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -87,7 +87,8 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch
m_bAtCnt( false ),
m_bLayout( false ),
m_bAutoPosition( false ),
- m_bDeleted (false ),
+ m_bDeleted( false ),
+ m_nAuthor( std::string::npos ),
m_bValidContentPos( false )
{
mnFrameType = SwFrameType::Fly;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 14a73d4d5869..13350fef27c3 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1160,12 +1160,8 @@ void RemoveHiddenObjsOfNode(SwTextNode const& rNode,
std::vector<sw::Extent>::const_iterator const*const pEnd,
SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
{
- std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
- if (!pFlys)
- {
- return;
- }
- for (SwFrameFormat * pFrameFormat : *pFlys)
+ std::vector<SwFrameFormat*> const & rFlys(rNode.GetAnchoredFlys());
+ for (SwFrameFormat * pFrameFormat : rFlys)
{
SwFormatAnchor const& rAnchor = pFrameFormat->GetAnchor();
if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR
@@ -1204,10 +1200,10 @@ void AppendObjsOfNode(SwFrameFormats const*const pTable, sal_uLong const nIndex,
#endif
SwNode const& rNode(*pDoc->GetNodes()[nIndex]);
- std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
- for (size_t it = 0; pFlys && it != pFlys->size(); )
+ std::vector<SwFrameFormat*> const & rFlys(rNode.GetAnchoredFlys());
+ for (size_t it = 0; it != rFlys.size(); )
{
- SwFrameFormat *const pFormat = (*pFlys)[it];
+ SwFrameFormat *const pFormat = rFlys[it];
const SwFormatAnchor &rAnch = pFormat->GetAnchor();
if ( rAnch.GetContentAnchor() &&
IsShown(nIndex, rAnch, pIter, pEnd, pFirstNode, pLastNode))
@@ -3406,7 +3402,7 @@ void Notify_Background( const SdrObject* pObj,
// instead of <GetCurrentBoundRect()>, because a recalculation
// of the bounding rectangle isn't intended here.
if (!isValidTableBeforeAnchor
- && (pTab->getFrameArea().IsOver(pObj->GetLastBoundRect()) ||
+ && (pTab->getFrameArea().IsOver(SwRect(pObj->GetLastBoundRect())) ||
pTab->getFrameArea().IsOver(rRect)))
{
if ( !pFlyFrame || !pFlyFrame->IsLowerOf( pTab ) )
@@ -3418,7 +3414,7 @@ void Notify_Background( const SdrObject* pObj,
// instead of <GetCurrentBoundRect()>, because a recalculation
// of the bounding rectangle isn't intended here.
if (!isValidTableBeforeAnchor && pCell->IsCellFrame() &&
- ( pCell->getFrameArea().IsOver( pObj->GetLastBoundRect() ) ||
+ ( pCell->getFrameArea().IsOver( SwRect(pObj->GetLastBoundRect()) ) ||
pCell->getFrameArea().IsOver( rRect ) ) )
{
const SwFormatVertOrient &rOri = pCell->GetFormat()->GetVertOrient();
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 10d5cf065d3a..4e95504f07ef 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1430,16 +1430,15 @@ void SwLayAction::FormatLayoutFly( SwFlyFrame* pFly )
return;
// Now, deal with the lowers that are LayoutFrames
- bool bTabChanged = false;
SwFrame *pLow = pFly->Lower();
while ( pLow )
{
if ( pLow->IsLayoutFrame() )
{
if ( pLow->IsTabFrame() )
- bTabChanged |= FormatLayoutTab( static_cast<SwTabFrame*>(pLow), bAddRect );
+ FormatLayoutTab( static_cast<SwTabFrame*>(pLow), bAddRect );
else
- bChanged |= FormatLayout( m_pImp->GetShell()->GetOut(), static_cast<SwLayoutFrame*>(pLow), bAddRect );
+ FormatLayout( m_pImp->GetShell()->GetOut(), static_cast<SwLayoutFrame*>(pLow), bAddRect );
}
pLow = pLow->GetNext();
}
@@ -2154,11 +2153,11 @@ void SwLayIdle::ShowIdle( Color eColor )
tools::Rectangle aRect( 0, 0, 5, 5 );
aRect = pWin->PixelToLogic( aRect );
// Depending on if idle layout is in progress or not, draw a "red square" or a "green square".
- pWin->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
- pWin->SetFillColor( eColor );
- pWin->SetLineColor();
- pWin->DrawRect( aRect );
- pWin->Pop();
+ pWin->GetOutDev()->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
+ pWin->GetOutDev()->SetFillColor( eColor );
+ pWin->GetOutDev()->SetLineColor();
+ pWin->GetOutDev()->DrawRect( aRect );
+ pWin->GetOutDev()->Pop();
}
}
#define SHOW_IDLE( Color ) ShowIdle( Color )
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 27cbf1b4a997..aec591d05c3c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1200,7 +1200,7 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh, const vcl::RenderContex
bZeroHeight = true;
}
- rRect = pOut->PixelToLogic( aAlignedPxRect.SVRect() );
+ rRect = SwRect(pOut->PixelToLogic( aAlignedPxRect.SVRect() ));
// Consider zero width/height and adjust calculated aligned twip rectangle.
// Reset width/height to zero; previous negative width/height haven't to be considered.
@@ -1549,11 +1549,11 @@ static void lcl_SubtractFlys( const SwFrame *pFrame, const SwPageFrame *pPage,
gProp.pSRetoucheFly = nullptr;
}
-static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
- vcl::RenderContext* _pOut,
- const SwRect& _rAlignedPaintRect,
- const GraphicObject& _rGraphicObj,
- SwPaintProperties const & properties)
+static void lcl_implDrawGraphicBackground(const SvxBrushItem& _rBackgrdBrush,
+ vcl::RenderContext& _rOut,
+ const SwRect& _rAlignedPaintRect,
+ const GraphicObject& _rGraphicObj,
+ SwPaintProperties const & properties)
{
/// determine color of background
/// If color of background brush is not "no fill"/"auto fill" or
@@ -1585,17 +1585,17 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
if ( bDrawTransparent )
{
/// draw background transparent
- if( _pOut->GetFillColor() != aColor.GetRGBColor() )
- _pOut->SetFillColor( aColor.GetRGBColor() );
+ if( _rOut.GetFillColor() != aColor.GetRGBColor() )
+ _rOut.SetFillColor( aColor.GetRGBColor() );
tools::PolyPolygon aPoly( _rAlignedPaintRect.SVRect() );
- _pOut->DrawTransparent( aPoly, nTransparencyPercent );
+ _rOut.DrawTransparent( aPoly, nTransparencyPercent );
}
else
{
/// draw background opaque
- if ( _pOut->GetFillColor() != aColor )
- _pOut->SetFillColor( aColor );
- _pOut->DrawRect( _rAlignedPaintRect.SVRect() );
+ if ( _rOut.GetFillColor() != aColor )
+ _rOut.SetFillColor( aColor );
+ _rOut.DrawRect( _rAlignedPaintRect.SVRect() );
}
}
@@ -1609,12 +1609,12 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
* background graphics. Previously, this code was integrated in method
* <lcl_DrawGraphic>.
* Method implemented as an inline, checking the conditions and calling method
- * method <lcl_implDrawGraphicBackgrd(..)> for the intrinsic drawing.
+ * method <lcl_implDrawGraphicBackground(..)> for the intrinsic drawing.
*
* @param _rBackgrdBrush
* background brush contain the color the background has to be drawn.
*
- * @param _pOut
+ * @param _rOut
* output device the background has to be drawn in.
*
* @param _rAlignedPaintRect
@@ -1631,8 +1631,8 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
* @param _bBackgrdAlreadyDrawn
* boolean (optional; default: false) indicating, if the background is already drawn.
*/
-static void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
- OutputDevice* _pOut,
+static void lcl_DrawGraphicBackground( const SvxBrushItem& _rBackgrdBrush,
+ OutputDevice& _rOut,
const SwRect& _rAlignedPaintRect,
const GraphicObject& _rGraphicObj,
bool _bNumberingGraphic,
@@ -1648,7 +1648,7 @@ static void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
( _rGraphicObj.IsTransparent() || _rGraphicObj.GetType() == GraphicType::NONE )
)
{
- lcl_implDrawGraphicBackgrd( _rBackgrdBrush, _pOut, _rAlignedPaintRect, _rGraphicObj, properties );
+ lcl_implDrawGraphicBackground( _rBackgrdBrush, _rOut, _rAlignedPaintRect, _rGraphicObj, properties );
}
}
@@ -1663,11 +1663,11 @@ static void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
* Use align rectangle for drawing graphic Pixel-align coordinates for
* drawing graphic
* Outsource code for drawing background of the graphic
- * with a background color in method <lcl_DrawGraphicBackgrd>
+ * with a background color in method <lcl_DrawGraphicBackground>
*
* Also, change type of <bGrfNum> and <bClip> from <bool> to <bool>
*/
-static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOut,
+static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext &rOutDev,
SwViewShell &rSh, const SwRect &rGrf, const SwRect &rOut,
bool bGrfNum,
SwPaintProperties const & properties,
@@ -1678,24 +1678,24 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOu
// Calculate align rectangle from parameter <rGrf> and use aligned
// rectangle <aAlignedGrfRect> in the following code
SwRect aAlignedGrfRect = rGrf;
- ::SwAlignRect( aAlignedGrfRect, &rSh, pOut );
+ ::SwAlignRect( aAlignedGrfRect, &rSh, &rOutDev );
// Change type from <bool> to <bool>.
const bool bNotInside = !rOut.IsInside( aAlignedGrfRect );
if ( bNotInside )
{
- pOut->Push( PushFlags::CLIPREGION );
- pOut->IntersectClipRegion( rOut.SVRect() );
+ rOutDev.Push( PushFlags::CLIPREGION );
+ rOutDev.IntersectClipRegion( rOut.SVRect() );
}
GraphicObject *pGrf = const_cast<GraphicObject*>(rBrush.GetGraphicObject());
// Outsource drawing of background with a background color
- ::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, *pGrf, bGrfNum, properties, bBackgrdAlreadyDrawn );
+ ::lcl_DrawGraphicBackground( rBrush, rOutDev, aAlignedGrfRect, *pGrf, bGrfNum, properties, bBackgrdAlreadyDrawn );
// Because for drawing a graphic left-top-corner and size coordinates are
// used, these coordinates have to be determined on pixel level.
- ::SwAlignGrfRect( &aAlignedGrfRect, *pOut );
+ ::SwAlignGrfRect( &aAlignedGrfRect, rOutDev );
const basegfx::B2DHomMatrix aGraphicTransform(
basegfx::utils::createScaleTranslateB2DHomMatrix(
@@ -1703,7 +1703,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOu
aAlignedGrfRect.Left(), aAlignedGrfRect.Top()));
paintGraphicUsingPrimitivesHelper(
- *pOut,
+ rOutDev,
*pGrf,
pGrf->GetAttr(),
aGraphicTransform,
@@ -1712,7 +1712,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOu
OUString());
if ( bNotInside )
- pOut->Pop();
+ rOutDev.Pop();
}
bool DrawFillAttributes(
@@ -1811,7 +1811,7 @@ bool DrawFillAttributes(
void DrawGraphic(
const SvxBrushItem *pBrush,
- vcl::RenderContext *pOutDev,
+ vcl::RenderContext &rOutDev,
const SwRect &rOrg,
const SwRect &rOut,
const sal_uInt8 nGrfNum,
@@ -1915,16 +1915,16 @@ void DrawGraphic(
GraphicObject* pGraphicObj = const_cast< GraphicObject* >(pBrush->GetGraphicObject());
// calculate aligned paint rectangle
SwRect aAlignedPaintRect = rOut;
- ::SwAlignRect( aAlignedPaintRect, &rSh, pOutDev );
+ ::SwAlignRect( aAlignedPaintRect, &rSh, &rOutDev );
// draw background color for aligned paint rectangle
- lcl_DrawGraphicBackgrd( *pBrush, pOutDev, aAlignedPaintRect, *pGraphicObj, bGrfNum, gProp );
+ lcl_DrawGraphicBackground( *pBrush, rOutDev, aAlignedPaintRect, *pGraphicObj, bGrfNum, gProp );
// set left-top-corner of background graphic to left-top-corner of the
// area, from which the background brush is determined.
aGrf.Pos() = rOrg.Pos();
// setup clipping at output device
- pOutDev->Push( PushFlags::CLIPREGION );
- pOutDev->IntersectClipRegion( rOut.SVRect() );
+ rOutDev.Push( PushFlags::CLIPREGION );
+ rOutDev.IntersectClipRegion( rOut.SVRect() );
// use new method <GraphicObject::DrawTiled(::)>
{
// calculate paint offset
@@ -1954,14 +1954,14 @@ void DrawGraphic(
const Size aSize( aAlignedPaintRect.SSize() );
const double Abitmap( k1/k2 * static_cast<double>(aSize.Width())*aSize.Height() );
- pGraphicObj->DrawTiled( pOutDev,
+ pGraphicObj->DrawTiled( rOutDev,
aAlignedPaintRect.SVRect(),
aGrf.SSize(),
Size( aPaintOffset.X(), aPaintOffset.Y() ),
std::max( 128, static_cast<int>( sqrt(sqrt( Abitmap)) + .5 ) ) );
}
// reset clipping at output device
- pOutDev->Pop();
+ rOutDev.Pop();
// set <bDraw> and <bRetouche> to false, indicating that background
// graphic and background are already drawn.
bDraw = bRetouche = false;
@@ -1972,7 +1972,7 @@ void DrawGraphic(
bDraw = false;
break;
- default: OSL_ENSURE( !pOutDev, "new Graphic position?" );
+ default: OSL_ENSURE( false, "new Graphic position?" );
}
/// init variable <bGrfBackgrdAlreadDrawn> to indicate, if background of
@@ -1980,8 +1980,8 @@ void DrawGraphic(
bool bGrfBackgrdAlreadyDrawn = false;
if ( bRetouche )
{
- pOutDev->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
- pOutDev->SetLineColor();
+ rOutDev.Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
+ rOutDev.SetLineColor();
// check, if an existing background graphic (not filling the complete
// background) is transparent drawn and the background color is
@@ -2044,11 +2044,11 @@ void DrawGraphic(
}
// #i75614# reset draw mode in high contrast mode in order to get fill color set
- const DrawModeFlags nOldDrawMode = pOutDev->GetDrawMode();
+ const DrawModeFlags nOldDrawMode = rOutDev.GetDrawMode();
if ( gProp.pSGlobalShell->GetWin() &&
Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
{
- pOutDev->SetDrawMode( DrawModeFlags::Default );
+ rOutDev.SetDrawMode( DrawModeFlags::Default );
}
// If background region has to be drawn transparent, set only the RGB values of the background color as
@@ -2057,21 +2057,21 @@ void DrawGraphic(
{
case Transparent:
{
- if( pOutDev->GetFillColor() != aColor.GetRGBColor() )
- pOutDev->SetFillColor( aColor.GetRGBColor() );
+ if( rOutDev.GetFillColor() != aColor.GetRGBColor() )
+ rOutDev.SetFillColor( aColor.GetRGBColor() );
break;
}
default:
{
- if( pOutDev->GetFillColor() != aColor )
- pOutDev->SetFillColor( aColor );
+ if( rOutDev.GetFillColor() != aColor )
+ rOutDev.SetFillColor( aColor );
break;
}
}
// #i75614#
// restore draw mode
- pOutDev->SetDrawMode( nOldDrawMode );
+ rOutDev.SetDrawMode( nOldDrawMode );
switch (eDrawStyle)
{
@@ -2107,7 +2107,7 @@ void DrawGraphic(
(( bTransparentGrfWithNoFillBackgrd ? nGrfTransparency : (255 - aColor.GetAlpha())
)*100 + 0x7F)/0xFF);
// draw poly-polygon transparent
- pOutDev->DrawTransparent( aDrawPoly, nTransparencyPercent );
+ rOutDev.DrawTransparent( aDrawPoly, nTransparencyPercent );
break;
}
@@ -2122,22 +2122,22 @@ void DrawGraphic(
// loop rectangles of background region, which has to be drawn
for( size_t i = 0; i < aRegion.size(); ++i )
{
- pOutDev->DrawRect( aRegion[i].SVRect() );
+ rOutDev.DrawRect( aRegion[i].SVRect() );
}
}
}
- pOutDev ->Pop();
+ rOutDev.Pop();
}
if( bDraw && aGrf.IsOver( rOut ) )
- lcl_DrawGraphic( *pBrush, pOutDev, rSh, aGrf, rOut, bGrfNum, gProp,
+ lcl_DrawGraphic( *pBrush, rOutDev, rSh, aGrf, rOut, bGrfNum, gProp,
bGrfBackgrdAlreadyDrawn );
if( bReplaceGrfNum )
{
const BitmapEx& rBmp = rSh.GetReplacementBitmap(false);
- vcl::Font aTmp( pOutDev->GetFont() );
- Graphic::DrawEx(pOutDev, OUString(), aTmp, rBmp, rOrg.Pos(), rOrg.SSize());
+ vcl::Font aTmp( rOutDev.GetFont() );
+ Graphic::DrawEx(rOutDev, OUString(), aTmp, rBmp, rOrg.Pos(), rOrg.SSize());
}
}
@@ -3012,7 +3012,7 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
if ( pSh->GetWin() )
{
- if ( pSh->GetOut() == pSh->GetWin() && !pSh->GetWin()->IsVisible() )
+ if ( pSh->GetOut() == pSh->GetWin()->GetOutDev() && !pSh->GetWin()->IsVisible() )
{
return;
}
@@ -3201,7 +3201,7 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
// determine background color of page for <PaintLayer> method
// calls, paint <hell> or <heaven>
- const Color aPageBackgrdColor(pPage->GetDrawBackgrdColor());
+ const Color aPageBackgrdColor(pPage->GetDrawBackgroundColor());
pPage->PaintBaBo( aPaintRect, pPage );
@@ -3816,12 +3816,12 @@ bool SwFlyFrame::IsBackgroundTransparent() const
if ( !bBackgroundTransparent &&
GetFormat()->IsBackgroundBrushInherited() )
{
- const SvxBrushItem* pBackgrdBrush = nullptr;
+ const SvxBrushItem* pBackgroundBrush = nullptr;
std::optional<Color> xSectionTOXColor;
SwRect aDummyRect;
drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
- if ( GetBackgroundBrush( aFillAttributes, pBackgrdBrush, xSectionTOXColor, aDummyRect, false, /*bConsiderTextBox=*/false) )
+ if ( GetBackgroundBrush( aFillAttributes, pBackgroundBrush, xSectionTOXColor, aDummyRect, false, /*bConsiderTextBox=*/false) )
{
if ( xSectionTOXColor &&
(xSectionTOXColor->IsTransparent()) &&
@@ -3833,17 +3833,17 @@ bool SwFlyFrame::IsBackgroundTransparent() const
{
bBackgroundTransparent = aFillAttributes->isTransparent();
}
- else if ( pBackgrdBrush )
+ else if ( pBackgroundBrush )
{
- if ( (pBackgrdBrush->GetColor().IsTransparent()) &&
- (pBackgrdBrush->GetColor() != COL_TRANSPARENT) )
+ if ( (pBackgroundBrush->GetColor().IsTransparent()) &&
+ (pBackgroundBrush->GetColor() != COL_TRANSPARENT) )
{
bBackgroundTransparent = true;
}
else
{
const GraphicObject *pTmpGrf =
- pBackgrdBrush->GetGraphicObject();
+ pBackgroundBrush->GetGraphicObject();
if ( pTmpGrf &&
(pTmpGrf->GetAttr().IsTransparent())
)
@@ -3914,7 +3914,7 @@ bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh )
//right now. Afterwards they must not be printed if the
//page over which they float position wise gets printed.
const SwPageFrame *pPage = pAnch->FindPageFrame();
- if ( !pPage->getFrameArea().IsOver( pObj->GetCurrentBoundRect() ) )
+ if ( !pPage->getFrameArea().IsOver( SwRect(pObj->GetCurrentBoundRect()) ) )
pAnch = nullptr;
}
}
@@ -4222,11 +4222,11 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
PaintDecorators();
// crossing out for tracked deletion
- if ( IsDeleted() )
+ if ( GetAuthor() != std::string::npos && IsDeleted() )
{
tools::Long startX = aRect.Left( ), endX = aRect.Right();
tools::Long startY = aRect.Top( ), endY = aRect.Bottom();
- rRenderContext.SetLineColor(NON_PRINTING_CHARACTER_COLOR);
+ rRenderContext.SetLineColor( SwPostItMgr::GetColorAnchor(GetAuthor()) );
rRenderContext.DrawLine(Point(startX, startY), Point(endX, endY));
rRenderContext.DrawLine(Point(startX, endY), Point(endX, startY));
}
@@ -5801,7 +5801,7 @@ bool SwPageFrame::IsLeftShadowNeeded() const
const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
SwRect aAlignedPageRect( _rPageRect );
::SwAlignRect( aAlignedPageRect, _pViewShell, pRenderContext );
- SwRect aPagePxRect = pRenderContext->LogicToPixel( aAlignedPageRect.SVRect() );
+ SwRect aPagePxRect(pRenderContext->LogicToPixel( aAlignedPageRect.SVRect() ));
tools::Long lShadowAdjustment = snShadowPxWidth - 1; // TODO: extract this
@@ -5917,7 +5917,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
SwRect aAlignedPageRect( _rPageRect );
::SwAlignRect( aAlignedPageRect, _pViewShell, _pViewShell->GetOut() );
- SwRect aPagePxRect = _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
+ SwRect aPagePxRect(_pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() ));
if (aShadowColor != SwViewOption::GetShadowColor())
{
@@ -6168,7 +6168,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
{
SwRect aAlignedPageRect( _rPageRect );
::SwAlignRect( aAlignedPageRect, _pViewShell, pRenderContext );
- SwRect aPagePxRect = pRenderContext->LogicToPixel( aAlignedPageRect.SVRect() );
+ SwRect aPagePxRect(pRenderContext->LogicToPixel( aAlignedPageRect.SVRect() ));
aPagePxRect.AddBottom( snShadowPxWidth + 1 );
aPagePxRect.AddTop( - snShadowPxWidth - 1 );
@@ -6181,7 +6181,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
if(bLeftShadow) aPagePxRect.Left( aTmpRect.Left() - snShadowPxWidth - 1);
if(bRightShadow) aPagePxRect.Right( aTmpRect.Right() + snShadowPxWidth + 1);
- _orBorderAndShadowBoundRect = pRenderContext->PixelToLogic( aPagePxRect.SVRect() );
+ _orBorderAndShadowBoundRect = SwRect(pRenderContext->PixelToLogic( aPagePxRect.SVRect() ));
}
SwRect SwPageFrame::GetBoundRect(OutputDevice const * pOutputDevice) const
@@ -6445,7 +6445,7 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP
// - see declaration in /core/inc/frmtool.hxx.
::DrawGraphic(
pItem,
- pOut,
+ *pOut,
aOrigBackRect,
aRegion[i],
GRFNUM_NO,
@@ -7085,7 +7085,7 @@ void SwLayoutFrame::RefreshExtraData( const SwRect &rRect ) const
*
* @return Color
*/
-Color SwPageFrame::GetDrawBackgrdColor() const
+Color SwPageFrame::GetDrawBackgroundColor() const
{
const SvxBrushItem* pBrushItem;
std::optional<Color> xDummyColor;
@@ -7190,7 +7190,7 @@ void SwFrame::Retouch( const SwPageFrame * pPage, const SwRect &rRect ) const
ResetRetouche();
if ( rRetouche.HasArea() )
{
- const Color aPageBackgrdColor(pPage->GetDrawBackgrdColor());
+ const Color aPageBackgrdColor(pPage->GetDrawBackgroundColor());
const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess();
// --> OD #i76669#
SwViewObjectContactRedirector aSwRedirector( *pSh );
@@ -7441,12 +7441,12 @@ void SetOutDevAndWin( SwViewShell *pSh, OutputDevice *pO,
pSh->mpOpt->SetZoom( nZoom );
}
-Graphic SwFrameFormat::MakeGraphic( ImageMap* )
+Graphic SwFrameFormat::MakeGraphic( ImageMap*, const std::optional<Size>& /*rTargetDPI*/ )
{
return Graphic();
}
-Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap )
+Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap, const std::optional<Size>& /*rTargetDPI*/ )
{
Graphic aRet;
//search any Fly!
@@ -7502,7 +7502,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap )
sal_uInt16 nZoom = pSh->GetViewOptions()->GetZoom();
::SetOutDevAndWin( pSh, pDev, nullptr, 100 );
gProp.bSFlyMetafile = true;
- gProp.pSFlyMetafileOut = pWin;
+ gProp.pSFlyMetafileOut = pWin->GetOutDev();
SwViewShellImp *pImp = pSh->Imp();
gProp.pSFlyOnlyDraw = pFly;
@@ -7510,7 +7510,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap )
// determine page, fly frame is on
const SwPageFrame* pFlyPage = pFly->FindPageFrame();
- const Color aPageBackgrdColor(pFlyPage->GetDrawBackgrdColor());
+ const Color aPageBackgrdColor(pFlyPage->GetDrawBackgroundColor());
const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess();
// --> OD #i76669#
SwViewObjectContactRedirector aSwRedirector( *pSh );
@@ -7553,18 +7553,18 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap )
return aRet;
}
-Graphic SwDrawFrameFormat::MakeGraphic( ImageMap* )
+Graphic SwDrawFrameFormat::MakeGraphic( ImageMap*, const std::optional<Size>& rTargetDPI )
{
Graphic aRet;
SwDrawModel* pMod = getIDocumentDrawModelAccess().GetDrawModel();
if ( pMod )
{
SdrObject *pObj = FindSdrObject();
- std::unique_ptr<SdrView> pView( new SdrView( *pMod ) );
- SdrPageView *pPgView = pView->ShowSdrPage(pView->GetModel()->GetPage(0));
- pView->MarkObj( pObj, pPgView );
- aRet = pView->GetMarkedObjBitmapEx();
- pView->HideSdrPage();
+ SdrView aView( *pMod );
+ SdrPageView *pPgView = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
+ aView.MarkObj( pObj, pPgView );
+ aRet = aView.GetMarkedObjBitmapEx(/*bNoVDevIfOneBmpMarked=*/false, rTargetDPI);
+ aView.HideSdrPage();
}
return aRet;
}
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 4747cede044b..fe3016b0037a 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3265,7 +3265,7 @@ void SwTabFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
if(!pLegacy)
return;
- sal_uInt8 nInvFlags = 0;
+ SwTabFrameInvFlags eInvFlags = SwTabFrameInvFlags::NONE;
bool bAttrSetChg = pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which();
if(bAttrSetChg)
@@ -3280,7 +3280,7 @@ void SwTabFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
SwAttrSetChg aNewSet(rNewSetChg);
do
{
- UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+ UpdateAttr_(pOItem, pNItem, eInvFlags, &aOldSet, &aNewSet);
pNItem = aNIter.NextItem();
pOItem = aOIter.NextItem();
} while(pNItem);
@@ -3288,46 +3288,46 @@ void SwTabFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
SwLayoutFrame::SwClientNotify(rMod, sw::LegacyModifyHint(&aOldSet, &aNewSet));
}
else
- UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
+ UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, eInvFlags);
- if(nInvFlags == 0)
+ if(eInvFlags == SwTabFrameInvFlags::NONE)
return;
SwPageFrame* pPage = FindPageFrame();
InvalidatePage(pPage);
- if(nInvFlags & 0x02)
+ if(eInvFlags & SwTabFrameInvFlags::InvalidatePrt)
InvalidatePrt_();
- if(nInvFlags & 0x40)
+ if(eInvFlags & SwTabFrameInvFlags::InvalidatePos)
InvalidatePos_();
SwFrame* pTmp = GetIndNext();
if(nullptr != pTmp)
{
- if(nInvFlags & 0x04)
+ if(eInvFlags & SwTabFrameInvFlags::InvalidateIndNextPrt)
{
pTmp->InvalidatePrt_();
if(pTmp->IsContentFrame())
pTmp->InvalidatePage(pPage);
}
- if(nInvFlags & 0x10)
+ if(eInvFlags & SwTabFrameInvFlags::SetIndNextCompletePaint)
pTmp->SetCompletePaint();
}
- if(nInvFlags & 0x08 && nullptr != (pTmp = GetPrev()))
+ if(eInvFlags & SwTabFrameInvFlags::InvalidatePrevPrt && nullptr != (pTmp = GetPrev()))
{
pTmp->InvalidatePrt_();
if(pTmp->IsContentFrame())
pTmp->InvalidatePage( pPage );
}
- if(nInvFlags & 0x20)
+ if(eInvFlags & SwTabFrameInvFlags::InvalidateBrowseWidth)
{
if(pPage && pPage->GetUpper() && !IsFollow())
static_cast<SwRootFrame*>(pPage->GetUpper())->InvalidateBrowseWidth();
}
- if(nInvFlags & 0x80)
+ if(eInvFlags & SwTabFrameInvFlags::InvalidateNextPos)
InvalidateNextPos();
}
void SwTabFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
- sal_uInt8 &rInvFlags,
+ SwTabFrameInvFlags &rInvFlags,
SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
{
bool bClear = true;
@@ -3356,18 +3356,18 @@ void SwTabFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
pHeadline->Paste( this, pLowerRow );
}
}
- rInvFlags |= 0x02;
+ rInvFlags |= SwTabFrameInvFlags::InvalidatePrt;
break;
case RES_FRM_SIZE:
case RES_HORI_ORIENT:
- rInvFlags |= 0x22;
+ rInvFlags |= SwTabFrameInvFlags::InvalidatePrt | SwTabFrameInvFlags::InvalidateBrowseWidth;
break;
case RES_PAGEDESC: //Attribute changes (on/off)
if ( IsInDocBody() )
{
- rInvFlags |= 0x40;
+ rInvFlags |= SwTabFrameInvFlags::InvalidatePos;
SwPageFrame *pPage = FindPageFrame();
if (pPage)
{
@@ -3382,23 +3382,23 @@ void SwTabFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
break;
case RES_BREAK:
- rInvFlags |= 0xC0;
+ rInvFlags |= SwTabFrameInvFlags::InvalidatePos | SwTabFrameInvFlags::InvalidateNextPos;
break;
case RES_LAYOUT_SPLIT:
if ( !IsFollow() )
- rInvFlags |= 0x40;
+ rInvFlags |= SwTabFrameInvFlags::InvalidatePos;
break;
case RES_FRAMEDIR :
SetDerivedR2L( false );
CheckDirChange();
break;
case RES_COLLAPSING_BORDERS :
- rInvFlags |= 0x02;
+ rInvFlags |= SwTabFrameInvFlags::InvalidatePrt;
lcl_InvalidateAllLowersPrt( this );
break;
case RES_UL_SPACE:
- rInvFlags |= 0x1C;
+ rInvFlags |= SwTabFrameInvFlags::InvalidateIndNextPrt | SwTabFrameInvFlags::InvalidatePrevPrt | SwTabFrameInvFlags::SetIndNextCompletePaint;
[[fallthrough]];
default:
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index a7506ca9a13a..2ce4542351bd 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2124,11 +2124,11 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
//ContentRects to Start- and EndFrames.
SwRect aStRect, aEndRect;
pStartFrame->GetCharRect( aStRect, *pStartPos, &aTmpState );
- std::unique_ptr<Sw2LinesPos> pSt2Pos = std::move(aTmpState.m_p2Lines);
+ std::optional<Sw2LinesPos> pSt2Pos = std::move(aTmpState.m_x2Lines);
aTmpState.m_nCursorBidiLevel = pEndFrame->IsRightToLeft() ? 1 : 0;
pEndFrame->GetCharRect( aEndRect, *pEndPos, &aTmpState );
- std::unique_ptr<Sw2LinesPos> pEnd2Pos = std::move(aTmpState.m_p2Lines);
+ std::optional<Sw2LinesPos> pEnd2Pos = std::move(aTmpState.m_x2Lines);
SwRect aStFrame ( pStartFrame->UnionFrame( true ) );
aStFrame.Intersection( pStartFrame->GetPaintArea() );
@@ -2145,7 +2145,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
// If there's no doubleline portion involved or start and end are both
// in the same doubleline portion, all works fine, but otherwise
// we need the following...
- if( pSt2Pos != pEnd2Pos && ( !pSt2Pos || !pEnd2Pos ||
+ if( (pSt2Pos || pEnd2Pos) && ( !pSt2Pos || !pEnd2Pos ||
pSt2Pos->aPortion != pEnd2Pos->aPortion ) )
{
// If we have a start(end) position inside a doubleline portion
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index ca8cc3c8ef9b..4e8fb2e1fa1f 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2337,7 +2337,7 @@ void SwContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
if(!pLegacy)
return;
- sal_uInt8 nInvFlags = 0;
+ SwContentFrameInvFlags eInvFlags = SwContentFrameInvFlags::NONE;
if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which() && pLegacy->m_pOld)
{
auto& rOldSetChg = *static_cast<const SwAttrSetChg*>(pLegacy->m_pOld);
@@ -2350,7 +2350,7 @@ void SwContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
SwAttrSetChg aNewSet(rNewSetChg);
do
{
- UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+ UpdateAttr_(pOItem, pNItem, eInvFlags, &aOldSet, &aNewSet);
pNItem = aNIter.NextItem();
pOItem = aOIter.NextItem();
} while(pNItem);
@@ -2358,20 +2358,20 @@ void SwContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
SwFrame::SwClientNotify(rMod, sw::LegacyModifyHint(&aOldSet, &aNewSet));
}
else
- UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
+ UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, eInvFlags);
- if(nInvFlags == 0)
+ if(eInvFlags == SwContentFrameInvFlags::NONE)
return;
SwPageFrame* pPage = FindPageFrame();
InvalidatePage(pPage);
- if(nInvFlags & 0x01)
+ if(eInvFlags & SwContentFrameInvFlags::SetCompletePaint)
SetCompletePaint();
- if(nInvFlags & 0x02)
+ if(eInvFlags & SwContentFrameInvFlags::InvalidatePos)
InvalidatePos_();
- if(nInvFlags & 0x04 )
+ if(eInvFlags & SwContentFrameInvFlags::InvalidateSize)
InvalidateSize_();
- if(nInvFlags & 0x88)
+ if(eInvFlags & (SwContentFrameInvFlags::InvalidateSectPrt | SwContentFrameInvFlags::SetNextCompletePaint))
{
if(IsInSct() && !GetPrev())
{
@@ -2385,16 +2385,16 @@ void SwContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
InvalidatePrt_();
}
SwFrame* pNextFrame = GetIndNext();
- if(pNextFrame && nInvFlags & 0x10)
+ if(pNextFrame && eInvFlags & SwContentFrameInvFlags::InvalidateNextPrt)
{
pNextFrame->InvalidatePrt_();
pNextFrame->InvalidatePage(pPage);
}
- if(pNextFrame && nInvFlags & 0x80)
+ if(pNextFrame && eInvFlags & SwContentFrameInvFlags::SetNextCompletePaint)
{
pNextFrame->SetCompletePaint();
}
- if(nInvFlags & 0x20)
+ if(eInvFlags & SwContentFrameInvFlags::InvalidatePrevPrt)
{
SwFrame* pPrevFrame = GetPrev();
if(pPrevFrame)
@@ -2403,12 +2403,12 @@ void SwContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
pPrevFrame->InvalidatePage(pPage);
}
}
- if(nInvFlags & 0x40)
+ if(eInvFlags & SwContentFrameInvFlags::InvalidateNextPos)
InvalidateNextPos();
}
void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pNew,
- sal_uInt8 &rInvFlags,
+ SwContentFrameInvFlags &rInvFlags,
SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
{
bool bClear = true;
@@ -2416,13 +2416,20 @@ void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pN
switch ( nWhich )
{
case RES_FMT_CHG:
- rInvFlags = 0xFF;
+ rInvFlags = SwContentFrameInvFlags::SetCompletePaint
+ | SwContentFrameInvFlags::InvalidatePos
+ | SwContentFrameInvFlags::InvalidateSize
+ | SwContentFrameInvFlags::InvalidateSectPrt
+ | SwContentFrameInvFlags::InvalidateNextPrt
+ | SwContentFrameInvFlags::InvalidatePrevPrt
+ | SwContentFrameInvFlags::InvalidateNextPos
+ | SwContentFrameInvFlags::SetNextCompletePaint;
[[fallthrough]];
case RES_PAGEDESC: //attribute changes (on/off)
if ( IsInDocBody() && !IsInTab() )
{
- rInvFlags |= 0x02;
+ rInvFlags |= SwContentFrameInvFlags::InvalidatePos;
SwPageFrame *pPage = FindPageFrame();
if ( !GetPrev() )
CheckPageDescs( pPage );
@@ -2466,7 +2473,7 @@ void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pN
GetIndNext()->InvalidateObjs();
}
Prepare( PrepareHint::ULSpaceChanged ); //TextFrame has to correct line spacing.
- rInvFlags |= 0x80;
+ rInvFlags |= SwContentFrameInvFlags::SetNextCompletePaint;
[[fallthrough]];
}
case RES_LR_SPACE:
@@ -2476,17 +2483,17 @@ void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pN
Prepare( PrepareHint::FixSizeChanged );
SwModify aMod;
SwFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew));
- rInvFlags |= 0x30;
+ rInvFlags |= SwContentFrameInvFlags::InvalidateNextPrt | SwContentFrameInvFlags::InvalidatePrevPrt;
break;
}
case RES_BREAK:
{
- rInvFlags |= 0x42;
+ rInvFlags |= SwContentFrameInvFlags::InvalidatePos | SwContentFrameInvFlags::InvalidateNextPos;
const IDocumentSettingAccess& rIDSA = GetUpper()->GetFormat()->getIDocumentSettingAccess();
if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) ||
rIDSA.get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) )
{
- rInvFlags |= 0x1;
+ rInvFlags |= SwContentFrameInvFlags::SetCompletePaint;
SwFrame* pNxt = FindNext();
if( pNxt )
{
@@ -2511,7 +2518,7 @@ void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pN
// OD 2004-02-26 #i25029#
case RES_PARATR_CONNECT_BORDER:
{
- rInvFlags |= 0x01;
+ rInvFlags |= SwContentFrameInvFlags::SetCompletePaint;
if ( IsTextFrame() )
{
InvalidateNextPrtArea();
@@ -2534,11 +2541,11 @@ void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pN
case RES_CHRATR_ESCAPEMENT:
case RES_CHRATR_CONTOUR:
case RES_PARATR_NUMRULE:
- rInvFlags |= 0x01;
+ rInvFlags |= SwContentFrameInvFlags::SetCompletePaint;
break;
case RES_FRM_SIZE:
- rInvFlags |= 0x01;
+ rInvFlags |= SwContentFrameInvFlags::SetCompletePaint;
[[fallthrough]];
default:
@@ -3412,10 +3419,10 @@ void SwLayoutFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBord
}
}
- const sal_uInt16 nLeft = static_cast<sal_uInt16>(pAttrs->CalcLeft(this));
+ const sal_uInt16 nLeft = o3tl::narrowing<sal_uInt16>(pAttrs->CalcLeft(this));
const sal_uInt16 nUpper = bHideWhitespace ? 0 : pAttrs->CalcTop();
- const sal_uInt16 nRight = static_cast<sal_uInt16>(pAttrs->CalcRight(this));
+ const sal_uInt16 nRight = o3tl::narrowing<sal_uInt16>(pAttrs->CalcRight(this));
const sal_uInt16 nLower = bHideWhitespace ? 0 : pAttrs->CalcBottom();
const bool bVert = IsVertical() && !IsPageFrame();
@@ -4233,14 +4240,11 @@ static void AddRemoveFlysForNode(
if (pSkipped)
{
// if a fly has been added by AppendObjsOfNode, it must be skipped; if not, then it doesn't matter if it's skipped or not because it has no frames and because of that it would be skipped anyway
- if (auto const pFlys = pNode->GetAnchoredFlys())
+ for (auto const pFly : pNode->GetAnchoredFlys())
{
- for (auto const pFly : *pFlys)
+ if (pFly->Which() != RES_DRAWFRMFMT)
{
- if (pFly->Which() != RES_DRAWFRMFMT)
- {
- pSkipped->insert(pFly->GetContent().GetContentIdx()->GetIndex());
- }
+ pSkipped->insert(pFly->GetContent().GetContentIdx()->GetIndex());
}
}
}
@@ -4411,12 +4415,9 @@ static void UnHideRedlines(SwRootFrame & rLayout,
{
sw::RemoveFootnotesForNode(rLayout, *pNode->GetTextNode(), nullptr);
// similarly, remove the anchored flys
- if (auto const pFlys = pNode->GetAnchoredFlys())
+ for (SwFrameFormat * pFormat : pNode->GetAnchoredFlys())
{
- for (SwFrameFormat * pFormat : *pFlys)
- {
- pFormat->DelFrames(/*&rLayout*/);
- }
+ pFormat->DelFrames(/*&rLayout*/);
}
}
}
diff --git a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx
index 50b2b9eb65f5..b6a2d091e7bd 100644
--- a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx
@@ -140,7 +140,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition()
// left difference is only considered, if requested.
if( !IsObjFly() )
{
- SwRect aSnapRect = GetObject().GetSnapRect();
+ SwRect aSnapRect(GetObject().GetSnapRect());
if ( rAnchorFrame.IsVertical() )
{
rAnchorFrame.SwitchVerticalToHorizontal( aSnapRect );
@@ -237,7 +237,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition()
// move drawing object to set its correct relative position.
{
- SwRect aSnapRect = GetObject().GetSnapRect();
+ SwRect aSnapRect(GetObject().GetSnapRect());
if ( rAnchorFrame.IsVertical() )
rAnchorFrame.SwitchVerticalToHorizontal( aSnapRect );
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 85592b9a7458..a2506f59bd7c 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -1062,7 +1062,7 @@ SwTableBox& SwTableBox::FindEndOfRowSpan( const SwTable& rTable, sal_uInt16 nMax
return *this;
if( nMaxStep > --nAbsSpan )
- nMaxStep = static_cast<sal_uInt16>(nAbsSpan);
+ nMaxStep = o3tl::narrowing<sal_uInt16>(nAbsSpan);
const SwTableLine* pMyUpper = GetUpper();
sal_uInt16 nLine = rTable.GetTabLines().GetPos( pMyUpper );
nMaxStep = nLine + nMaxStep;
@@ -1388,7 +1388,7 @@ static sal_uInt16 lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes
nSpan = 0;
else if( nSpan )
{
- sal_uInt16 nEndOfRowSpan = static_cast<sal_uInt16>(nPos + nRowSpan - 1);
+ sal_uInt16 nEndOfRowSpan = o3tl::narrowing<sal_uInt16>(nPos + nRowSpan - 1);
if( nEndOfRowSpan > nSpan || nSpan == USHRT_MAX )
nSpan = nEndOfRowSpan;
}
@@ -2101,7 +2101,7 @@ void SwTable::CleanUpBottomRowSpan( sal_uInt16 nDelLines )
if( nRowSp > 1 )
{
lcl_ChangeRowSpan( *this, -static_cast<tools::Long>(nDelLines),
- static_cast<sal_uInt16>(nLastLine), false );
+ o3tl::narrowing<sal_uInt16>(nLastLine), false );
break;
}
}
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 65f39748fd34..64632d69e583 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -717,7 +717,7 @@ static void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm )
SwTableBoxes& rTableBoxes = pBox->GetUpper()->GetTabBoxes();
if( nPos && rTableBoxes[ nPos - 1 ]->getRowSpan() != 1 )
nLeftDiff = 0;
- if( nPos + 1 < static_cast<sal_uInt16>(rTableBoxes.size()) &&
+ if( nPos + 1 < o3tl::narrowing<sal_uInt16>(rTableBoxes.size()) &&
rTableBoxes[ nPos + 1 ]->getRowSpan() != 1 )
nRightDiff = 0;
}
@@ -1177,7 +1177,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew,
nOldPos = lcl_MulDiv64<tools::Long>(nOldPos, rParm.nOldWish, nOldWidth);
if( nOldPos != nNewPos && nNewPos > 0 && nOldPos > 0 )
{
- ColChange aChg( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos) );
+ ColChange aChg( o3tl::narrowing<sal_uInt16>(nOldPos), o3tl::narrowing<sal_uInt16>(nNewPos) );
aOldNew.push_back( aChg );
}
}
@@ -1218,7 +1218,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew,
}
aRowSpanPos.clear();
}
- if( nCurr+1 < static_cast<sal_uInt16>(rLines.size()) )
+ if( nCurr+1 < o3tl::narrowing<sal_uInt16>(rLines.size()) )
{
ChangeList aCopy;
sal_uInt16 nPos = 0;
@@ -1236,7 +1236,7 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew,
lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[++j],
rParm.nOldWish, nOldWidth, false );
lcl_AdjustWidthsInLine( rLines[j], aCopy, rParm, 0 );
- bGoOn = !aRowSpanPos.empty() && j+1 < static_cast<sal_uInt16>(rLines.size());
+ bGoOn = !aRowSpanPos.empty() && j+1 < o3tl::narrowing<sal_uInt16>(rLines.size());
}
}
::lcl_AdjustWidthsInLine( rLines[nCurr], aOldNew, rParm, COLFUZZY );
@@ -1305,7 +1305,7 @@ sal_uInt16 SwTable::GetBoxNum( OUString& rStr, bool bFirstPart,
nRet = 0;
if ( !bPerformValidCheck || lcl_IsValidRowName( rStr ) )
{
- nRet = static_cast<sal_uInt16>(rStr.toInt32());
+ nRet = o3tl::narrowing<sal_uInt16>(rStr.toInt32());
}
rStr.clear();
}
@@ -1315,7 +1315,7 @@ sal_uInt16 SwTable::GetBoxNum( OUString& rStr, bool bFirstPart,
const OUString aText( rStr.copy( 0, nPos ) );
if ( !bPerformValidCheck || lcl_IsValidRowName( aText ) )
{
- nRet = static_cast<sal_uInt16>(aText.toInt32());
+ nRet = o3tl::narrowing<sal_uInt16>(aText.toInt32());
}
rStr = rStr.copy( nPos+1 );
}
@@ -1868,6 +1868,21 @@ sal_uLong SwTableBox::GetSttIdx() const
return m_pStartNode ? m_pStartNode->GetIndex() : 0;
}
+bool SwTableBox::IsEmpty() const
+{
+ const SwStartNode *pSttNd = GetSttNd();
+ if( pSttNd &&
+ pSttNd->GetIndex() + 2 == pSttNd->EndOfSectionIndex() )
+ {
+ const SwContentNode *pCNd =
+ pSttNd->GetNodes()[pSttNd->GetIndex()+1]->GetContentNode();
+ if( pCNd && !pCNd->Len() )
+ return true;
+ }
+
+ return false;
+}
+
// retrieve information from the client
bool SwTable::GetInfo( SfxPoolItem& rInfo ) const
{
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 088f21c00b10..f3d9e69ad51b 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -424,7 +424,7 @@ void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const OUS
++m_nEndStructureElement;
#if OSL_DEBUG_LEVEL > 1
- aStructStack.push_back( static_cast<sal_uInt16>(eType) );
+ aStructStack.push_back( o3tl::narrowing<sal_uInt16>(eType) );
#endif
// Store the id of the current structure element if
@@ -1117,7 +1117,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
int nRealLevel = pTextNd->GetAttrOutlineLevel()-1;
nRealLevel = std::min(nRealLevel, 5);
- nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel);
+ nPDFType = o3tl::narrowing<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel);
switch(nRealLevel)
{
case 0 :
@@ -1808,7 +1808,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Turn media shapes into Screen annotations.
if (SdrObject* pObject = pFrameFormat->FindRealSdrObject())
{
- SwRect aSnapRect = pObject->GetSnapRect();
+ SwRect aSnapRect(pObject->GetSnapRect());
std::vector<sal_Int32> aScreenPageNums = CalcOutputPageNums(aSnapRect);
if (aScreenPageNums.empty())
continue;
@@ -1969,39 +1969,35 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Goto footnote text:
if ( mrSh.GotoFootnoteText() )
{
- // Link PageNums
- std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( aLinkRect );
-
// Destination Rectangle
const SwRect& rDestRect = mrSh.GetCharRect();
+ const sal_Int32 nDestPageNum = CalcOutputPageNum( rDestRect );
+ if ( -1 != nDestPageNum )
+ {
+ const SwPageFrame* pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
+ // Destination PageNum
+ tools::Rectangle aRect = SwRectToPDFRect(pCurrPage, rDestRect.SVRect());
+ // Destination Export
+ const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest(aRect, nDestPageNum);
+ mrSh.GotoFootnoteAnchor();
- const SwPageFrame* pCurrPage =
- static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
+ // Link PageNums
+ sal_Int32 aLinkPageNum = CalcOutputPageNum( aLinkRect );
- // Destination PageNum
- const sal_Int32 nDestPageNum = CalcOutputPageNum( rDestRect );
+ pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
- for (sal_Int32 aLinkPageNum : aLinkPageNums)
- {
// Link Export
- tools::Rectangle aRect(SwRectToPDFRect(pCurrPage, aLinkRect.SVRect()));
- const sal_Int32 nLinkId =
- pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
+ aRect = SwRectToPDFRect(pCurrPage, aLinkRect.SVRect());
+ const sal_Int32 nLinkId = pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
// Store link info for tagged pdf output:
const IdMapEntry aLinkEntry( aLinkRect, nLinkId );
s_aLinkIdMap.push_back( aLinkEntry );
- if ( -1 != nDestPageNum )
- {
- aRect = SwRectToPDFRect(pCurrPage, rDestRect.SVRect());
- // Destination Export
- const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest(rDestRect.SVRect(), nDestPageNum);
-
- // Connect Link and Destination:
- pPDFExtOutDevData->SetLinkDest( nLinkId, nDestId );
- }
+ // Connect Link and Destination:
+ pPDFExtOutDevData->SetLinkDest( nLinkId, nDestId );
}
+
}
}
diff --git a/sw/source/core/text/SwGrammarMarkUp.cxx b/sw/source/core/text/SwGrammarMarkUp.cxx
index 3a007ce055d2..53fd4b13c013 100644
--- a/sw/source/core/text/SwGrammarMarkUp.cxx
+++ b/sw/source/core/text/SwGrammarMarkUp.cxx
@@ -54,9 +54,9 @@ void SwGrammarMarkUp::MoveGrammar( sal_Int32 nPos, sal_Int32 nDiff )
}
}
-SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( sal_Int32 nSplitPos )
+std::unique_ptr<SwGrammarMarkUp> SwGrammarMarkUp::SplitGrammarList( sal_Int32 nSplitPos )
{
- SwGrammarMarkUp* pNew = static_cast<SwGrammarMarkUp*>(SplitList( nSplitPos ));
+ std::unique_ptr<SwGrammarMarkUp> pNew( static_cast<SwGrammarMarkUp*>(SplitList( nSplitPos ).release()) );
if( maSentence.empty() )
return pNew;
auto pIter = std::find_if(maSentence.begin(), maSentence.end(),
@@ -64,7 +64,7 @@ SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( sal_Int32 nSplitPos )
if( pIter != maSentence.begin() )
{
if( !pNew ) {
- pNew = new SwGrammarMarkUp();
+ pNew.reset(new SwGrammarMarkUp());
pNew->SetInvalid( 0, COMPLETE_STRING );
}
pNew->maSentence.insert( pNew->maSentence.begin(), maSentence.begin(), pIter );
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index a4cab82d92b1..9ea484912cff 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -307,10 +307,10 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
{
if ( pFrame->IsRightToLeft() )
{
- if( pCMS->m_b2Lines && pCMS->m_p2Lines)
+ if( pCMS->m_b2Lines && pCMS->m_x2Lines)
{
- pFrame->SwitchLTRtoRTL( pCMS->m_p2Lines->aLine );
- pFrame->SwitchLTRtoRTL( pCMS->m_p2Lines->aPortion );
+ pFrame->SwitchLTRtoRTL( pCMS->m_x2Lines->aLine );
+ pFrame->SwitchLTRtoRTL( pCMS->m_x2Lines->aPortion );
}
}
@@ -327,10 +327,10 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
pCMS->m_aRealHeight.Y() );
}
}
- if( pCMS->m_b2Lines && pCMS->m_p2Lines)
+ if( pCMS->m_b2Lines && pCMS->m_x2Lines)
{
- pFrame->SwitchHorizontalToVertical( pCMS->m_p2Lines->aLine );
- pFrame->SwitchHorizontalToVertical( pCMS->m_p2Lines->aPortion );
+ pFrame->SwitchHorizontalToVertical( pCMS->m_x2Lines->aLine );
+ pFrame->SwitchHorizontalToVertical( pCMS->m_x2Lines->aPortion );
}
}
@@ -590,7 +590,7 @@ bool SwTextFrame::GetModelPositionForViewPoint_(SwPosition* pPos, const Point& r
// See comment in AdjustFrame()
SwTwips nMaxY = getFrameArea().Top() + getFramePrintArea().Top() + getFramePrintArea().Height();
aLine.TwipsToLine( rPoint.Y() );
- while( aLine.Y() + aLine.GetLineHeight() > nMaxY )
+ while( aLine.Y() + o3tl::narrowing<SwTwips>(aLine.GetLineHeight()) > nMaxY )
{
if( !aLine.Prev() )
break;
@@ -1418,7 +1418,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
if( nDiff > 0 )
{
nDiff /= nDist;
- rFill.Fill().nParaCnt = static_cast<sal_uInt16>(nDiff + 1);
+ rFill.Fill().nParaCnt = o3tl::narrowing<sal_uInt16>(nDiff + 1);
rFill.nLineWidth = 0;
rFill.bInner = false;
rFill.bEmpty = true;
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 0304661e8438..82f2a8dcd893 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -517,9 +517,6 @@ void SwTextFrame::AdjustFrame( const SwTwips nChgHght, bool bHasToFit )
css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips CurrentPos )
{
- css::uno::Sequence< css::style::TabStop > tabs(1);
- css::style::TabStop ts;
-
SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this );
SwTextFormatter aLine( this, &aInf );
SwTextCursor TextCursor( this, &aInf );
@@ -533,10 +530,11 @@ css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips C
if( !pTS )
{
- return css::uno::Sequence< css::style::TabStop >();
+ return {};
}
// copy tab stop information into a Sequence, which only contains one element.
+ css::style::TabStop ts;
ts.Position = pTS->GetTabPos();
ts.DecimalChar = pTS->GetDecimal();
ts.FillChar = pTS->GetFill();
@@ -550,8 +548,7 @@ css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips C
default: break; // prevent warning
}
- tabs[0] = ts;
- return tabs;
+ return { ts };
}
// AdjustFollow expects the following situation:
@@ -987,7 +984,7 @@ bool SwTextFrame::CalcPreps()
return bRet;
}
-// We rewire the footnotes and the character bound objects
+// Move the as-character objects - footnotes must be moved by RemoveFootnote!
void SwTextFrame::ChangeOffset( SwTextFrame* pFrame, TextFrameIndex nNew )
{
if( pFrame->GetOffset() < nNew )
@@ -1082,6 +1079,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
// need to create a Follow.
// We also need to do this if the whole mass of text remains in the Master,
// because a hard line break could necessitate another line (without text mass)!
+ TextFrameIndex const nOld(nEnd);
nEnd = rLine.GetEnd();
if( GetFollow() )
{
@@ -1107,6 +1105,13 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
// for the paragraph mark.
nNew |= 1;
}
+ // move footnotes if the follow is kept - if RemoveFootnote() is
+ // called in next format iteration, it will be with the *new*
+ // offset so no effect!
+ if (nNew && nOld < nEnd)
+ {
+ RemoveFootnote(nOld, nEnd - nOld);
+ }
ChangeOffset( GetFollow(), nEnd );
GetFollow()->ManipOfst( nEnd );
}
@@ -1177,8 +1182,8 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
const SwLineLayout *pOldCur = rLine.GetCurr();
const TextFrameIndex nOldLen = pOldCur->GetLen();
- const sal_uInt16 nOldAscent = pOldCur->GetAscent();
- const sal_uInt16 nOldHeight = pOldCur->Height();
+ const sal_uInt32 nOldAscent = pOldCur->GetAscent();
+ const sal_uInt32 nOldHeight = pOldCur->Height();
const SwTwips nOldWidth = pOldCur->Width() + pOldCur->GetHangingMargin();
const bool bOldHyph = pOldCur->IsEndHyph();
SwTwips nOldTop = 0;
@@ -1200,7 +1205,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
bOldHyph == pNew->IsEndHyph();
if ( bUnChg && !bPrev )
{
- const tools::Long nWidthDiff = nOldWidth > pNew->Width()
+ const tools::Long nWidthDiff = nOldWidth > o3tl::narrowing<SwTwips>(pNew->Width())
? nOldWidth - pNew->Width()
: pNew->Width() - nOldWidth;
@@ -1254,7 +1259,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
rLine.SetUnclipped( false );
}
}
- SwTwips nRght = std::max( nOldWidth, pNew->Width() +
+ SwTwips nRght = std::max( nOldWidth, o3tl::narrowing<SwTwips>(pNew->Width()) +
pNew->GetHangingMargin() );
SwViewShell *pSh = getRootFrame()->GetCurrShell();
const SwViewOption *pOpt = pSh ? pSh->GetViewOptions() : nullptr;
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 7f35ea7633b6..76630fc573f6 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -356,7 +356,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
SwTextPainter aLine( const_cast<SwTextFrame*>(this), &aInf );
bool bNoDummy = !aLine.GetNext(); // Only one empty line!
- while( aLine.Y() + aLine.GetLineHeight() <= rRect.Top() )
+ while( aLine.Y() + o3tl::narrowing<SwTwips>(aLine.GetLineHeight()) <= rRect.Top() )
{
if( !aLine.GetCurr()->IsDummy() &&
( rLineInf.IsCountBlankLines() ||
@@ -398,7 +398,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
bool bNum = bLineNum && ( aExtra.HasNumber() || aExtra.HasDivider() );
if( bRedInMargin || bNum )
{
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
aLine.CalcAscentAndHeight( nTmpAscent, nTmpHeight );
if ( bRedInMargin )
{
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index bb63a36ae157..f43f811bd744 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -426,7 +426,7 @@ void SwTextSizeInfo::GetTextSize( const SwScriptInfo* pSI, const TextFrameIndex
aDrawInf.SetSnapToGrid( SnapToGrid() );
aDrawInf.SetKanaComp( nComp );
SwPosSize aSize( m_pFnt->GetTextSize_( aDrawInf ) );
- nMaxSizeDiff = static_cast<sal_uInt16>(aDrawInf.GetKanaDiff());
+ nMaxSizeDiff = o3tl::narrowing<sal_uInt16>(aDrawInf.GetKanaDiff());
nMinSize = aSize.Width();
}
@@ -955,7 +955,7 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rTextPaintInfo, const SwLine
Point aTmpPos( nX, nY );
rNonConstTextPaintInfo.SetPos( aTmpPos );
sal_uInt16 nOldWidth = rPor.Width();
- const_cast<SwLinePortion&>(rPor).Width( static_cast<sal_uInt16>(aFontSize.Width()) );
+ const_cast<SwLinePortion&>(rPor).Width( o3tl::narrowing<sal_uInt16>(aFontSize.Width()) );
rTextPaintInfo.DrawText( aTmp, rPor );
const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
rNonConstTextPaintInfo.SetFont( const_cast<SwFont*>(pOldFnt) );
@@ -1023,13 +1023,13 @@ void SwTextPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const
{
aRect.Pos().AdjustY(20 - GetAscent() );
aRect.Pos().AdjustX(20 );
- if( aSize.Height() > rPor.Height() )
+ if( aSize.Height() > o3tl::narrowing<SwTwips>(rPor.Height()) )
aRect.Height( rPor.Height() );
cChar = CHAR_LEFT_ARROW;
}
else
{
- if( aSize.Height() > rPor.Height() )
+ if( aSize.Height() > o3tl::narrowing<SwTwips>(rPor.Height()) )
aRect.Height( rPor.Height() );
aRect.Pos().AdjustY( -(aRect.Height() + 20) );
aRect.Pos().AdjustX( -(aRect.Width() + 20) );
@@ -1089,8 +1089,7 @@ void SwTextPaintInfo::DrawPostIts( bool bScript ) const
if ( GetTextFrame()->IsVertical() )
GetTextFrame()->SwitchHorizontalToVertical( aTmpRect );
- const tools::Rectangle aRect( aTmpRect.SVRect() );
- SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aRect, bScript );
+ SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aTmpRect, bScript );
}
@@ -1125,7 +1124,7 @@ void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool
m_pOut->Pop();
}
-void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
+void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor, const Color *pColor ) const
{
OSL_ENSURE( OnWin(), "SwTextPaintInfo::DrawBackground: printer pollution ?" );
@@ -1145,7 +1144,11 @@ void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
}
else
{
- pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+ if ( pColor )
+ pOut->SetFillColor( *pColor );
+ else
+ pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+
pOut->SetLineColor();
}
@@ -1313,7 +1316,7 @@ void SwTextPaintInfo::DrawBorder( const SwLinePortion &rPor ) const
}
void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
- PortionType nWhich ) const
+ PortionType nWhich, const Color *pColor ) const
{
if( !OnWin() || IsMulti() )
return;
@@ -1366,7 +1369,7 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
}
}
if ( bDraw )
- DrawBackground( rPor );
+ DrawBackground( rPor, pColor );
}
static void lcl_InitHyphValues( PropertyValues &rVals,
@@ -1758,7 +1761,9 @@ SwTwips SwTextFormatInfo::GetLineWidth()
const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
DocumentSettingId::TAB_OVER_MARGIN);
- if (!bTabOverMargin)
+ const bool bTabOverSpacing = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
+ DocumentSettingId::TAB_OVER_SPACING);
+ if (!bTabOverMargin && !bTabOverSpacing)
return nLineWidth;
SwTabPortion* pLastTab = GetLastTab();
@@ -1789,6 +1794,12 @@ SwTwips SwTextFormatInfo::GetLineWidth()
// text frame area to the right (RR above, but not LL).
nLineWidth = nTextFrameWidth - X();
+ if (!bTabOverMargin) // thus bTabOverSpacing only
+ {
+ // right, center, decimal can back-fill all the available space - same as TabOverMargin
+ if (pLastTab->GetWhichPor() == PortionType::TabLeft)
+ nLineWidth = nTextFrameWidth - pLastTab->GetTabPos();
+ }
return nLineWidth;
}
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index bb245d5b031f..19d730d02e5c 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <memory>
+#include <optional>
#include <com/sun/star/beans/PropertyValues.hpp>
#include <map>
@@ -187,7 +188,7 @@ public:
// GetMultiAttr returns the text attribute of the multiportion,
// if rPos is inside any multi-line part.
// rPos will set to the end of the multi-line part.
- std::unique_ptr<SwMultiCreator> GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const* pM) const;
+ std::optional<SwMultiCreator> GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const* pM) const;
bool OnWin() const { return m_bOnWin; }
void SetOnWin( const bool bNew ) { m_bOnWin = bNew; }
@@ -399,8 +400,8 @@ public:
void DrawLineBreak( const SwLinePortion &rPor ) const;
void DrawRedArrow( const SwLinePortion &rPor ) const;
void DrawPostIts( bool bScript ) const;
- void DrawBackground( const SwLinePortion &rPor ) const;
- void DrawViewOpt( const SwLinePortion &rPor, PortionType nWhich ) const;
+ void DrawBackground( const SwLinePortion &rPor, const Color *pColor=nullptr ) const;
+ void DrawViewOpt( const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr ) const;
void DrawBackBrush( const SwLinePortion &rPor ) const;
/**
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index a5944e49e357..8e7514cf9be3 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -488,7 +488,7 @@ SwTwips SwTextAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
else
nCompress = 10000 - nCompress;
- ( pCurrent->GetKanaComp() )[ nKanaIdx ] = static_cast<sal_uInt16>(nCompress);
+ ( pCurrent->GetKanaComp() )[ nKanaIdx ] = o3tl::narrowing<sal_uInt16>(nCompress);
nKanaDiffSum = 0;
}
@@ -524,7 +524,7 @@ SwTwips SwTextAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
}
else if( pPos->InGlueGrp() && pPos->InFixMargGrp() )
{
- pPos->Width( static_cast<sal_uInt16>(pPos->Width() - nDecompress) );
+ pPos->Width( o3tl::narrowing<sal_uInt16>(pPos->Width() - nDecompress) );
if ( pPos->InTabGrp() )
// set fix width to width
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index a0ae8073c27b..9571324f8dbe 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -1009,7 +1009,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
SwViewShell const * pSh = GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
OutputDevice* pOut = nullptr;
if( pSh )
- pOut = pSh->GetWin();
+ pOut = pSh->GetWin()->GetOutDev();
if( !pOut )
pOut = Application::GetDefaultDevice();
@@ -1432,7 +1432,7 @@ sal_uInt16 SwTextFrame::GetScalingOfSelectedText(
SwTextIter aLine(this, &aInf);
aLine.CharToLine( nStart );
pOut->SetMapMode( aOldMap );
- return static_cast<sal_uInt16>( nWidth ?
+ return o3tl::narrowing<sal_uInt16>( nWidth ?
( ( 100 * aLine.GetCurr()->Height() ) / nWidth ) : 0 );
}
// no frame or no paragraph, we take the height of the character
@@ -1442,7 +1442,7 @@ sal_uInt16 SwTextFrame::GetScalingOfSelectedText(
pOut->SetMapMode( aOldMap );
SwDrawTextInfo aDrawInf(pSh, *pOut, GetText(), sal_Int32(nStart), 1);
- return static_cast<sal_uInt16>( nWidth ? ((100 * aIter.GetFnt()->GetTextSize_( aDrawInf ).Height()) / nWidth ) : 0 );
+ return o3tl::narrowing<sal_uInt16>( nWidth ? ((100 * aIter.GetFnt()->GetTextSize_( aDrawInf ).Height()) / nWidth ) : 0 );
}
SwTwips SwTextNode::GetWidthOfLeadingTabs() const
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index f7c6380cb3bb..2974826154bb 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -142,7 +142,7 @@ namespace {
nListLevel = MAXLEVEL - 1;
const SwNumFormat& rNumFormat =
- rTextNode.GetNumRule()->Get( static_cast<sal_uInt16>(nListLevel) );
+ rTextNode.GetNumRule()->Get( o3tl::narrowing<sal_uInt16>(nListLevel) );
if ( rNumFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
bRet = true;
@@ -428,7 +428,7 @@ void SwTextCursor::GetEndCharRect(SwRect* pOrig, const TextFrameIndex nOfst,
tools::Long nLast = 0;
SwLinePortion *pPor = m_pCurr->GetFirstPortion();
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
sal_uInt16 nPorHeight = nTmpHeight;
sal_uInt16 nPorAscent = nTmpAscent;
@@ -479,7 +479,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
SwTextSizeInfo aInf( GetInfo(), &aText, m_nStart );
if( GetPropFont() )
aInf.GetFont()->SetProportion( GetPropFont() );
- sal_uInt16 nTmpAscent, nTmpHeight; // Line height
+ sal_uInt32 nTmpAscent, nTmpHeight; // Line height
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
const Size aCharSize( 1, nTmpHeight );
const Point aCharPos;
@@ -505,8 +505,8 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
}
else
{
- sal_uInt16 nPorHeight = nTmpHeight;
- sal_uInt16 nPorAscent = nTmpAscent;
+ sal_uInt32 nPorHeight = nTmpHeight;
+ sal_uInt32 nPorAscent = nTmpAscent;
SwTwips nX = 0;
SwTwips nTmpFirst = 0;
SwLinePortion *pPor = m_pCurr->GetFirstPortion();
@@ -676,26 +676,26 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
if( pCMS && pCMS->m_b2Lines )
{
- const bool bRecursion (pCMS->m_p2Lines);
+ const bool bRecursion (pCMS->m_x2Lines);
if ( !bRecursion )
{
- pCMS->m_p2Lines.reset(new Sw2LinesPos);
- pCMS->m_p2Lines->aLine = SwRect(aCharPos, aCharSize);
+ pCMS->m_x2Lines = Sw2LinesPos();
+ pCMS->m_x2Lines->aLine = SwRect(aCharPos, aCharSize);
}
if( static_cast<SwMultiPortion*>(pPor)->HasRotation() )
{
if( static_cast<SwMultiPortion*>(pPor)->IsRevers() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::ROT_270;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::ROT_270;
else
- pCMS->m_p2Lines->nMultiType = MultiPortionType::ROT_90;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::ROT_90;
}
else if( static_cast<SwMultiPortion*>(pPor)->IsDouble() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::TWOLINE;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::TWOLINE;
else if( static_cast<SwMultiPortion*>(pPor)->IsBidi() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::BIDI;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::BIDI;
else
- pCMS->m_p2Lines->nMultiType = MultiPortionType::RUBY;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::RUBY;
SwTwips nTmpWidth = pPor->Width();
if( nSpaceAdd )
@@ -705,9 +705,9 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
Size( nTmpWidth, pPor->Height() ) );
if ( ! bRecursion )
- pCMS->m_p2Lines->aPortion = aRect;
+ pCMS->m_x2Lines->aPortion = aRect;
else
- pCMS->m_p2Lines->aPortion2 = aRect;
+ pCMS->m_x2Lines->aPortion2 = aRect;
}
// In a multi-portion we use GetCharRect()-function
@@ -1051,7 +1051,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
nPorHeight = nPorAscent;
pOrig->Height( nPorHeight +
static_cast<SwDropPortion*>(pPor)->GetDropDescent() );
- if( nTmpHeight < pOrig->Height() )
+ if( o3tl::narrowing<SwTwips>(nTmpHeight) < pOrig->Height() )
{
nTmpAscent = nPorAscent;
nTmpHeight = sal_uInt16( pOrig->Height() );
@@ -1215,15 +1215,17 @@ void SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst,
pOrig->Pos().AdjustX(aCharPos.X() );
pOrig->Pos().AdjustY(aCharPos.Y() );
- if( pCMS && pCMS->m_b2Lines && pCMS->m_p2Lines )
+ if( pCMS && pCMS->m_b2Lines && pCMS->m_x2Lines )
{
- pCMS->m_p2Lines->aLine.Pos().AdjustX(aCharPos.X() );
- pCMS->m_p2Lines->aLine.Pos().AdjustY(aCharPos.Y() );
- pCMS->m_p2Lines->aPortion.Pos().AdjustX(aCharPos.X() );
- pCMS->m_p2Lines->aPortion.Pos().AdjustY(aCharPos.Y() );
+ pCMS->m_x2Lines->aLine.Pos().AdjustX(aCharPos.X() );
+ pCMS->m_x2Lines->aLine.Pos().AdjustY(aCharPos.Y() );
+ pCMS->m_x2Lines->aPortion.Pos().AdjustX(aCharPos.X() );
+ pCMS->m_x2Lines->aPortion.Pos().AdjustY(aCharPos.Y() );
}
- const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN);
+ const IDocumentSettingAccess& rIDSA = GetTextFrame()->GetDoc().getIDocumentSettingAccess();
+ const bool bTabOverMargin = rIDSA.get(DocumentSettingId::TAB_OVER_MARGIN)
+ || rIDSA.get(DocumentSettingId::TAB_OVER_SPACING);
// Make sure the cursor respects the right margin, unless in compat mode, where the tab size has priority over the margin size.
if( pOrig->Left() > nTmpRight && !bTabOverMargin)
pOrig->Pos().setX( nTmpRight );
@@ -1264,7 +1266,7 @@ void SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst,
* Determines if SwTextCursor::GetModelPositionForViewPoint() should consider the next portion when calculating the
* doc model position from a Point.
*/
-static bool ConsiderNextPortionForCursorOffset(const SwLinePortion* pPor, sal_uInt16 nWidth30, sal_uInt16 nX)
+static bool ConsiderNextPortionForCursorOffset(const SwLinePortion* pPor, sal_uInt32 nWidth30, sal_uInt16 nX)
{
if (!pPor->GetNextPortion() || pPor->IsBreakPortion())
{
@@ -1321,7 +1323,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
// Until here everything in document coordinates.
x -= nLeftMargin;
- sal_uInt16 nX = sal_uInt16( x );
+ sal_uInt32 nX = sal_uInt16( x );
// If there are attribute changes in the line, search for the paragraph,
// in which nX is situated.
@@ -1340,7 +1342,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
// nWidth is the width of the line, or the width of
// the paragraph with the font change, in which nX is situated.
- sal_uInt16 nWidth = pPor->Width();
+ sal_uInt32 nWidth = pPor->Width();
if ( m_pCurr->IsSpaceAdd() || pKanaComp )
{
if ( pPor->InSpaceGrp() && nSpaceAdd )
@@ -1370,7 +1372,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
}
}
- sal_uInt16 nWidth30;
+ sal_uInt32 nWidth30;
if ( pPor->IsPostItsPortion() )
nWidth30 = 0;
else
@@ -1625,7 +1627,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
nTmpY = pPor->Height() - nTmpY;
if( nTmpY < 0 )
nTmpY = 0;
- nX = static_cast<sal_uInt16>(nTmpY);
+ nX = o3tl::narrowing<sal_uInt16>(nTmpY);
}
if( static_cast<SwMultiPortion*>(pPor)->HasBrackets() )
@@ -1689,12 +1691,12 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
}
pCurrPart = pCurrPart->GetFollow();
}
- nX = std::max(0, nX - nSumBorderWidth);
+ nX = std::max(o3tl::narrowing<sal_uInt32>(0), nX - nSumBorderWidth);
}
// Shift the offset with the left border width
else if( GetInfo().GetFont()->GetLeftBorder() && !pPor->GetJoinBorderWithPrev() )
{
- nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorderSpace());
+ nX = std::max(o3tl::narrowing<sal_uInt32>(0), nX - GetInfo().GetFont()->GetLeftBorderSpace());
}
aDrawInf.SetOffset( nX );
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index d35159f12d84..8e5a2b403e42 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -54,8 +54,15 @@
#include <IDocumentSettingAccess.hxx>
#include <IMark.hxx>
#include <IDocumentMarkAccess.hxx>
-
-#include <vector>
+#include <comphelper/processfactory.hxx>
+#include <docsh.hxx>
+#include <unocrsrhelper.hxx>
+#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/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/rdf/XLiteral.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
using namespace ::com::sun::star;
@@ -235,7 +242,7 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf )
// line width is adjusted, so that pPor does not fit to current
// line anymore
- rInf.Width( static_cast<sal_uInt16>(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) );
+ rInf.Width( o3tl::narrowing<sal_uInt16>(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) );
rInf.SetLen( pPor->GetLen() );
rInf.SetFull( false );
if( pFly )
@@ -424,7 +431,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
{
SwFontScript nNxtActual = rInf.GetFont()->GetActual();
SwFontScript nLstActual = nNxtActual;
- sal_uInt16 nLstHeight = static_cast<sal_uInt16>(rInf.GetFont()->GetHeight());
+ sal_uInt16 nLstHeight = o3tl::narrowing<sal_uInt16>(rInf.GetFont()->GetHeight());
bool bAllowBehind = false;
const CharClass& rCC = GetAppCharClass();
@@ -467,7 +474,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
if ( pTmpFnt )
{
nLstActual = pTmpFnt->GetActual();
- nLstHeight = static_cast<sal_uInt16>(pTmpFnt->GetHeight());
+ nLstHeight = o3tl::narrowing<sal_uInt16>(pTmpFnt->GetHeight());
}
}
}
@@ -528,7 +535,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
const SwTwips nRestWidth = rInf.Width() - rInf.X();
if ( nKernWidth <= nRestWidth )
- pGridKernPortion->Width( static_cast<sal_uInt16>(nKernWidth) );
+ pGridKernPortion->Width( o3tl::narrowing<sal_uInt16>(nKernWidth) );
}
if ( pGridKernPortion != pPor )
@@ -615,7 +622,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
(m_pScriptInfo->ScriptType(nTmp - TextFrameIndex(1)) == css::i18n::ScriptType::ASIAN ||
m_pScriptInfo->ScriptType(nTmp) == css::i18n::ScriptType::ASIAN) )
{
- const sal_uInt16 nDist = static_cast<sal_uInt16>(rInf.GetFont()->GetHeight()/5);
+ const sal_uInt16 nDist = o3tl::narrowing<sal_uInt16>(rInf.GetFont()->GetHeight()/5);
if( nDist )
{
@@ -670,7 +677,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
0;
const SwTwips nTmpWidth = i * nGridWidth;
const SwTwips nKernWidth = std::min(nTmpWidth - nSumWidth, nRestWidth);
- const sal_uInt16 nKernWidth_1 = static_cast<sal_uInt16>(nKernWidth / 2);
+ const sal_uInt16 nKernWidth_1 = o3tl::narrowing<sal_uInt16>(nKernWidth / 2);
OSL_ENSURE( nKernWidth <= nRestWidth,
"Not enough space left for adjusting non-asian text in grid mode" );
@@ -842,9 +849,11 @@ namespace {
class SwMetaPortion : public SwTextPortion
{
+ Color m_aShadowColor;
public:
SwMetaPortion() { SetWhichPor( PortionType::Meta ); }
virtual void Paint( const SwTextPaintInfo &rInf ) const override;
+ void SetShadowColor(const Color& rCol ) { m_aShadowColor = rCol; }
};
}
@@ -853,7 +862,12 @@ void SwMetaPortion::Paint( const SwTextPaintInfo &rInf ) const
{
if ( Width() )
{
- rInf.DrawViewOpt( *this, PortionType::Meta );
+ rInf.DrawViewOpt( *this, PortionType::Meta,
+ // custom shading (RDF metadata)
+ COL_BLACK == m_aShadowColor
+ ? nullptr
+ : &m_aShadowColor );
+
SwTextPortion::Paint( rInf );
}
}
@@ -919,7 +933,50 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const
pPor = new SwRefPortion;
else if (GetFnt()->IsMeta())
{
- pPor = new SwMetaPortion;
+ auto pMetaPor = new SwMetaPortion;
+
+ // set custom LO_EXT_SHADING color, if it exists
+ SwTextFrame const*const pFrame(rInf.GetTextFrame());
+ SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
+ SwPaM aPam(aPosition);
+ uno::Reference<text::XTextContent> const xRet(
+ SwUnoCursorHelper::GetNestedTextContent(
+ *aPam.GetNode().GetTextNode(), aPosition.nContent.GetIndex(), false) );
+ if (xRet.is())
+ {
+ const SwDoc & rDoc = rInf.GetTextFrame()->GetDoc();
+ static uno::Reference< uno::XComponentContext > xContext(
+ ::comphelper::getProcessComponentContext());
+
+ static uno::Reference< rdf::XURI > xODF_SHADING(
+ rdf::URI::createKnown(xContext, rdf::URIs::LO_EXT_SHADING), uno::UNO_SET_THROW);
+
+ uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(
+ rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+
+ const css::uno::Reference<css::rdf::XResource> xSubject(xRet, uno::UNO_QUERY);
+ const uno::Reference<rdf::XRepository>& xRepository =
+ xDocumentMetadataAccess->getRDFRepository();
+ const uno::Reference<container::XEnumeration> xEnum(
+ xRepository->getStatements(xSubject, xODF_SHADING, nullptr), 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()) {
+ SAL_INFO("sw.uno", "ignoring other odf:shading statements");
+ }
+ Color rColor = Color::STRtoRGB(xObject->getValue());
+ pMetaPor->SetShadowColor(rColor);
+ break;
+ }
+ }
+ pPor = pMetaPor;
}
else
{
@@ -1335,7 +1392,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
// We open a multiportion part, if we enter a multi-line part
// of the paragraph.
TextFrameIndex nEnd = rInf.GetIdx();
- std::unique_ptr<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, m_pMulti );
+ std::optional<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, m_pMulti );
if( pCreate )
{
SwMultiPortion* pTmp = nullptr;
@@ -1431,7 +1488,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
PortionType::TabDecimal == pLastTabPortion->GetWhichPor() )
{
OSL_ENSURE( rInf.X() >= pLastTabPortion->GetFix(), "Decimal tab stop position cannot be calculated" );
- const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = static_cast<sal_uInt16>(rInf.X() - pLastTabPortion->GetFix() );
+ const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = o3tl::narrowing<sal_uInt16>(rInf.X() - pLastTabPortion->GetFix() );
static_cast<SwTabDecimalPortion*>(pLastTabPortion)->SetWidthOfPortionsUpToDecimalPosition( nWidthOfPortionsUpToDecimalPosition );
rInf.SetTabDecimal( 0 );
}
@@ -1574,8 +1631,8 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
// Recycling must be suppressed by changed line height and also
// by changed ascent (lowering of baseline).
- const sal_uInt16 nOldHeight = m_pCurr->Height();
- const sal_uInt16 nOldAscent = m_pCurr->GetAscent();
+ const sal_uInt32 nOldHeight = m_pCurr->Height();
+ const sal_uInt32 nOldAscent = m_pCurr->GetAscent();
m_pCurr->SetEndHyph( false );
m_pCurr->SetMidHyph( false );
@@ -1655,7 +1712,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
if ( IsFlyInCntBase() && (!IsQuick() || (pPorTmp && pPorTmp->IsFlyCntPortion() && !pPorTmp->GetNextPortion() &&
m_pCurr->Height() > pPorTmp->Height())))
{
- sal_uInt16 nTmpAscent, nTmpHeight;
+ sal_uInt32 nTmpAscent, nTmpHeight;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
AlignFlyInCntBase( Y() + tools::Long( nTmpAscent ) );
m_pCurr->CalcLine( *this, GetInfo() );
@@ -1772,7 +1829,7 @@ void SwTextFormatter::RecalcRealHeight()
void SwTextFormatter::CalcRealHeight( bool bNewLine )
{
- sal_uInt16 nLineHeight = m_pCurr->Height();
+ sal_uInt32 nLineHeight = m_pCurr->Height();
m_pCurr->SetClipping( false );
SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
@@ -1806,7 +1863,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
nTmp = 100;
nTmp *= nLineHeight;
- nLineHeight = static_cast<sal_uInt16>(nTmp / 100);
+ nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp / 100);
}
m_pCurr->SetRealHeight( nLineHeight );
@@ -1841,7 +1898,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
nTmp /= 100;
if( !nTmp )
++nTmp;
- nLineHeight = static_cast<sal_uInt16>(nTmp);
+ nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp);
sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80%
#if 0
// could do clipping here (like Word does)
@@ -1899,7 +1956,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
nTmp += nLineHeight;
if (nTmp < 1)
nTmp = 1;
- nLineHeight = static_cast<sal_uInt16>(nTmp);
+ nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp);
break;
}
case SvxInterLineSpaceRule::Fix:
@@ -2099,8 +2156,8 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
- const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight();
- sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
+ const sal_uInt32 nTmpHeight = pCurrent->GetRealHeight();
+ sal_uInt32 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
AsCharFlags nFlags = AsCharFlags::UlSpace;
if( GetMulti() )
{
@@ -2365,7 +2422,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
nAscent = pLast->GetAscent();
nHeight = pLast->Height();
- if ( m_pCurr->GetRealHeight() > nHeight )
+ if ( o3tl::narrowing<SwTwips>(m_pCurr->GetRealHeight()) > nHeight )
nTop += m_pCurr->GetRealHeight() - nHeight;
else
// Important for fixed space between lines
@@ -2465,7 +2522,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
if( bForced )
{
m_pCurr->SetForcedLeftMargin();
- rInf.ForcedLeftMargin( static_cast<sal_uInt16>(aInter.Width()) );
+ rInf.ForcedLeftMargin( o3tl::narrowing<sal_uInt16>(aInter.Width()) );
}
if( bFullLine )
@@ -2496,7 +2553,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
if( nH < SAL_MAX_UINT16 )
pFly->Height( sal_uInt16( nH ) );
}
- if( nAscent < pFly->Height() )
+ if( nAscent < o3tl::narrowing<SwTwips>(pFly->Height()) )
pFly->SetAscent( sal_uInt16(nAscent) );
else
pFly->SetAscent( pFly->Height() );
@@ -2512,7 +2569,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
else
{
pFly->Height( sal_uInt16(aInter.Height()) );
- if( nAscent < pFly->Height() )
+ if( nAscent < o3tl::narrowing<SwTwips>(pFly->Height()) )
pFly->SetAscent( sal_uInt16(nAscent) );
else
pFly->SetAscent( pFly->Height() );
@@ -2555,7 +2612,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
const tools::Long nNewWidth = ( i - 1 ) * nGridWidth - nOfst;
if ( nNewWidth > 0 )
- rInf.Width( static_cast<sal_uInt16>(nNewWidth) );
+ rInf.Width( o3tl::narrowing<sal_uInt16>(nNewWidth) );
else
rInf.Width( 0 );
@@ -2588,7 +2645,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
// we use this one when calculating the base, or the frame would be positioned
// too much to the top, sliding down after all causing a repaint in an area
// he actually never was in.
- sal_uInt16 nAscent = 0;
+ sal_uInt32 nAscent = 0;
const bool bTextFrameVertical = GetInfo().GetTextFrame()->IsVertical();
@@ -2598,9 +2655,9 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
pFly->GetRefPoint().Y() );
if ( bUseFlyAscent )
- nAscent = static_cast<sal_uInt16>( std::abs( int( bTextFrameVertical ?
+ nAscent = std::abs( int( bTextFrameVertical ?
pFly->GetRelPos().X() :
- pFly->GetRelPos().Y() ) ) );
+ pFly->GetRelPos().Y() ) );
// Check if be prefer to use the ascent of the last portion:
if ( IsQuick() ||
@@ -2609,7 +2666,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
{
nAscent = rInf.GetLast()->GetAscent();
}
- else if( nAscent > nFlyAsc )
+ else if( o3tl::narrowing<SwTwips>(nAscent) > nFlyAsc )
nFlyAsc = nAscent;
Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent );
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 75493bad82be..8ff1067abd0d 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -83,14 +83,14 @@ SwLinePortion *SwTextPainter::CalcPaintOfst( const SwRect &rPaint )
{
SwLinePortion *pLast = nullptr;
// 7529 and 4757: not <= nPaintOfst
- while( pPor && GetInfo().X() + pPor->Width() + (pPor->Height()/2)
+ while( pPor && o3tl::narrowing<SwTwips>(GetInfo().X() + pPor->Width() + (pPor->Height()/2))
< nPaintOfst )
{
if( pPor->InSpaceGrp() && GetInfo().GetSpaceAdd() )
{
tools::Long nTmp = GetInfo().X() +pPor->Width() +
pPor->CalcSpacing( GetInfo().GetSpaceAdd(), GetInfo() );
- if( nTmp + (pPor->Height()/2) >= nPaintOfst )
+ if( o3tl::narrowing<SwTwips>(nTmp + (pPor->Height()/2)) >= nPaintOfst )
break;
GetInfo().X( nTmp );
GetInfo().SetIdx( GetInfo().GetIdx() + pPor->GetLen() );
@@ -178,7 +178,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
&& GetDropLines() >= GetLineNr();
}
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
// bClip decides if there's a need to clip
@@ -192,7 +192,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
if( GetInfo().GetPos().X() < rPaint.Left() ||
GetInfo().GetPos().Y() < rPaint.Top() ||
- GetInfo().GetPos().Y() + nTmpHeight > rPaint.Top() + rPaint.Height() )
+ GetInfo().GetPos().Y() + o3tl::narrowing<SwTwips>(nTmpHeight) > rPaint.Top() + rPaint.Height() )
{
bClip = false;
rClip.ChgClip( rPaint, m_pFrame, m_pCurr->HasUnderscore() );
@@ -347,7 +347,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
// A safety distance of half the height is added, so that
// TTF-"f" isn't overlapping into the page margin.
if( bClip &&
- GetInfo().X() + pPor->Width() + ( pPor->Height() / 2 ) > nMaxRight )
+ o3tl::narrowing<SwTwips>(GetInfo().X() + pPor->Width() + ( pPor->Height() / 2 )) > nMaxRight )
{
bClip = false;
rClip.ChgClip( rPaint, m_pFrame, m_pCurr->HasUnderscore() );
@@ -480,7 +480,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
SwTwips nDiff = GetInfo().Y() + nTmpHeight - nTmpAscent - GetTextFrame()->getFrameArea().Bottom();
if( ( nDiff > 0 &&
(GetEnd() < TextFrameIndex(GetInfo().GetText().getLength()) ||
- ( nDiff > nTmpHeight/2 && GetPrevLine() ) ) ) ||
+ ( nDiff > o3tl::narrowing<SwTwips>(nTmpHeight)/2 && GetPrevLine() ) ) ) ||
(nDiff >= 0 && bNextUndersized) )
{
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 220977a24d6d..8e49e490f7e1 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -60,7 +60,7 @@ void SwTextIter::Init()
m_nLineNr = 1;
}
-void SwTextIter::CalcAscentAndHeight( sal_uInt16 &rAscent, sal_uInt16 &rHeight ) const
+void SwTextIter::CalcAscentAndHeight( sal_uInt32 &rAscent, sal_uInt32 &rHeight ) const
{
rHeight = GetLineHeight();
rAscent = m_pCurr->GetAscent() + rHeight - m_pCurr->Height();
@@ -211,9 +211,9 @@ const SwLineLayout *SwTextCursor::CharCursorToLine(TextFrameIndex const nPositio
return bPrevious ? PrevLine() : m_pCurr;
}
-sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
+sal_uInt32 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
const SwLinePortion* pPor,
- sal_uInt16 nPorHeight, sal_uInt16 nPorAscent,
+ sal_uInt32 nPorHeight, sal_uInt32 nPorAscent,
const bool bAutoToCentered ) const
{
if ( pPor )
@@ -222,7 +222,7 @@ sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
nPorAscent = pPor->GetAscent();
}
- sal_uInt16 nOfst = rLine.GetRealHeight() - rLine.Height();
+ sal_uInt32 nOfst = rLine.GetRealHeight() - rLine.Height();
SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
@@ -299,7 +299,7 @@ sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
void SwTextIter::TwipsToLine( const SwTwips y)
{
- while( m_nY + GetLineHeight() <= y && Next() )
+ while( m_nY + o3tl::narrowing<SwTwips>(GetLineHeight()) <= y && Next() )
;
while( m_nY > y && Prev() )
;
diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx
index f155ee6cc484..960d383fe7cf 100644
--- a/sw/source/core/text/itrtxt.hxx
+++ b/sw/source/core/text/itrtxt.hxx
@@ -113,8 +113,8 @@ public:
// Truncates all after pCurr
void TruncLines( bool bNoteFollow = false );
- sal_uInt16 GetLineHeight() const { return m_pCurr->GetRealHeight(); }
- void CalcAscentAndHeight( sal_uInt16 &rAscent, sal_uInt16 &rHeight ) const;
+ sal_uInt32 GetLineHeight() const { return m_pCurr->GetRealHeight(); }
+ void CalcAscentAndHeight( sal_uInt32 &rAscent, sal_uInt32 &rHeight ) const;
// Lots of trouble for querying pCurr == pPara
bool IsFirstTextLine() const
@@ -287,8 +287,8 @@ public:
// calculates baseline for portion rPor
// bAutoToCentered indicates, if AUTOMATIC mode means CENTERED or BASELINE
- sal_uInt16 AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor,
- sal_uInt16 nPorHeight = 0, sal_uInt16 nAscent = 0,
+ sal_uInt32 AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor,
+ sal_uInt32 nPorHeight = 0, sal_uInt32 nAscent = 0,
const bool bAutoToCentered = false ) const;
static void SetRightMargin( const bool bNew ){ s_bRightMargin = bNew; }
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index fdb2e4442916..4d589427850c 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -594,10 +594,10 @@ bool SwNumberPortion::Format( SwTextFormatInfo &rInf )
// Height has to be changed
if ( rInf.IsMulti() )
{
- if ( Height() < nDiff )
+ if ( o3tl::narrowing<SwTwips>(Height()) < nDiff )
Height( sal_uInt16( nDiff ) );
}
- else if( Width() < nDiff )
+ else if( o3tl::narrowing<SwTwips>(Width()) < nDiff )
Width( sal_uInt16(nDiff) );
}
return bFull;
@@ -785,7 +785,7 @@ SwGrfNumPortion::SwGrfNumPortion(
m_nYPos = 0;
m_eOrient = text::VertOrientation::TOP;
}
- Width( static_cast<sal_uInt16>(rGrfSize.Width() + 2 * GRFNUM_SECURE) );
+ Width( o3tl::narrowing<sal_uInt16>(rGrfSize.Width() + 2 * GRFNUM_SECURE) );
m_nFixWidth = Width();
m_nGrfHeight = rGrfSize.Height() + 2 * GRFNUM_SECURE;
Height( sal_uInt16(m_nGrfHeight) );
@@ -834,7 +834,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
if( bFull )
{
- Width( rInf.Width() - static_cast<sal_uInt16>(rInf.X()) );
+ Width( rInf.Width() - o3tl::narrowing<sal_uInt16>(rInf.X()) );
if( bFly )
{
SetLen(TextFrameIndex(0));
@@ -868,7 +868,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
SetHide( true );
}
- if( Width() < nDiff )
+ if( o3tl::narrowing<SwTwips>(Width()) < nDiff )
Width( sal_uInt16(nDiff) );
return bFull;
}
@@ -959,8 +959,10 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const
Graphic* pGraph = const_cast<Graphic*>(m_pBrush->GetGraphic());
if (pGraph)
{
+ const OutputDevice* pOut = rInf.GetOut();
+ assert(pOut);
pGraph->StartAnimation(
- const_cast<OutputDevice*>(rInf.GetOut()), aPos, aSize, m_nId );
+ *const_cast<OutputDevice*>(pOut), aPos, aSize, m_nId);
}
}
@@ -993,7 +995,9 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const
if( bDraw && aTmp.HasArea() )
{
- DrawGraphic( m_pBrush.get(), const_cast<OutputDevice*>(rInf.GetOut()),
+ const OutputDevice* pOut = rInf.GetOut();
+ assert(pOut);
+ DrawGraphic( m_pBrush.get(), *const_cast<OutputDevice*>(pOut),
aTmp, aRepaint, m_bReplace ? GRFNUM_REPLACE : GRFNUM_YES );
}
}
@@ -1166,7 +1170,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
{
rInf.GetOut()->SetFont( rInf.GetFont()->GetFnt( m_aScrType[i] ) );
m_aWidth[ m_aScrType[i] ] =
- static_cast<sal_uInt16>(2 * rInf.GetOut()->GetFontMetric().GetFontSize().Width() / 3);
+ o3tl::narrowing<sal_uInt16>(2 * rInf.GetOut()->GetFontMetric().GetFontSize().Width() / 3);
}
}
}
@@ -1213,7 +1217,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
SwDrawTextInfo aDrawInf(pSh, *rInf.GetOut(), m_aExpand, i, 1);
Size aSize = aTmpFont.GetTextSize_( aDrawInf );
const sal_uInt16 nAsc = aTmpFont.GetAscent( pSh, *rInf.GetOut() );
- m_aPos[ i ] = static_cast<sal_uInt16>(aSize.Width());
+ m_aPos[ i ] = o3tl::narrowing<sal_uInt16>(aSize.Width());
if( i == nTop ) // enter the second line
{
m_nLowPos = nMaxDescent;
@@ -1228,7 +1232,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
if( nAsc > nMaxAscent )
nMaxAscent = nAsc;
if( aSize.Height() - nAsc > nMaxDescent )
- nMaxDescent = static_cast<sal_uInt16>(aSize.Height() - nAsc);
+ nMaxDescent = o3tl::narrowing<sal_uInt16>(aSize.Height() - nAsc);
}
// for one or two characters we double the width of the portion
if( nCount < 3 )
@@ -1253,7 +1257,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
Height( Height() + nMainAscent - GetAscent() );
SetAscent( nMainAscent );
}
- if( Height() < nMainAscent + nMainDescent )
+ if( o3tl::narrowing<SwTwips>(Height()) < nMainAscent + nMainDescent )
Height( nMainAscent + nMainDescent );
// We calculate the x positions of the characters in both lines...
@@ -1291,7 +1295,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
{
if( rInf.GetLineStart() == rInf.GetIdx() && (!rInf.GetLast()->InFieldGrp()
|| !static_cast<SwFieldPortion*>(rInf.GetLast())->IsFollow() ) )
- Width( static_cast<sal_uInt16>( rInf.Width() - rInf.X() ) );
+ Width( o3tl::narrowing<sal_uInt16>( rInf.Width() - rInf.X() ) );
else
{
Truncate();
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 34edc3082b71..b999e3d7c354 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -39,6 +39,7 @@
#include <sortedobjs.hxx>
#include <officecfg/Office/Common.hxx>
+#include <PostItMgr.hxx>
/**
* class SwFlyPortion => we expect a frame-locale SwRect!
@@ -57,7 +58,7 @@ bool SwFlyPortion::Format( SwTextFormatInfo &rInf )
rInf.GetLastTab()->FormatEOL( rInf );
rInf.GetLast()->FormatEOL( rInf );
- PrtWidth( static_cast<sal_uInt16>(GetFix() - rInf.X() + PrtWidth()) );
+ PrtWidth( o3tl::narrowing<sal_uInt16>(GetFix() - rInf.X() + PrtWidth()) );
if( !Width() )
{
OSL_ENSURE( Width(), "+SwFlyPortion::Format: a fly is a fly is a fly" );
@@ -81,7 +82,7 @@ bool SwFlyPortion::Format( SwTextFormatInfo &rInf )
SetLen(TextFrameIndex(1));
}
- const sal_uInt16 nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth());
+ const sal_uInt16 nNewWidth = o3tl::narrowing<sal_uInt16>(rInf.X() + PrtWidth());
if( rInf.Width() <= nNewWidth )
{
Truncate();
@@ -226,7 +227,7 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const
// track changes: cross out the image, if it is deleted
const SwFrame *pFrame = m_pFly->Lower();
- if ( IsDeleted() && pFrame )
+ if ( GetAuthor() != std::string::npos && IsDeleted() && pFrame )
{
SwRect aPaintRect( pFrame->GetPaintArea() );
@@ -236,7 +237,8 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const
const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetAntialiasing(AntialiasingFlags::Enable);
tools::Long startX = aPaintRect.Left( ), endX = aPaintRect.Right();
tools::Long startY = aPaintRect.Top( ), endY = aPaintRect.Bottom();
- const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetLineColor(NON_PRINTING_CHARACTER_COLOR);
+ const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetLineColor(
+ SwPostItMgr::GetColorAnchor(GetAuthor()) );
const_cast<vcl::RenderContext&>(*rInf.GetOut()).DrawLine(Point(startX, startY), Point(endX, endY));
const_cast<vcl::RenderContext&>(*rInf.GetOut()).DrawLine(Point(startX, endY), Point(endX, startY));
if ( bIsAntiAliasing )
@@ -270,6 +272,7 @@ void sw::DrawFlyCntPortion::Paint(const SwTextPaintInfo&) const
SwFlyCntPortion::SwFlyCntPortion()
: m_bMax(false)
, m_bDeleted(false)
+ , m_nAuthor(std::string::npos)
, m_eAlign(sw::LineAlign::NONE)
{
mnLineLength = TextFrameIndex(1);
@@ -421,14 +424,14 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase,
SwTwips nRelPos = aObjPositioning.GetRelPosY();
if ( nRelPos < 0 )
{
- mnAscent = static_cast<sal_uInt16>(-nRelPos);
+ mnAscent = -nRelPos;
if( mnAscent > Height() )
Height( mnAscent );
}
else
{
mnAscent = 0;
- Height( Height() + static_cast<sal_uInt16>(nRelPos) );
+ Height( Height() + o3tl::narrowing<sal_uInt16>(nRelPos) );
}
}
else
diff --git a/sw/source/core/text/porfly.hxx b/sw/source/core/text/porfly.hxx
index fdd974050513..a519c1109c87 100644
--- a/sw/source/core/text/porfly.hxx
+++ b/sw/source/core/text/porfly.hxx
@@ -46,6 +46,7 @@ class SwFlyCntPortion : public SwLinePortion
Point m_aRef; // Relatively to this point we calculate the AbsPos
bool m_bMax; // Line adjustment and height == line height
bool m_bDeleted; // Part of tracked deletion: it needs strikethrough
+ size_t m_nAuthor; // Redline author for color of the strikethrough
sw::LineAlign m_eAlign;
virtual SdrObject* GetSdrObj(const SwTextFrame&) =0;
@@ -55,6 +56,8 @@ public:
const Point& GetRefPoint() const { return m_aRef; }
bool IsMax() const { return m_bMax; }
bool IsDeleted() const { return m_bDeleted; }
+ void SetAuthor(size_t nAuthor) { m_nAuthor = nAuthor; }
+ size_t GetAuthor() const { return m_nAuthor; }
sw::LineAlign GetAlign() const { return m_eAlign; }
void SetAlign(sw::LineAlign eAlign) { m_eAlign = eAlign; }
void SetMax(bool bMax) { m_bMax = bMax; }
diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx
index 7c09ded23a2f..4ccfbbb62172 100644
--- a/sw/source/core/text/porglue.cxx
+++ b/sw/source/core/text/porglue.cxx
@@ -215,7 +215,7 @@ void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr )
}
while( pPrev != pLeft )
{
- if( bNoMove || pPrev->PrtWidth() >= nRightGlue ||
+ if( bNoMove || o3tl::narrowing<SwTwips>(pPrev->PrtWidth()) >= nRightGlue ||
pPrev->InHyphGrp() || pPrev->IsKernPortion() )
{
// The portion before the pRight cannot be moved
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 3d26e990c50c..95809edf540d 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -199,7 +199,7 @@ void SwLineLayout::DeleteNext()
delete a;
}
-void SwLineLayout::Height(const sal_uInt16 nNew, const bool bText)
+void SwLineLayout::Height(const sal_uInt32 nNew, const bool bText)
{
SwPosSize::Height(nNew);
if (bText)
@@ -374,7 +374,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
}
else
{
- const sal_uInt16 nLineHeight = Height();
+ const sal_uInt32 nLineHeight = Height();
Init( GetNextPortion() );
SwLinePortion *pPos = mpNextPortion;
SwLinePortion *pLast = this;
@@ -410,7 +410,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
AddPrtWidth( pPos->Width() );
// #i3952#
- if ( bIgnoreBlanksAndTabsForLineHeightCalculation )
+ if (bIgnoreBlanksAndTabsForLineHeightCalculation && !rInf.GetLineStart())
{
if ( pPos->InTabGrp() || pPos->IsHolePortion() ||
( pPos->IsTextPortion() &&
@@ -437,8 +437,8 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
// We had an attribute change: Sum up/build maxima of length and mass
- sal_uInt16 nPosHeight = pPos->Height();
- sal_uInt16 nPosAscent = pPos->GetAscent();
+ sal_uInt32 nPosHeight = pPos->Height();
+ sal_uInt32 nPosAscent = pPos->GetAscent();
SAL_WARN_IF( nPosHeight < nPosAscent,
"sw.core", "SwLineLayout::CalcLine: bad ascent or height" );
@@ -642,6 +642,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
if( pPos->IsFlyCntPortion() )
{
bool bDeleted = false;
+ size_t nAuthor = std::string::npos;
if ( bHasRedline )
{
OUString sRedlineText;
@@ -651,10 +652,11 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
rInf.GetTextFrame()->MapViewToModel(nPorSttIdx));
bool bHasFlyRedline = rLine.GetRedln()->CheckLine(flyStart.first->GetIndex(),
flyStart.second, flyStart.first->GetIndex(), flyStart.second, sRedlineText,
- bHasRedlineEnd, eRedlineEnd, /*bFullLine=*/false);
+ bHasRedlineEnd, eRedlineEnd, /*pAuthorAtPos=*/&nAuthor);
bDeleted = bHasFlyRedline && eRedlineEnd == RedlineType::Delete;
}
static_cast<SwFlyCntPortion*>(pPos)->SetDeleted(bDeleted);
+ static_cast<SwFlyCntPortion*>(pPos)->SetAuthor(nAuthor);
}
// anchored to characters
else if ( pPos->IsFlyPortion() )
@@ -670,20 +672,23 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
if ( auto pFly = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) )
{
bool bDeleted = false;
+ size_t nAuthor = std::string::npos;
const SwFormatAnchor& rAnchor = pAnchoredObj->GetFrameFormat().GetAnchor();
if ( rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR )
{
SwPosition aAnchor = *rAnchor.GetContentAnchor();
- const SwPaM aPam(aAnchor, aAnchor);
- if ( rIDRA.HasRedline( aPam, RedlineType::Delete,
- /*bStartOrEndInRange=*/false) )
+ SwRedlineTable::size_type n = 0;
+ const SwRangeRedline* pFnd =
+ rIDRA.GetRedlineTable().FindAtPosition( aAnchor, n );
+ if ( pFnd && RedlineType::Delete == pFnd->GetType() )
{
bDeleted = true;
+ nAuthor = pFnd->GetAuthor();
}
}
pFly->SetDeleted(bDeleted);
+ pFly->SetAuthor(nAuthor);
}
-
}
}
}
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 249ed81f088f..5234a537fa4c 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -81,8 +81,8 @@ private:
SwLineLayout *m_pNext; // The next Line
std::unique_ptr<std::vector<tools::Long>> m_pLLSpaceAdd; // Used for justified alignment
std::unique_ptr<std::deque<sal_uInt16>> m_pKanaComp; // Used for Kana compression
- sal_uInt16 m_nRealHeight; // The height resulting from line spacing and register
- sal_uInt16 m_nTextHeight; // The max height of all non-FlyCnt portions in this Line
+ sal_uInt32 m_nRealHeight; // The height resulting from line spacing and register
+ sal_uInt32 m_nTextHeight; // The max height of all non-FlyCnt portions in this Line
bool m_bFormatAdj : 1;
bool m_bDummy : 1;
bool m_bEndHyph : 1;
@@ -108,7 +108,7 @@ private:
public:
// From SwPosSize
using SwPosSize::Height;
- virtual void Height(const sal_uInt16 nNew, const bool bText = true) override;
+ virtual void Height(const sal_uInt32 nNew, const bool bText = true) override;
// From SwLinePortion
virtual SwLinePortion *Insert( SwLinePortion *pPortion ) override;
@@ -165,8 +165,8 @@ public:
// Collects the data for the line
void CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf );
- void SetRealHeight( sal_uInt16 nNew ) { m_nRealHeight = nNew; }
- sal_uInt16 GetRealHeight() const { return m_nRealHeight; }
+ void SetRealHeight( sal_uInt32 nNew ) { m_nRealHeight = nNew; }
+ sal_uInt32 GetRealHeight() const { return m_nRealHeight; }
sal_uInt16 GetTextHeight() const { return m_nTextHeight; }
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 035f670d464b..c5dc41ff3db5 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -88,7 +88,7 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf,
sal_uInt16 nLastWidth = pLast->Width();
if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd() )
- nLastWidth = nLastWidth + static_cast<sal_uInt16>(pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf ));
+ nLastWidth = nLastWidth + o3tl::narrowing<sal_uInt16>(pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf ));
sal_uInt16 nPos;
SwTextPaintInfo aInf( rInf );
@@ -246,7 +246,7 @@ bool SwLinePortion::Format( SwTextFormatInfo &rInf )
const SwLinePortion *pLast = rInf.GetLast();
Height( pLast->Height() );
SetAscent( pLast->GetAscent() );
- const sal_uInt16 nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth());
+ const sal_uInt16 nNewWidth = o3tl::narrowing<sal_uInt16>(rInf.X() + PrtWidth());
// Only portions with true width can return true
// Notes for example never set bFull==true
if( rInf.Width() <= nNewWidth && PrtWidth() && ! IsKernPortion() )
@@ -290,7 +290,7 @@ void SwLinePortion::Move( SwTextPaintInfo &rInf )
rInf.IncKanaIdx();
}
if( rInf.IsRotated() )
- rInf.Y( rInf.Y() + ( bB2T ? -PrtWidth() : PrtWidth() ) );
+ rInf.Y( rInf.Y() + ( bB2T ? -o3tl::narrowing<SwTwips>(PrtWidth()) : o3tl::narrowing<SwTwips>(PrtWidth()) ) );
else if ( bCounterDir )
rInf.X( rInf.X() - PrtWidth() );
else
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 3d2b8dad29e4..f0efc86e5888 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -53,7 +53,7 @@ protected:
SwLinePortion *mpNextPortion;
// Count of chars and spaces on the line
TextFrameIndex mnLineLength;
- sal_uInt16 mnAscent; // Maximum ascender
+ sal_uInt32 mnAscent; // Maximum ascender
SwLinePortion();
private:
@@ -73,12 +73,12 @@ public:
TextFrameIndex GetLen() const { return mnLineLength; }
void SetLen(TextFrameIndex const nLen) { mnLineLength = nLen; }
void SetNextPortion( SwLinePortion *pNew ){ mpNextPortion = pNew; }
- sal_uInt16 &GetAscent() { return mnAscent; }
- sal_uInt16 GetAscent() const { return mnAscent; }
- void SetAscent( const sal_uInt16 nNewAsc ) { mnAscent = nNewAsc; }
+ sal_uInt32 &GetAscent() { return mnAscent; }
+ sal_uInt32 GetAscent() const { return mnAscent; }
+ void SetAscent( const sal_uInt32 nNewAsc ) { mnAscent = nNewAsc; }
void PrtWidth( sal_uInt16 nNewWidth ) { Width( nNewWidth ); }
- sal_uInt16 PrtWidth() const { return Width(); }
- void AddPrtWidth( const sal_uInt16 nNew ) { Width( Width() + nNew ); }
+ sal_uInt32 PrtWidth() const { return Width(); }
+ void AddPrtWidth( const sal_uInt32 nNew ) { Width( Width() + nNew ); }
void SubPrtWidth( const sal_uInt16 nNew ) { Width( Width() - nNew ); }
// Insert methods
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index c51fb973ad29..b94302bd8ed7 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -351,12 +351,12 @@ void SwDoubleLinePortion::PaintBracket( SwTextPaintInfo &rInf,
aBlank.Width( nChWidth );
aBlank.Height( m_pBracket->nHeight );
{
- std::unique_ptr<SwFont> pTmpFnt( new SwFont( *rInf.GetFont() ) );
+ SwFont aTmpFnt( *rInf.GetFont() );
SwFontScript nAct = bOpen ? m_pBracket->nPreScript : m_pBracket->nPostScript;
if( SW_SCRIPTS > nAct )
- pTmpFnt->SetActual( nAct );
- pTmpFnt->SetProportion( 100 );
- SwFontSave aSave( rInf, pTmpFnt.get() );
+ aTmpFnt.SetActual( nAct );
+ aTmpFnt.SetProportion( 100 );
+ SwFontSave aSave( rInf, &aTmpFnt );
aBlank.Paint( rInf );
}
if( bOpen )
@@ -384,22 +384,22 @@ void SwDoubleLinePortion::SetBrackets( const SwDoubleLinePortion& rDouble )
void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxWidth )
{
nMaxWidth -= rInf.X();
- std::unique_ptr<SwFont> pTmpFnt( new SwFont( *rInf.GetFont() ) );
- pTmpFnt->SetProportion( 100 );
+ SwFont aTmpFnt( *rInf.GetFont() );
+ aTmpFnt.SetProportion( 100 );
m_pBracket->nAscent = 0;
m_pBracket->nHeight = 0;
if( m_pBracket->cPre )
{
OUString aStr( m_pBracket->cPre );
- SwFontScript nActualScr = pTmpFnt->GetActual();
+ SwFontScript nActualScr = aTmpFnt.GetActual();
if( SW_SCRIPTS > m_pBracket->nPreScript )
- pTmpFnt->SetActual( m_pBracket->nPreScript );
- SwFontSave aSave( rInf, pTmpFnt.get() );
+ aTmpFnt.SetActual( m_pBracket->nPreScript );
+ SwFontSave aSave( rInf, &aTmpFnt );
SwPosSize aSize = rInf.GetTextSize( aStr );
m_pBracket->nAscent = rInf.GetAscent();
m_pBracket->nHeight = aSize.Height();
- pTmpFnt->SetActual( nActualScr );
- if( nMaxWidth > aSize.Width() )
+ aTmpFnt.SetActual( nActualScr );
+ if( nMaxWidth > o3tl::narrowing<SwTwips>(aSize.Width()) )
{
m_pBracket->nPreWidth = aSize.Width();
nMaxWidth -= aSize.Width();
@@ -417,8 +417,8 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
{
OUString aStr( m_pBracket->cPost );
if( SW_SCRIPTS > m_pBracket->nPostScript )
- pTmpFnt->SetActual( m_pBracket->nPostScript );
- SwFontSave aSave( rInf, pTmpFnt.get() );
+ aTmpFnt.SetActual( m_pBracket->nPostScript );
+ SwFontSave aSave( rInf, &aTmpFnt );
SwPosSize aSize = rInf.GetTextSize( aStr );
const sal_uInt16 nTmpAsc = rInf.GetAscent();
if( nTmpAsc > m_pBracket->nAscent )
@@ -428,7 +428,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
}
if( aSize.Height() > m_pBracket->nHeight )
m_pBracket->nHeight = aSize.Height();
- if( nMaxWidth > aSize.Width() )
+ if( nMaxWidth > o3tl::narrowing<SwTwips>(aSize.Width()) )
{
m_pBracket->nPostWidth = aSize.Width();
nMaxWidth -= aSize.Width();
@@ -654,9 +654,9 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
TextFrameIndex nSub(0);
switch ( m_nAdjustment )
{
- case css::text::RubyAdjust_CENTER: nRight = static_cast<sal_uInt16>(nLineDiff / 2);
+ case css::text::RubyAdjust_CENTER: nRight = o3tl::narrowing<sal_uInt16>(nLineDiff / 2);
[[fallthrough]];
- case css::text::RubyAdjust_RIGHT: nLeft = static_cast<sal_uInt16>(nLineDiff - nRight); break;
+ case css::text::RubyAdjust_RIGHT: nLeft = o3tl::narrowing<sal_uInt16>(nLineDiff - nRight); break;
case css::text::RubyAdjust_BLOCK: nSub = TextFrameIndex(1);
[[fallthrough]];
case css::text::RubyAdjust_INDENT_BLOCK:
@@ -683,8 +683,8 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
}
if( nLineDiff > 1 )
{
- nRight = static_cast<sal_uInt16>(nLineDiff / 2);
- nLeft = static_cast<sal_uInt16>(nLineDiff - nRight);
+ nRight = o3tl::narrowing<sal_uInt16>(nLineDiff / 2);
+ nLeft = o3tl::narrowing<sal_uInt16>(nLineDiff - nRight);
}
break;
}
@@ -904,7 +904,7 @@ namespace sw {
// interrupts the first attribute.
// E.g. a ruby portion interrupts a 2-line-attribute, a 2-line-attribute
// with different brackets interrupts another 2-line-attribute.
-std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
+std::optional<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
SwMultiPortion const * pMulti ) const
{
SwScriptInfo& rSI = const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
@@ -936,19 +936,19 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
{
rPos = bFieldBidi ? rPos + TextFrameIndex(1) : rSI.NextDirChg(rPos, &nCurrLevel);
if (TextFrameIndex(COMPLETE_STRING) == rPos)
- return nullptr;
- std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
- pRet->pItem = nullptr;
- pRet->pAttr = nullptr;
- pRet->nStartOfAttr = TextFrameIndex(-1);
- pRet->nId = SwMultiCreatorId::Bidi;
- pRet->nLevel = nCurrLevel + 1;
- return pRet;
+ return {};
+ SwMultiCreator aRet;
+ aRet.pItem = nullptr;
+ aRet.pAttr = nullptr;
+ aRet.nStartOfAttr = TextFrameIndex(-1);
+ aRet.nId = SwMultiCreatorId::Bidi;
+ aRet.nLevel = nCurrLevel + 1;
+ return aRet;
}
// a bidi portion can only contain other bidi portions
if ( pMulti )
- return nullptr;
+ return {};
// need the node that contains input rPos
std::pair<SwTextNode const*, sal_Int32> startPos(m_pFrame->MapViewToModel(rPos));
@@ -1037,26 +1037,26 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
}
if (!pRuby && !pActiveTwoLinesItem && !pActiveRotateItem)
- return nullptr;
+ return {};
if( pRuby )
{ // The winner is ... a ruby attribute and so
// the end of the multiportion is the end of the ruby attribute.
rPos = m_pFrame->MapModelToView(startPos.first, *pRuby->End());
- std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
- pRet->pItem = nullptr;
- pRet->pAttr = pRuby;
- pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
- pRet->nId = SwMultiCreatorId::Ruby;
- pRet->nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
- return pRet;
+ SwMultiCreator aRet;
+ aRet.pItem = nullptr;
+ aRet.pAttr = pRuby;
+ aRet.nStartOfAttr = m_pFrame->MapModelToView(startPos.first, aRet.pAttr->GetStart());
+ aRet.nId = SwMultiCreatorId::Ruby;
+ aRet.nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
+ return aRet;
}
if (pActiveTwoLinesHint ||
(pNodeTwoLinesItem && pNodeTwoLinesItem == pActiveTwoLinesItem &&
rPos < TextFrameIndex(GetText().getLength())))
{ // The winner is a 2-line-attribute,
// the end of the multiportion depends on the following attributes...
- std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
+ SwMultiCreator aRet;
// We note the endpositions of the 2-line attributes in aEnd as stack
std::deque<TextFrameIndex> aEnd;
@@ -1068,9 +1068,9 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
if (pActiveTwoLinesHint)
{
- pRet->pItem = nullptr;
- pRet->pAttr = pActiveTwoLinesHint;
- pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
+ aRet.pItem = nullptr;
+ aRet.pAttr = pActiveTwoLinesHint;
+ aRet.nStartOfAttr = m_pFrame->MapModelToView(startPos.first, aRet.pAttr->GetStart());
if (pNodeTwoLinesItem)
{
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
@@ -1081,18 +1081,18 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
else
{
- aEnd.push_front(m_pFrame->MapModelToView(startPos.first, *pRet->pAttr->End()));
+ aEnd.push_front(m_pFrame->MapModelToView(startPos.first, *aRet.pAttr->End()));
}
}
else
{
- pRet->pItem = pNodeTwoLinesItem;
- pRet->pAttr = nullptr;
- pRet->nStartOfAttr = TextFrameIndex(-1);
+ aRet.pItem = pNodeTwoLinesItem;
+ aRet.pAttr = nullptr;
+ aRet.nStartOfAttr = TextFrameIndex(-1);
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
}
- pRet->nId = SwMultiCreatorId::Double;
- pRet->nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
+ aRet.nId = SwMultiCreatorId::Double;
+ aRet.nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
// pActiveTwoLinesHint is the last 2-line-attribute, which contains
// the actual position.
@@ -1171,7 +1171,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
// A ruby attribute stops the 2-line immediately
if (pTmp && RES_TXTATR_CJK_RUBY == pTmp->Which())
- return pRet;
+ return aRet;
if (pTmp ? lcl_Has2Lines(*pTmp, pActiveTwoLinesItem, bTwo)
: lcl_Check2Lines(pNodeTwoLinesItem, pActiveTwoLinesItem, bTwo))
{ // We have an interesting attribute...
@@ -1198,15 +1198,15 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
if( bOn && !aEnd.empty() )
rPos = aEnd.back();
- return pRet;
+ return aRet;
}
if (pActiveRotateHint ||
(pNodeRotateItem && pNodeRotateItem == pActiveRotateItem &&
rPos < TextFrameIndex(GetText().getLength())))
{ // The winner is a rotate-attribute,
// the end of the multiportion depends on the following attributes...
- std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
- pRet->nId = SwMultiCreatorId::Rotate;
+ SwMultiCreator aRet;
+ aRet.nId = SwMultiCreatorId::Rotate;
// We note the endpositions of the 2-line attributes in aEnd as stack
std::deque<TextFrameIndex> aEnd;
@@ -1299,9 +1299,9 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
bOn = true;
if (pActiveRotateHint)
{
- pRet->pItem = nullptr;
- pRet->pAttr = pActiveRotateHint;
- pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
+ aRet.pItem = nullptr;
+ aRet.pAttr = pActiveRotateHint;
+ aRet.nStartOfAttr = m_pFrame->MapModelToView(startPos.first, aRet.pAttr->GetStart());
if (pNodeRotateItem)
{
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
@@ -1310,14 +1310,14 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
else
{
- aEnd.push_front(m_pFrame->MapModelToView(startPos.first, *pRet->pAttr->End()));
+ aEnd.push_front(m_pFrame->MapModelToView(startPos.first, *aRet.pAttr->End()));
}
}
else
{
- pRet->pItem = pNodeRotateItem;
- pRet->pAttr = nullptr;
- pRet->nStartOfAttr = TextFrameIndex(-1);
+ aRet.pItem = pNodeRotateItem;
+ aRet.pAttr = nullptr;
+ aRet.nStartOfAttr = TextFrameIndex(-1);
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
}
for (sw::MergedAttrIterMulti iter = iterAtStartOfNode; ; )
@@ -1394,9 +1394,9 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
rPos = aEnd.back();
if( rPos > n2Start )
rPos = n2Start;
- return pRet;
+ return aRet;
}
- return nullptr;
+ return {};
}
namespace {
@@ -1679,7 +1679,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
}
else if ( rMulti.IsRuby() && rMulti.OnRight() && GetInfo().IsRuby() )
{
- SwTwips nLineDiff = std::max(( rMulti.GetRoot().Height() - pPor->Width() ) / 2, 0 );
+ SwTwips nLineDiff = std::max(( rMulti.GetRoot().Height() - pPor->Width() ) / 2, static_cast<sal_uInt32>(0) );
GetInfo().Y( nOfst + nLineDiff );
// Draw the ruby text on top of the preserved space.
GetInfo().X( GetInfo().X() - pPor->Height() );
@@ -1899,15 +1899,16 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
SeekAndChg( rInf );
std::unique_ptr<SwFontSave> xFontSave;
+ std::unique_ptr<SwFont> xTmpFont;
if( rMulti.IsDouble() )
{
- SwFont* pTmpFnt = new SwFont( *rInf.GetFont() );
+ xTmpFont.reset(new SwFont( *rInf.GetFont() ));
if( rMulti.IsDouble() )
{
SetPropFont( 50 );
- pTmpFnt->SetProportion( GetPropFont() );
+ xTmpFont->SetProportion( GetPropFont() );
}
- xFontSave.reset(new SwFontSave(rInf, pTmpFnt, this));
+ xFontSave.reset(new SwFontSave(rInf, xTmpFont.get(), this));
}
SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() );
@@ -2168,7 +2169,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
// Setting this to the portion width ( = rMulti.Width() )
// can make GetTextBreak inside SwTextGuess::Guess return too small
// values. Therefore we add some extra twips.
- if( nActWidth > nTmpX + rMulti.Width() + 6 )
+ if( nActWidth > nTmpX + o3tl::narrowing<SwTwips>(rMulti.Width()) + 6 )
nActWidth = nTmpX + rMulti.Width() + 6;
nMaxWidth = nActWidth;
nActWidth = ( 3 * nMaxWidth + nMinWidth + 3 ) / 4;
@@ -2453,7 +2454,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
return pRest;
nPosition = nMultiPos + pHelpMulti->GetLen();
- std::unique_ptr<SwMultiCreator> pCreate = GetInfo().GetMultiCreator( nMultiPos, nullptr );
+ std::optional<SwMultiCreator> pCreate = GetInfo().GetMultiCreator( nMultiPos, nullptr );
if ( !pCreate )
{
@@ -2510,7 +2511,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
SwMultiPortion* pMulti,
SwTwips nY,
- sal_uInt16& nX,
+ sal_uInt32& nX,
TextFrameIndex const nCurrStart,
tools::Long nSpaceAdd )
: pTextCursor(pCursor),
@@ -2519,7 +2520,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
{
pCursor->m_nStart = nCurrStart;
pCursor->m_pCurr = &pMulti->GetRoot();
- while( pCursor->Y() + pCursor->GetLineHeight() < nY &&
+ while( pCursor->Y() + o3tl::narrowing<SwTwips>(pCursor->GetLineHeight()) < nY &&
pCursor->Next() )
; // nothing
nWidth = pCursor->m_pCurr->Width();
@@ -2544,7 +2545,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
}
if( nSpaceAdd > 0 && !pMulti->HasTabulator() )
- pCursor->m_pCurr->Width( static_cast<sal_uInt16>(nWidth + nSpaceAdd * sal_Int32(nSpaceCnt) / SPACING_PRECISION_FACTOR) );
+ pCursor->m_pCurr->Width( o3tl::narrowing<sal_uInt16>(nWidth + nSpaceAdd * sal_Int32(nSpaceCnt) / SPACING_PRECISION_FACTOR) );
// For a BidiPortion we have to calculate the offset from the
// end of the portion
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index c94dd3125629..7c17df2e175c 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -241,7 +241,7 @@ class SwTextCursorSave
bool bSpaceChg;
public:
SwTextCursorSave( SwTextCursor* pTextCursor, SwMultiPortion* pMulti,
- SwTwips nY, sal_uInt16& nX, TextFrameIndex nCurrStart, tools::Long nSpaceAdd);
+ SwTwips nY, sal_uInt32& nX, TextFrameIndex nCurrStart, tools::Long nSpaceAdd);
~SwTextCursorSave();
};
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 6f578e0744cd..23f837d63051 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -243,7 +243,7 @@ SwArrowPortion::SwArrowPortion( const SwLinePortion &rPortion ) :
SwArrowPortion::SwArrowPortion( const SwTextPaintInfo &rInf )
: m_bLeft( false )
{
- Height( static_cast<sal_uInt16>(rInf.GetTextFrame()->getFramePrintArea().Height()) );
+ Height( o3tl::narrowing<sal_uInt16>(rInf.GetTextFrame()->getFramePrintArea().Height()) );
m_aPos.setX( rInf.GetTextFrame()->getFrameArea().Left() +
rInf.GetTextFrame()->getFramePrintArea().Right() );
m_aPos.setY( rInf.GetTextFrame()->getFrameArea().Top() +
@@ -455,7 +455,7 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff )
pOut = GetDoc().getIDocumentDeviceAccess().getReferenceDevice( true );
if( pSh && !pOut )
- pOut = pSh->GetWin();
+ pOut = pSh->GetWin()->GetOutDev();
if( !pOut )
pOut = Application::GetDefaultDevice();
@@ -493,7 +493,7 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff )
nTmp /= 100;
if( !nTmp )
++nTmp;
- rRegDiff = static_cast<sal_uInt16>(nTmp);
+ rRegDiff = o3tl::narrowing<sal_uInt16>(nTmp);
nNetHeight = rRegDiff;
break;
}
@@ -642,7 +642,7 @@ void SwControlCharPortion::Paint( const SwTextPaintInfo &rInf ) const
Point aOldPos = rInf.GetPos();
Point aNewPos( aOldPos );
- auto const deltaX((Width() / 2) - mnHalfCharWidth);
+ auto const deltaX((o3tl::narrowing<SwTwips>(Width()) / 2) - mnHalfCharWidth);
switch (rInf.GetFont()->GetOrientation(rInf.GetTextFrame()->IsVertical()).get())
{
case 0:
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index ed9d3c517bb5..c1fa69bcfc68 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -221,7 +221,7 @@ void SwTextPortion::BreakCut( SwTextFormatInfo &rInf, const SwTextGuess &rGuess
// The word/char is larger than the line
// Special case 1: The word is larger than the line
// We truncate ...
- const sal_uInt16 nLineWidth = static_cast<sal_uInt16>(rInf.Width() - rInf.X());
+ const sal_uInt16 nLineWidth = o3tl::narrowing<sal_uInt16>(rInf.Width() - rInf.X());
TextFrameIndex nLen = rGuess.CutPos() - rInf.GetIdx();
if (nLen > TextFrameIndex(0))
{
diff --git a/sw/source/core/text/possiz.hxx b/sw/source/core/text/possiz.hxx
index fc31ffc11e39..543f037fde55 100644
--- a/sw/source/core/text/possiz.hxx
+++ b/sw/source/core/text/possiz.hxx
@@ -24,17 +24,17 @@
// Compared to the SV sizes SwPosSize is always positive
class SwPosSize
{
- sal_uInt16 m_nWidth;
- sal_uInt16 m_nHeight;
+ sal_uInt32 m_nWidth;
+ sal_uInt32 m_nHeight;
public:
- SwPosSize( const sal_uInt16 nW = 0, const sal_uInt16 nH = 0 )
+ SwPosSize( const sal_uInt32 nW = 0, const sal_uInt32 nH = 0 )
: m_nWidth(nW)
, m_nHeight(nH)
{
}
explicit SwPosSize( const Size &rSize )
- : m_nWidth(sal_uInt16(rSize.Width()))
- ,m_nHeight(sal_uInt16(rSize.Height()))
+ : m_nWidth(sal_uInt32(rSize.Width()))
+ ,m_nHeight(sal_uInt32(rSize.Height()))
{
}
#if defined(__COVERITY__)
@@ -46,25 +46,25 @@ public:
SwPosSize(SwPosSize &&) = default;
SwPosSize & operator =(SwPosSize const &) = default;
SwPosSize & operator =(SwPosSize &&) = default;
- sal_uInt16 Height() const { return m_nHeight; }
- virtual void Height(const sal_uInt16 nNew, const bool = true) { m_nHeight = nNew; }
- sal_uInt16 Width() const { return m_nWidth; }
- void Width( const sal_uInt16 nNew ) { m_nWidth = nNew; }
+ sal_uInt32 Height() const { return m_nHeight; }
+ virtual void Height(const sal_uInt32 nNew, const bool = true) { m_nHeight = nNew; }
+ sal_uInt32 Width() const { return m_nWidth; }
+ void Width( const sal_uInt32 nNew ) { m_nWidth = nNew; }
Size SvLSize() const { return Size( m_nWidth, m_nHeight ); }
void SvLSize( const Size &rSize )
{
- m_nWidth = sal_uInt16(rSize.Width());
- m_nHeight = sal_uInt16(rSize.Height());
+ m_nWidth = sal_uInt32(rSize.Width());
+ m_nHeight = sal_uInt32(rSize.Height());
}
void SvXSize( const Size &rSize )
{
- m_nHeight = sal_uInt16(rSize.Width());
- m_nWidth = sal_uInt16(rSize.Height());
+ m_nHeight = sal_uInt32(rSize.Width());
+ m_nWidth = sal_uInt32(rSize.Height());
}
SwPosSize& operator=( const Size &rSize )
{
- m_nWidth = sal_uInt16(rSize.Width());
- m_nHeight = sal_uInt16(rSize.Height());
+ m_nWidth = sal_uInt32(rSize.Width());
+ m_nHeight = sal_uInt32(rSize.Height());
return *this;
}
};
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index faeb0fbbaa8d..d4ced03f1c8c 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -941,13 +941,13 @@ bool SwRedlineItr::ChkSpecialUnderline_() const
bool SwRedlineItr::CheckLine(
sal_uLong const nStartNode, sal_Int32 const nChkStart,
sal_uLong const nEndNode, sal_Int32 nChkEnd, OUString& rRedlineText,
- bool& bRedlineEnd, RedlineType& eRedlineEnd, bool bFullLine)
+ bool& bRedlineEnd, RedlineType& eRedlineEnd, size_t* pAuthorAtPos)
{
// note: previously this would return true in the (!m_bShow && m_pExt)
// case, but surely that was a bug?
if (m_nFirst == SwRedlineTable::npos || m_eMode != Mode::Show)
return false;
- if( nChkEnd == nChkStart && bFullLine ) // empty lines look one char further
+ if( nChkEnd == nChkStart && pAuthorAtPos == nullptr ) // empty lines look one char further
++nChkEnd;
sal_Int32 nOldStart = m_nStart;
sal_Int32 nOldEnd = m_nEnd;
@@ -978,6 +978,8 @@ bool SwRedlineItr::CheckLine(
eRedlineEnd = pRedline->GetType();
bRedlineEnd = true;
isBreak = true;
+ if (pAuthorAtPos)
+ *pAuthorAtPos = pRedline->GetAuthor();
[[fallthrough]];
case SwComparePosition::OverlapBefore:
case SwComparePosition::CollideEnd:
diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx
index 0d0e013ff6d5..087df8bbbba8 100644
--- a/sw/source/core/text/redlnitr.hxx
+++ b/sw/source/core/text/redlnitr.hxx
@@ -119,7 +119,7 @@ public:
{ return IsOn() && ChkSpecialUnderline_(); }
bool CheckLine(sal_uLong nStartNode, sal_Int32 nChkStart, sal_uLong nEndNode,
sal_Int32 nChkEnd, OUString& rRedlineText, bool& bRedlineEnd,
- RedlineType& eRedlineEnd, bool bFullLine = true);
+ RedlineType& eRedlineEnd, size_t* pAuthorAtPos = nullptr);
bool LeaveExtend(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew)
{ return m_pExt->Leave(rFnt, nNode, nNew); }
bool ExtOn() {
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 312eb4dd71ba..ce39a3e9e1dc 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -484,8 +484,8 @@ void SwTextFormatter::CalcDropHeight( const sal_uInt16 nLines )
{
const SwLinePortion *const pOldCurr = GetCurr();
sal_uInt16 nDropHght = 0;
- sal_uInt16 nAscent = 0;
- sal_uInt16 nHeight = 0;
+ sal_uInt32 nAscent = 0;
+ sal_uInt32 nHeight = 0;
sal_uInt16 nDropLns = 0;
const bool bRegisterOld = IsRegisterOn();
m_bRegisterOn = false;
@@ -545,8 +545,8 @@ void SwTextFormatter::CalcDropHeight( const sal_uInt16 nLines )
void SwTextFormatter::GuessDropHeight( const sal_uInt16 nLines )
{
OSL_ENSURE( nLines, "GuessDropHeight: Give me more Lines!" );
- sal_uInt16 nAscent = 0;
- sal_uInt16 nHeight = 0;
+ sal_uInt32 nAscent = 0;
+ sal_uInt32 nHeight = 0;
SetDropLines( nLines );
if ( GetDropLines() > 1 )
{
@@ -678,7 +678,7 @@ void SwTextPainter::PaintDropPortion()
Point aLineOrigin( GetTopLeft() );
aLineOrigin.AdjustX(nX );
- sal_uInt16 nTmpAscent, nTmpHeight;
+ sal_uInt32 nTmpAscent, nTmpHeight;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
aLineOrigin.AdjustY(nTmpAscent );
GetInfo().SetIdx( GetStart() );
@@ -775,7 +775,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
m_aText[ nTmpIdx ] = aStr;
m_aWishedHeight[ nTmpIdx ] = sal_uInt16(nWishedHeight);
// save initial scaling factor
- m_aFactor[ nTmpIdx ] = static_cast<sal_uInt16>(nFactor);
+ m_aFactor[ nTmpIdx ] = o3tl::narrowing<sal_uInt16>(nFactor);
}
bool bGrow = (pDrop->GetLen() != TextFrameIndex(0));
@@ -793,7 +793,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
OutputDevice* pOut = rInf.GetOut();
OutputDevice* pWin;
if( rInf.GetVsh() && rInf.GetVsh()->GetWin() )
- pWin = rInf.GetVsh()->GetWin();
+ pWin = rInf.GetVsh()->GetWin()->GetOutDev();
else
pWin = Application::GetDefaultDevice();
@@ -925,7 +925,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
else
{
if ( bUseCache )
- m_aFactor[ nTmpIdx ] = static_cast<sal_uInt16>(nFactor);
+ m_aFactor[ nTmpIdx ] = o3tl::narrowing<sal_uInt16>(nFactor);
nMin = nFactor;
}
@@ -982,7 +982,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
bool SwDropPortion::Format( SwTextFormatInfo &rInf )
{
bool bFull = false;
- m_nFix = static_cast<sal_uInt16>(rInf.X());
+ m_nFix = o3tl::narrowing<sal_uInt16>(rInf.X());
SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() );
aLayoutModeModifier.SetAuto();
@@ -1020,7 +1020,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf )
Width();
// set values
- pCurrPart->SetWidth( static_cast<sal_uInt16>(nTmpWidth) );
+ pCurrPart->SetWidth( o3tl::narrowing<sal_uInt16>(nTmpWidth) );
// Move
rInf.SetIdx( rInf.GetIdx() + pCurrPart->GetLen() );
@@ -1029,7 +1029,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf )
}
SetJoinBorderWithNext(false);
SetJoinBorderWithPrev(false);
- Width( static_cast<sal_uInt16>(rInf.X() - nOldX) );
+ Width( o3tl::narrowing<sal_uInt16>(rInf.X() - nOldX) );
}
// reset my length
@@ -1066,7 +1066,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf )
else
{
const sal_uInt16 nWant = Width() + GetDistance();
- const sal_uInt16 nRest = static_cast<sal_uInt16>(rInf.Width() - rInf.X());
+ const sal_uInt16 nRest = o3tl::narrowing<sal_uInt16>(rInf.Width() - rInf.X());
if( ( nWant > nRest ) ||
lcl_IsDropFlyInter( rInf, Width() + GetDistance(), m_nDropHeight ) )
m_nDistance = 0;
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index e150f7f489f1..c1375b52fe09 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -304,7 +304,8 @@ static SwFieldPortion * lcl_NewMetaPortion(SwTextAttr & rHint, const bool bPrefi
OSL_ENSURE(pField, "lcl_NewMetaPortion: no meta field?");
if (pField)
{
- pField->GetPrefixAndSuffix(bPrefix ? &fix : nullptr, bPrefix ? nullptr : &fix);
+ OUString color;
+ pField->GetPrefixAndSuffix(bPrefix ? &fix : nullptr, bPrefix ? nullptr : &fix, &color);
}
return new SwFieldPortion( fix );
}
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index a5fb1f6b6731..d91d41ae4a01 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -244,7 +244,7 @@ SwRect SwContourCache::ContourRect( const SwFormat* pFormat,
CacheItem item {
pObj, // due to #37347 the Object must be entered only after GetContour()
std::make_unique<TextRanger>( aPolyPolygon, pPolyPolygon.get(), 20,
- static_cast<sal_uInt16>(rLRSpace.GetLeft()), static_cast<sal_uInt16>(rLRSpace.GetRight()),
+ o3tl::narrowing<sal_uInt16>(rLRSpace.GetLeft()), o3tl::narrowing<sal_uInt16>(rLRSpace.GetRight()),
pFormat->GetSurround().IsOutside(), false, pFrame->IsVertical() )
};
mvItems.insert(mvItems.begin(), std::move(item));
@@ -843,7 +843,8 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
const bool bAllowCompatWrap = m_pCurrFrame->IsInTab() && (bFooterHeader || m_pCurrFrame->IsInFootnote());
const bool bWrapAllowed = ( pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) ||
bAllowCompatWrap ||
- (!m_pCurrFrame->IsInFootnote() && !bFooterHeader));
+ (!m_pCurrFrame->IsInFootnote() && !bFooterHeader) ||
+ bFooterHeader );
m_bOn = false;
@@ -885,12 +886,14 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
// #i20505# Do not consider oversized objects
SwAnchoredObject* pAnchoredObj = (*pSorted)[ i ];
assert(pAnchoredObj);
+ const SwFormatSurround &rFlyFormat = pAnchoredObj->GetFrameFormat().GetSurround();
if ( !pAnchoredObj ||
!rIDDMA.IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) ||
!pAnchoredObj->ConsiderForTextWrap() ||
( mbIgnoreObjsInHeaderFooter && !bFooterHeader &&
pAnchoredObj->GetAnchorFrame()->FindFooterOrHeader() ) ||
- ( bAllowCompatWrap && !pAnchoredObj->GetFrameFormat().GetFollowTextFlow().GetValue() )
+ ( bAllowCompatWrap && !pAnchoredObj->GetFrameFormat().GetFollowTextFlow().GetValue() ) ||
+ ( !bAllowCompatWrap && bFooterHeader && com::sun::star::text::WrapTextMode_NONE == rFlyFormat.GetSurround() )
)
{
continue;
@@ -928,7 +931,6 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
mpAnchoredObjList->insert( aInsPosIter, pAnchoredObj );
}
- const SwFormatSurround &rFlyFormat = pAnchoredObj->GetFrameFormat().GetSurround();
// #i68520#
if ( rFlyFormat.IsAnchorOnly() &&
pAnchoredObj->GetAnchorFrame() == GetMaster() )
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 6a91cfd36a3d..ce0d6cc99c2f 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1831,12 +1831,12 @@ static void lcl_SetWrong( SwTextFrame& rFrame, SwTextNode const& rNode,
const sal_Int32 nEnd = nPos + (nCnt > 0 ? nCnt : 1 );
if ( !pTextNode->GetWrong() && !pTextNode->IsWrongDirty() )
{
- pTextNode->SetWrong( new SwWrongList( WRONGLIST_SPELL ) );
+ pTextNode->SetWrong( std::make_unique<SwWrongList>( WRONGLIST_SPELL ) );
pTextNode->GetWrong()->SetInvalid( nPos, nEnd );
}
if ( !pTextNode->GetSmartTags() && !pTextNode->IsSmartTagDirty() )
{
- pTextNode->SetSmartTags( new SwWrongList( WRONGLIST_SMARTTAG ) );
+ pTextNode->SetSmartTags( std::make_unique<SwWrongList>( WRONGLIST_SMARTTAG ) );
pTextNode->GetSmartTags()->SetInvalid( nPos, nEnd );
}
pTextNode->SetWrongDirty(SwTextNode::WrongState::TODO);
@@ -3322,7 +3322,7 @@ bool SwTextFrame::WouldFit( SwTwips &rMaxHeight, bool &bSplit, bool bTst )
return bRet;
}
-sal_uInt16 SwTextFrame::GetParHeight() const
+sal_uInt32 SwTextFrame::GetParHeight() const
{
OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
"SwTextFrame::GetParHeight with swapped frame" );
@@ -3330,11 +3330,11 @@ sal_uInt16 SwTextFrame::GetParHeight() const
if( !HasPara() )
{ // For non-empty paragraphs this is a special case
// For UnderSized we can simply just ask 1 Twip more
- sal_uInt16 nRet = static_cast<sal_uInt16>(getFramePrintArea().SSize().Height());
+ sal_uInt16 nRet = o3tl::narrowing<sal_uInt16>(getFramePrintArea().SSize().Height());
if( IsUndersized() )
{
if( IsEmpty() || GetText().isEmpty() )
- nRet = static_cast<sal_uInt16>(EmptyHeight());
+ nRet = o3tl::narrowing<sal_uInt16>(EmptyHeight());
else
++nRet;
}
@@ -3343,7 +3343,7 @@ sal_uInt16 SwTextFrame::GetParHeight() const
// TODO: Refactor and improve code
const SwLineLayout* pLineLayout = GetPara();
- sal_uInt16 nHeight = pLineLayout ? pLineLayout->GetRealHeight() : 0;
+ sal_uInt32 nHeight = pLineLayout ? pLineLayout->GetRealHeight() : 0;
// Is this paragraph scrolled? Our height until now is at least
// one line height too low then
@@ -3485,7 +3485,7 @@ void SwTextFrame::CalcAdditionalFirstLineOffset()
nListLevel = MAXLEVEL - 1;
const SwNumFormat& rNumFormat =
- pTextNode->GetNumRule()->Get( static_cast<sal_uInt16>(nListLevel) );
+ pTextNode->GetNumRule()->Get( o3tl::narrowing<sal_uInt16>(nListLevel) );
if ( rNumFormat.GetPositionAndSpaceMode() != SvxNumberFormat::LABEL_ALIGNMENT )
return;
@@ -3732,7 +3732,7 @@ sal_uInt16 SwTextFrame::FirstLineHeight() const
if ( !HasPara() )
{
if( IsEmpty() && isFrameAreaDefinitionValid() )
- return IsVertical() ? static_cast<sal_uInt16>(getFramePrintArea().Width()) : static_cast<sal_uInt16>(getFramePrintArea().Height());
+ return IsVertical() ? o3tl::narrowing<sal_uInt16>(getFramePrintArea().Width()) : o3tl::narrowing<sal_uInt16>(getFramePrintArea().Height());
return USHRT_MAX;
}
const SwParaPortion *pPara = GetPara();
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 5b4b9f7492e0..c35388bccb24 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -1181,7 +1181,7 @@ TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset)
if( nDiff < 0 )
{
nLastLeft = pQuo->GetAscent();
- nQuoWidth = static_cast<sal_uInt16>(-nDiff + nLastLeft);
+ nQuoWidth = o3tl::narrowing<sal_uInt16>(-nDiff + nLastLeft);
}
else
{
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 8e8203c72270..e12d31c64251 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -154,7 +154,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
const SvxTabStopItem& rTab =
m_pFrame->GetAttrSet()->GetPool()->GetDefaultItem( RES_PARATR_TABSTOP );
if( rTab.Count() )
- nDefTabDist = static_cast<sal_uInt16>(rTab[0].GetTabPos());
+ nDefTabDist = o3tl::narrowing<sal_uInt16>(rTab[0].GetTabPos());
else
nDefTabDist = SVX_TAB_DEFDIST;
m_aLineInf.SetDefTabStop( nDefTabDist );
@@ -323,12 +323,13 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
OSL_ENSURE( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" );
// Here we settle down ...
- SetFix( static_cast<sal_uInt16>(rInf.X()) );
+ SetFix( o3tl::narrowing<sal_uInt16>(rInf.X()) );
IDocumentSettingAccess const& rIDSA(rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess());
const bool bTabCompat = rIDSA.get(DocumentSettingId::TAB_COMPAT);
const bool bTabOverflow = rIDSA.get(DocumentSettingId::TAB_OVERFLOW);
const bool bTabOverMargin = rIDSA.get(DocumentSettingId::TAB_OVER_MARGIN);
+ const bool bTabOverSpacing = rIDSA.get(DocumentSettingId::TAB_OVER_SPACING);
// The minimal width of a tab is one blank at least.
// #i37686# In compatibility mode, the minimum width
@@ -381,13 +382,16 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
case PortionType::TabLeft:
{
// handle this case in PostFormat
- if( bTabOverMargin && !m_bAutoTabStop && GetTabPos() > rInf.Width() )
+ if ((bTabOverMargin || bTabOverSpacing) && !m_bAutoTabStop && GetTabPos() > rInf.Width())
{
- rInf.SetLastTab( this );
- break;
+ if (bTabOverMargin || GetTabPos() < rInf.GetTextFrame()->getFrameArea().Width())
+ {
+ rInf.SetLastTab(this);
+ break;
+ }
}
- PrtWidth( static_cast<sal_uInt16>(GetTabPos() - rInf.X()) );
+ PrtWidth( o3tl::narrowing<sal_uInt16>(GetTabPos() - rInf.X()) );
bFull = rInf.Width() <= rInf.X() + PrtWidth();
// In tabulator compatibility mode, we reset the bFull flag
@@ -417,7 +421,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
// line if there is a fly reducing the line width:
!rInf.GetFly() )
{
- PrtWidth( static_cast<sal_uInt16>(rInf.Width() - rInf.X()) );
+ PrtWidth( o3tl::narrowing<sal_uInt16>(rInf.Width() - rInf.X()) );
SetFixWidth( PrtWidth() );
}
else
@@ -443,13 +447,19 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
{
bool bTabOverMargin = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
DocumentSettingId::TAB_OVER_MARGIN);
-
+ bool bTabOverSpacing = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
+ DocumentSettingId::TAB_OVER_SPACING);
if (rInf.GetTextFrame()->IsInSct())
bTabOverMargin = false;
// If the tab position is larger than the right margin, it gets scaled down by default.
// However, if compat mode enabled, we allow tabs to go over the margin: the rest of the paragraph is not broken into lines.
- const sal_uInt16 nRight = bTabOverMargin ? GetTabPos() : std::min(GetTabPos(), rInf.Width());
+ const sal_uInt16 nRight
+ = bTabOverMargin
+ ? GetTabPos()
+ : bTabOverSpacing
+ ? std::min<long>(GetTabPos(), rInf.GetTextFrame()->getFrameArea().Right())
+ : std::min(GetTabPos(), rInf.Width());
const SwLinePortion *pPor = GetNextPortion();
sal_uInt16 nPorWidth = 0;
@@ -462,7 +472,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
const PortionType nWhich = GetWhichPor();
const bool bTabCompat = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT);
- if ( bTabOverMargin && PortionType::TabLeft == nWhich )
+ if ((bTabOverMargin || bTabOverSpacing) && PortionType::TabLeft == nWhich)
{
nPorWidth = 0;
}
diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx
index 5a70c7be9507..347f4feae7d9 100644
--- a/sw/source/core/text/wrong.cxx
+++ b/sw/source/core/text/wrong.cxx
@@ -203,7 +203,7 @@ sal_uInt16 SwWrongList::GetWrongPos( sal_Int32 nValue ) const
return (rST.mnPos <= nValue && nValue < rST.mnPos + rST.mnLen)
|| (rST.mnPos > nValue);
});
- return static_cast<sal_uInt16>(std::distance(maList.begin(), aIter));
+ return o3tl::narrowing<sal_uInt16>(std::distance(maList.begin(), aIter));
}
--nMax;
@@ -442,9 +442,9 @@ bool SwWrongList::InvalidateWrong( )
return false;
}
-SwWrongList* SwWrongList::SplitList( sal_Int32 nSplitPos )
+std::unique_ptr<SwWrongList> SwWrongList::SplitList( sal_Int32 nSplitPos )
{
- SwWrongList *pRet = nullptr;
+ std::unique_ptr<SwWrongList> pRet;
sal_uInt16 nLst = 0;
while( nLst < Count() && Pos( nLst ) < nSplitPos )
++nLst;
@@ -462,9 +462,9 @@ SwWrongList* SwWrongList::SplitList( sal_Int32 nSplitPos )
if( nLst )
{
if( WRONGLIST_GRAMMAR == GetWrongListType() )
- pRet = new SwGrammarMarkUp();
+ pRet.reset(new SwGrammarMarkUp());
else
- pRet = new SwWrongList( GetWrongListType() );
+ pRet.reset(new SwWrongList( GetWrongListType() ));
pRet->Insert(0, maList.begin(), ( nLst >= maList.size() ? maList.end() : maList.begin() + nLst ) );
pRet->SetInvalid( GetBeginInv(), GetEndInv() );
pRet->Invalidate_( nSplitPos ? nSplitPos - 1 : nSplitPos, nSplitPos );
@@ -559,7 +559,7 @@ void SwWrongList::Remove(sal_uInt16 nIdx, sal_uInt16 nLen )
i1 += nIdx;
std::vector<SwWrongArea>::iterator i2 = i1;
- if ( nIdx + nLen >= static_cast<sal_uInt16>(maList.size()) )
+ if ( nIdx + nLen >= o3tl::narrowing<sal_uInt16>(maList.size()) )
i2 = maList.end(); // robust
else
i2 += nLen;
@@ -602,10 +602,10 @@ void SwWrongList::RemoveEntry( sal_Int32 nBegin, sal_Int32 nEnd ) {
return (rST.mnPos != nBegin) || ((rST.mnPos + rST.mnLen) != nEnd);
});
}
- auto nDel = static_cast<sal_uInt16>(std::distance(aDelIter, aIter));
+ auto nDel = o3tl::narrowing<sal_uInt16>(std::distance(aDelIter, aIter));
if( nDel )
{
- auto nDelPos = static_cast<sal_uInt16>(std::distance(maList.cbegin(), aDelIter));
+ auto nDelPos = o3tl::narrowing<sal_uInt16>(std::distance(maList.cbegin(), aDelIter));
Remove( nDelPos, nDel );
}
}
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx
index df37f294796b..199e30256475 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -265,7 +265,7 @@ ToxTextGenerator::GenerateText(SwDoc* pDoc,
aCharStyleName = SwResId(STR_POOLCHR_INET_NORMAL);
mLinkProcessor->StartNewLink(rText.getLength(), aCharStyleName);
}
- rBase.FillText( *pTOXNd, aIdx, static_cast<sal_uInt16>(eField), pLayout );
+ rBase.FillText( *pTOXNd, aIdx, o3tl::narrowing<sal_uInt16>(eField), pLayout );
if (eField == ToxAuthorityField::AUTH_FIELD_URL)
{
// Get the absolute URL, the text may be a relative one.
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 466b7d6acdd9..021da63a54e3 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -860,7 +860,7 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & nCurPatternPos)
eRet.sCharStyleName = sToken.getToken( 0, ',', nIdx );
OUString sTmp( sToken.getToken( 0, ',', nIdx ));
if( !sTmp.isEmpty() )
- eRet.nPoolId = static_cast<sal_uInt16>(sTmp.toInt32());
+ eRet.nPoolId = o3tl::narrowing<sal_uInt16>(sTmp.toInt32());
switch( eTokenType )
{
@@ -870,10 +870,10 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & nCurPatternPos)
case TOKEN_ENTRY_NO:
sTmp = sToken.getToken( 0, ',', nIdx ); // token 2
if( !sTmp.isEmpty() )
- eRet.nChapterFormat = static_cast<sal_uInt16>(sTmp.toInt32());
+ eRet.nChapterFormat = o3tl::narrowing<sal_uInt16>(sTmp.toInt32());
sTmp = sToken.getToken( 0, ',', nIdx ); // token 3
if( !sTmp.isEmpty() )
- eRet.nOutlineLevel = static_cast<sal_uInt16>(sTmp.toInt32()); //the maximum outline level to examine
+ eRet.nOutlineLevel = o3tl::narrowing<sal_uInt16>(sTmp.toInt32()); //the maximum outline level to examine
break;
case TOKEN_TEXT:
@@ -911,7 +911,7 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & nCurPatternPos)
break;
case TOKEN_AUTHORITY:
- eRet.nAuthorityField = static_cast<sal_uInt16>(sAuthFieldEnum.toInt32());
+ eRet.nAuthorityField = o3tl::narrowing<sal_uInt16>(sAuthFieldEnum.toInt32());
break;
default: break;
}
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index e0ffc1922701..a67906d0e4ad 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -136,7 +136,7 @@ SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwContentNode* pNd,
const SwTOXInternational* pInter,
const lang::Locale* pLocale )
: pTOXNd( nullptr ), pTextMark( pMark ), pTOXIntl( pInter ),
- nPos( 0 ), nCntPos( 0 ), nType( static_cast<sal_uInt16>(nTyp) )
+ nPos( 0 ), nCntPos( 0 ), nType( o3tl::narrowing<sal_uInt16>(nTyp) )
, m_bValidText( false )
{
if ( pLocale )
@@ -668,7 +668,7 @@ sal_uInt16 SwTOXPara::GetLevel() const
{
const int nTmp = static_cast<const SwTextNode*>(pNd)->GetAttrOutlineLevel();
if(nTmp != 0 )
- nRet = static_cast<sal_uInt16>(nTmp);
+ nRet = o3tl::narrowing<sal_uInt16>(nTmp);
}
return nRet;
}
diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx b/sw/source/core/txtnode/SwGrammarContact.cxx
index 162e0af09479..9ca33f6102e0 100644
--- a/sw/source/core/txtnode/SwGrammarContact.cxx
+++ b/sw/source/core/txtnode/SwGrammarContact.cxx
@@ -80,7 +80,7 @@ IMPL_LINK( SwGrammarContact, TimerRepaint, Timer *, pTimer, void )
pTimer->Stop();
if( m_pTextNode )
{ //Replace the old wrong list by the proxy list and repaint all frames
- m_pTextNode->SetGrammarCheck( m_pProxyList.release() );
+ m_pTextNode->SetGrammarCheck( std::move(m_pProxyList) );
SwTextFrame::repaintTextFrames( *m_pTextNode );
}
}
@@ -99,7 +99,7 @@ void SwGrammarContact::updateCursorPosition( const SwPosition& rNewPos )
{
if( m_pProxyList )
{ // replace old list by the proxy list and repaint
- m_pTextNode->SetGrammarCheck( m_pProxyList.release() );
+ m_pTextNode->SetGrammarCheck( std::move(m_pProxyList) );
SwTextFrame::repaintTextFrames( *m_pTextNode );
}
EndListeningAll();
@@ -146,7 +146,7 @@ SwGrammarMarkUp* SwGrammarContact::getGrammarCheck( SwTextNode& rTextNode, bool
{
pRet = new SwGrammarMarkUp();
pRet->SetInvalid( 0, COMPLETE_STRING );
- rTextNode.SetGrammarCheck( pRet );
+ rTextNode.SetGrammarCheck( std::unique_ptr<SwGrammarMarkUp>(pRet) );
rTextNode.SetGrammarCheckDirty( true );
}
}
@@ -167,7 +167,7 @@ void SwGrammarContact::finishGrammarCheck( SwTextNode& rTextNode )
}
else if( m_pTextNode->GetGrammarCheck() )
{ // all grammar problems seems to be gone, no delay needed
- m_pTextNode->SetGrammarCheck( nullptr );
+ m_pTextNode->ClearGrammarCheck();
SwTextFrame::repaintTextFrames( *m_pTextNode );
}
}
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 558874ad1784..2124e55c7d65 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -377,7 +377,32 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* p
pTextNd->TriggerNodeUpdate(sw::LegacyModifyHint(pNodeOld, pNodeNew));
if(bExpand)
{
- mpTextField->ExpandTextField( pOld == nullptr && pNew == nullptr );
+ bool bForceNotify = pOld == nullptr && pNew == nullptr;
+ if (bForceNotify)
+ {
+ // Force notify was added for conditional text fields, at least the below fields need
+ // no forced notify.
+ const SwField* pField = mpTextField->GetFormatField().GetField();
+ const SwFieldIds nWhich = pField->GetTyp()->Which();
+ if (nWhich == SwFieldIds::DocInfo)
+ {
+ auto pDocInfoField = static_cast<const SwDocInfoField*>(pField);
+ sal_uInt16 nSubType = pDocInfoField->GetSubType();
+ // Do not consider extended SubTypes.
+ nSubType &= 0xff;
+ switch (nSubType)
+ {
+ case nsSwDocInfoSubType::DI_TITLE:
+ case nsSwDocInfoSubType::DI_SUBJECT:
+ case nsSwDocInfoSubType::DI_CHANGE:
+ case nsSwDocInfoSubType::DI_CUSTOM:
+ bForceNotify = false;
+ break;
+ }
+ }
+ }
+
+ mpTextField->ExpandTextField(bForceNotify);
}
}
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index 884883d10515..2376ca3169c2 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -234,8 +234,8 @@ OUString SwFormatFootnote::GetViewNumStr(const SwDoc& rDoc,
const SwFormatFootnoteEndAtTextEnd& rFootnoteEnd = static_cast<const SwFormatFootnoteEndAtTextEnd&>(
pSectNd->GetSection().GetFormat()->GetFormatAttr(
IsEndNote() ?
- static_cast<sal_uInt16>(RES_END_AT_TXTEND) :
- static_cast<sal_uInt16>(RES_FTN_AT_TXTEND) ) );
+ o3tl::narrowing<sal_uInt16>(RES_END_AT_TXTEND) :
+ o3tl::narrowing<sal_uInt16>(RES_FTN_AT_TXTEND) ) );
if( FTNEND_ATTXTEND_OWNNUMANDFMT == rFootnoteEnd.GetValue() )
{
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 73eb992c5c97..afc82565c515 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -730,7 +730,7 @@ MetaField::MetaField(SwFormatMeta * const i_pFormat,
}
void MetaField::GetPrefixAndSuffix(
- OUString *const o_pPrefix, OUString *const o_pSuffix)
+ OUString *const o_pPrefix, OUString *const o_pSuffix, OUString *const o_pShadowsColor)
{
try
{
@@ -743,7 +743,7 @@ void MetaField::GetPrefixAndSuffix(
SwDocShell const * const pShell(pTextNode->GetDoc().GetDocShell());
const uno::Reference<frame::XModel> xModel(
pShell ? pShell->GetModel() : nullptr, uno::UNO_SET_THROW);
- getPrefixAndSuffix(xModel, xMetaField, o_pPrefix, o_pSuffix);
+ getPrefixAndSuffix(xModel, xMetaField, o_pPrefix, o_pSuffix, o_pShadowsColor);
}
}
catch (const uno::Exception&)
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 508f5ff81cfc..1da7a73acdee 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -412,7 +412,7 @@ sal_uInt16 SwFntObj::GetFontAscent( const SwViewShell *pSh, const OutputDevice&
const vcl::Font aOldFnt( rRefDev.GetFont() );
const_cast<OutputDevice&>(rRefDev).SetFont( *m_pPrtFont );
const FontMetric aOutMet( rRefDev.GetFontMetric() );
- m_nPrtAscent = static_cast<sal_uInt16>(aOutMet.GetAscent());
+ m_nPrtAscent = o3tl::narrowing<sal_uInt16>(aOutMet.GetAscent());
const_cast<OutputDevice&>(rRefDev).SetFont( aOldFnt );
}
@@ -448,12 +448,12 @@ sal_uInt16 SwFntObj::GetFontHeight( const SwViewShell* pSh, const OutputDevice&
CreatePrtFont( rOut );
const vcl::Font aOldFnt( rRefDev.GetFont() );
const_cast<OutputDevice&>(rRefDev).SetFont( *m_pPrtFont );
- m_nPrtHeight = static_cast<sal_uInt16>(rRefDev.GetTextHeight());
+ m_nPrtHeight = o3tl::narrowing<sal_uInt16>(rRefDev.GetTextHeight());
#if OSL_DEBUG_LEVEL > 0
// Check if vcl did not change the meaning of GetTextHeight
const FontMetric aOutMet( rRefDev.GetFontMetric() );
- tools::Long nTmpPrtHeight = static_cast<sal_uInt16>(aOutMet.GetAscent()) + aOutMet.GetDescent();
+ tools::Long nTmpPrtHeight = o3tl::narrowing<sal_uInt16>(aOutMet.GetAscent()) + aOutMet.GetDescent();
// #i106098#: do not compare with == here due to rounding error
OSL_ENSURE( std::abs(nTmpPrtHeight - m_nPrtHeight) < 3,
"GetTextHeight != Ascent + Descent" );
@@ -485,7 +485,7 @@ sal_uInt16 SwFntObj::GetFontLeading( const SwViewShell *pSh, const OutputDevice&
const_cast<OutputDevice&>(rOut).SetFont( aOldFnt );
m_bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet();
GuessLeading( *pSh, aMet );
- m_nExtLeading = static_cast<sal_uInt16>(aMet.GetExternalLeading());
+ m_nExtLeading = o3tl::narrowing<sal_uInt16>(aMet.GetExternalLeading());
/* HACK: FIXME There is something wrong with Writer's bullet rendering, causing lines
with bullets to be higher than they should be. I think this is because
Writer uses font's external leading incorrect, as the vertical distance
@@ -569,7 +569,7 @@ void SwFntObj::CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut )
GuessLeading( rSh, aMet );
if ( USHRT_MAX == m_nExtLeading )
- m_nExtLeading = static_cast<sal_uInt16>(aMet.GetExternalLeading());
+ m_nExtLeading = o3tl::narrowing<sal_uInt16>(aMet.GetExternalLeading());
// reset the original reference device font
pPrt->SetFont( aOldPrtFnt );
@@ -587,9 +587,9 @@ void SwFntObj::CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut )
m_pScrFont = m_pPrtFont;
}
- m_nScrAscent = static_cast<sal_uInt16>(pOut->GetFontMetric().GetAscent());
+ m_nScrAscent = o3tl::narrowing<sal_uInt16>(pOut->GetFontMetric().GetAscent());
if ( USHRT_MAX == m_nScrHeight )
- m_nScrHeight = static_cast<sal_uInt16>(pOut->GetTextHeight());
+ m_nScrHeight = o3tl::narrowing<sal_uInt16>(pOut->GetTextHeight());
// reset original output device font
pOut->SetFont( aOldOutFont );
@@ -611,7 +611,7 @@ void SwFntObj::GuessLeading( const SwViewShell&
#if defined(_WIN32)
OutputDevice *pWin = rSh.GetWin() ?
- rSh.GetWin() :
+ rSh.GetWin()->GetOutDev() :
Application::GetDefaultDevice();
if ( pWin )
{
@@ -653,7 +653,7 @@ void SwFntObj::GuessLeading( const SwViewShell&
{
OSL_ENSURE( m_nPrtAscent < USHRT_MAX, "GuessLeading: PrtAscent-Fault" );
if ( m_nPrtAscent < USHRT_MAX )
- m_nPrtAscent = m_nPrtAscent + static_cast<sal_uInt16>(( 2 * nDiff ) / 5);
+ m_nPrtAscent = m_nPrtAscent + o3tl::narrowing<sal_uInt16>(( 2 * nDiff ) / 5);
}
}
}
@@ -876,7 +876,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
OSL_ENSURE( rInf.GetShell(), "SwFntObj::DrawText without shell" );
OutputDevice& rRefDev = rInf.GetShell()->GetRefDev();
- OutputDevice* pWin = rInf.GetShell()->GetWin();
+ vcl::Window* pWin = rInf.GetShell()->GetWin();
// true if pOut is the printer and the printer has been used for formatting
const bool bPrt = OUTDEV_PRINTER == rInf.GetOut().GetOutDevType() &&
@@ -1175,7 +1175,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
lcl_IsMonoSpaceFont( *(rInf.GetpOut()) ) )
{
pSI->Compress( pKernArray.get(), rInf.GetIdx(), rInf.GetLen(),
- rInf.GetKanaComp(), static_cast<sal_uInt16>(m_aFont.GetFontSize().Height()), lcl_IsFullstopCentered( rInf.GetOut() ) , &aTextOriginPos );
+ rInf.GetKanaComp(), o3tl::narrowing<sal_uInt16>(m_aFont.GetFontSize().Height()), lcl_IsFullstopCentered( rInf.GetOut() ) , &aTextOriginPos );
bSpecialJust = true;
}
///Asian Justification
@@ -1342,7 +1342,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
{
pSI->Compress( pKernArray.get(), rInf.GetIdx(), rInf.GetLen(),
rInf.GetKanaComp(),
- static_cast<sal_uInt16>(m_aFont.GetFontSize().Height()), lcl_IsFullstopCentered( rInf.GetOut() ), &aTextOriginPos );
+ o3tl::narrowing<sal_uInt16>(m_aFont.GetFontSize().Height()), lcl_IsFullstopCentered( rInf.GetOut() ), &aTextOriginPos );
bSpecialJust = true;
}
@@ -1551,10 +1551,10 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
Point aTmpPos( aTextOriginPos );
pSI->Compress( pScrArray.get(), rInf.GetIdx(), rInf.GetLen(),
rInf.GetKanaComp(),
- static_cast<sal_uInt16>(m_aFont.GetFontSize().Height()), lcl_IsFullstopCentered( rInf.GetOut() ), &aTmpPos );
+ o3tl::narrowing<sal_uInt16>(m_aFont.GetFontSize().Height()), lcl_IsFullstopCentered( rInf.GetOut() ), &aTmpPos );
pSI->Compress( pKernArray.get(), rInf.GetIdx(), rInf.GetLen(),
rInf.GetKanaComp(),
- static_cast<sal_uInt16>(m_aFont.GetFontSize().Height()), lcl_IsFullstopCentered( rInf.GetOut() ), &aTextOriginPos );
+ o3tl::narrowing<sal_uInt16>(m_aFont.GetFontSize().Height()), lcl_IsFullstopCentered( rInf.GetOut() ), &aTextOriginPos );
}
// Asian Justification
@@ -2029,7 +2029,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
if( bCompress )
rInf.SetKanaDiff( rInf.GetScriptInfo()->Compress( pKernArray.get(),
rInf.GetIdx(), nLn, rInf.GetKanaComp(),
- static_cast<sal_uInt16>(m_aFont.GetFontSize().Height()) ,lcl_IsFullstopCentered( rInf.GetOut() ) ) );
+ o3tl::narrowing<sal_uInt16>(m_aFont.GetFontSize().Height()) ,lcl_IsFullstopCentered( rInf.GetOut() ) ) );
else
rInf.SetKanaDiff( 0 );
@@ -2091,7 +2091,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
sal_Int32(rInf.GetIdx()), sal_Int32(nLn));
rInf.SetKanaDiff( rInf.GetScriptInfo()->Compress( pKernArray.get(),
rInf.GetIdx(), nLn, rInf.GetKanaComp(),
- static_cast<sal_uInt16>(m_aFont.GetFontSize().Height()) ,lcl_IsFullstopCentered( rInf.GetOut() ) ) );
+ o3tl::narrowing<sal_uInt16>(m_aFont.GetFontSize().Height()) ,lcl_IsFullstopCentered( rInf.GetOut() ) ) );
aTextSize.setWidth( pKernArray[sal_Int32(nLn) - 1] );
}
else
@@ -2151,7 +2151,7 @@ TextFrameIndex SwFntObj::GetModelPositionForViewPoint(SwDrawTextInfo &rInf)
{
pSI->Compress( pKernArray.get(), rInf.GetIdx(), rInf.GetLen(),
rInf.GetKanaComp(),
- static_cast<sal_uInt16>(m_aFont.GetFontSize().Height()),
+ o3tl::narrowing<sal_uInt16>(m_aFont.GetFontSize().Height()),
lcl_IsFullstopCentered( rInf.GetOut() ) );
}
@@ -2590,7 +2590,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe
rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
sal_Int32(rInf.GetIdx()), sal_Int32(nLn));
if( rInf.GetScriptInfo()->Compress( pKernArray.get(), rInf.GetIdx(), nLn,
- rInf.GetKanaComp(), static_cast<sal_uInt16>(GetHeight( m_nActual )),
+ rInf.GetKanaComp(), o3tl::narrowing<sal_uInt16>(GetHeight( m_nActual )),
lcl_IsFullstopCentered( rInf.GetOut() ) ) )
{
tools::Long nKernAdd = nKern;
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 66e8014dc183..16b054102c53 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -482,7 +482,7 @@ void SwSubFont::DrawStretchCapital( SwDrawTextInfo &rInf )
rInf.SetLen(TextFrameIndex(rInf.GetText().getLength()));
const Point aOldPos = rInf.GetPos();
- const sal_uInt16 nCapWidth = static_cast<sal_uInt16>( GetCapitalSize( rInf ).Width() );
+ const sal_uInt16 nCapWidth = o3tl::narrowing<sal_uInt16>( GetCapitalSize( rInf ).Width() );
rInf.SetPos(aOldPos);
rInf.SetDrawSpace( GetUnderline() != LINESTYLE_NONE ||
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 161c22ea2ea0..cb3a7d9830b2 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -570,18 +570,15 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
}
else
{
- SwWrongList *pList = GetWrong();
- SetWrong( nullptr, false );
+ std::unique_ptr<SwWrongList> pList = ReleaseWrong();
SetWrongDirty(WrongState::TODO);
- SwGrammarMarkUp *pList3 = GetGrammarCheck();
- SetGrammarCheck( nullptr, false );
+ std::unique_ptr<SwGrammarMarkUp> pList3 = ReleaseGrammarCheck();
SetGrammarCheckDirty( true );
SetWordCountDirty( true );
- SwWrongList *pList2 = GetSmartTags();
- SetSmartTags( nullptr, false );
+ std::unique_ptr<SwWrongList> pList2 = ReleaseSmartTags();
SetSmartTagDirty( true );
SwIndex aIdx( this );
@@ -607,19 +604,19 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
if( pList )
{
pNode->SetWrong( pList->SplitList( nSplitPos ) );
- SetWrong( pList, false );
+ SetWrong( std::move(pList) );
}
if( pList3 )
{
pNode->SetGrammarCheck( pList3->SplitGrammarList( nSplitPos ) );
- SetGrammarCheck( pList3, false );
+ SetGrammarCheck( std::move(pList3) );
}
if( pList2 )
{
pNode->SetSmartTags( pList2->SplitList( nSplitPos ) );
- SetSmartTags( pList2, false );
+ SetSmartTags( std::move(pList2) );
}
if (pContentIndexRestore)
@@ -923,7 +920,7 @@ bool HasNumberingWhichNeedsLayoutUpdate(const SwTextNode& rTextNode)
}
const SwNumFormat* pFormat
- = pNumRule->GetNumFormat(static_cast<sal_uInt16>(rTextNode.GetAttrListLevel()));
+ = pNumRule->GetNumFormat(o3tl::narrowing<sal_uInt16>(rTextNode.GetAttrListLevel()));
if (!pFormat)
{
return false;
@@ -956,57 +953,51 @@ SwContentNode *SwTextNode::JoinNext()
// METADATA: merge
JoinMetadatable(*pTextNode, !Len(), !pTextNode->Len());
- SwWrongList *pList = GetWrong();
+ std::unique_ptr<SwWrongList> pList = ReleaseWrong();
if( pList )
{
pList->JoinList( pTextNode->GetWrong(), nOldLen );
SetWrongDirty(WrongState::TODO);
- SetWrong( nullptr, false );
}
else
{
- pList = pTextNode->GetWrong();
+ pList = pTextNode->ReleaseWrong();
if( pList )
{
pList->Move( 0, nOldLen );
SetWrongDirty(WrongState::TODO);
- pTextNode->SetWrong( nullptr, false );
}
}
- SwGrammarMarkUp *pList3 = GetGrammarCheck();
+ std::unique_ptr<SwGrammarMarkUp> pList3 = ReleaseGrammarCheck();
if( pList3 )
{
pList3->JoinGrammarList( pTextNode->GetGrammarCheck(), nOldLen );
SetGrammarCheckDirty( true );
- SetGrammarCheck( nullptr, false );
}
else
{
- pList3 = pTextNode->GetGrammarCheck();
+ pList3 = pTextNode->ReleaseGrammarCheck();
if( pList3 )
{
pList3->MoveGrammar( 0, nOldLen );
SetGrammarCheckDirty( true );
- pTextNode->SetGrammarCheck( nullptr, false );
}
}
- SwWrongList *pList2 = GetSmartTags();
+ std::unique_ptr<SwWrongList> pList2 = ReleaseSmartTags();
if( pList2 )
{
pList2->JoinList( pTextNode->GetSmartTags(), nOldLen );
SetSmartTagDirty( true );
- SetSmartTags( nullptr, false );
}
else
{
- pList2 = pTextNode->GetSmartTags();
+ pList2 = pTextNode->ReleaseSmartTags();
if( pList2 )
{
pList2->Move( 0, nOldLen );
SetSmartTagDirty( true );
- pTextNode->SetSmartTags( nullptr, false );
}
}
@@ -1026,9 +1017,9 @@ SwContentNode *SwTextNode::JoinNext()
bool bOldHasNumberingWhichNeedsLayoutUpdate = HasNumberingWhichNeedsLayoutUpdate(*pTextNode);
rNds.Delete(aIdx);
- SetWrong( pList, false );
- SetGrammarCheck( pList3, false );
- SetSmartTags( pList2, false );
+ SetWrong( std::move(pList) );
+ SetGrammarCheck( std::move(pList3) );
+ SetSmartTags( std::move(pList2) );
if (bOldHasNumberingWhichNeedsLayoutUpdate || HasNumberingWhichNeedsLayoutUpdate(*this))
{
@@ -1060,60 +1051,54 @@ void SwTextNode::JoinPrev()
SwTextNode *pTextNode = aIdx.GetNode().GetTextNode();
const sal_Int32 nLen = pTextNode->Len();
- SwWrongList *pList = pTextNode->GetWrong();
+ std::unique_ptr<SwWrongList> pList = pTextNode->ReleaseWrong();
if( pList )
{
pList->JoinList( GetWrong(), Len() );
SetWrongDirty(WrongState::TODO);
- pTextNode->SetWrong( nullptr, false );
- SetWrong( nullptr );
+ ClearWrong();
}
else
{
- pList = GetWrong();
+ pList = ReleaseWrong();
if( pList )
{
pList->Move( 0, nLen );
SetWrongDirty(WrongState::TODO);
- SetWrong( nullptr, false );
}
}
- SwGrammarMarkUp *pList3 = pTextNode->GetGrammarCheck();
+ std::unique_ptr<SwGrammarMarkUp> pList3 = pTextNode->ReleaseGrammarCheck();
if( pList3 )
{
pList3->JoinGrammarList( GetGrammarCheck(), Len() );
SetGrammarCheckDirty( true );
- pTextNode->SetGrammarCheck( nullptr, false );
- SetGrammarCheck( nullptr );
+ ClearGrammarCheck();
}
else
{
- pList3 = GetGrammarCheck();
+ pList3 = ReleaseGrammarCheck();
if( pList3 )
{
pList3->MoveGrammar( 0, nLen );
SetGrammarCheckDirty( true );
- SetGrammarCheck( nullptr, false );
}
}
- SwWrongList *pList2 = pTextNode->GetSmartTags();
+ std::unique_ptr<SwWrongList> pList2 = pTextNode->ReleaseSmartTags();
if( pList2 )
{
pList2->JoinList( GetSmartTags(), Len() );
SetSmartTagDirty( true );
- pTextNode->SetSmartTags( nullptr, false );
- SetSmartTags( nullptr );
+ ClearSmartTags();
}
else
{
- pList2 = GetSmartTags();
+ pList2 = ReleaseSmartTags();
if( pList2 )
{
pList2->Move( 0, nLen );
SetSmartTagDirty( true );
- SetSmartTags( nullptr, false );
}
}
@@ -1136,9 +1121,9 @@ void SwTextNode::JoinPrev()
sw::MoveDeletedPrevFrames(*pTextNode, *this);
}
rNds.Delete(aIdx);
- SetWrong( pList, false );
- SetGrammarCheck( pList3, false );
- SetSmartTags( pList2, false );
+ SetWrong( std::move(pList) );
+ SetGrammarCheck( std::move(pList3) );
+ SetSmartTags( std::move(pList2) );
InvalidateNumRule();
sw::CheckResetRedlineMergeFlag(*this,
eOldMergeFlag == SwNode::Merge::NonFirst
@@ -1462,10 +1447,10 @@ void SwTextNode::Update(
}
}
#endif
- std::vector<SwFrameFormat*> const*const pFlys(GetAnchoredFlys());
- for (size_t i = 0; pFlys && i != pFlys->size(); ++i)
+ std::vector<SwFrameFormat*> const& rFlys(GetAnchoredFlys());
+ for (size_t i = 0; i != rFlys.size(); ++i)
{
- SwFrameFormat const*const pFormat = (*pFlys)[i];
+ SwFrameFormat const*const pFormat = rFlys[i];
const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
const SwPosition* pContentAnchor = rAnchor.GetContentAnchor();
if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR && pContentAnchor)
@@ -3077,7 +3062,7 @@ namespace
sal_uInt16 lcl_BoundListLevel(const int nActualLevel)
{
- return static_cast<sal_uInt16>( std::clamp( nActualLevel, 0, MAXLEVEL-1 ) );
+ return o3tl::narrowing<sal_uInt16>( std::clamp( nActualLevel, 0, MAXLEVEL-1 ) );
}
}
@@ -4030,20 +4015,16 @@ void SwTextNode::SetAttrOutlineLevel(int nLevel)
if ( 0 <= nLevel && nLevel <= MAXLEVEL )
{
SetAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL,
- static_cast<sal_uInt16>(nLevel) ) );
+ o3tl::narrowing<sal_uInt16>(nLevel) ) );
}
}
-bool SwTextNode::GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr)
+void SwTextNode::GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr)
{
- SfxGrabBagItem aGrabBagItem(dynamic_cast<const SfxGrabBagItem&>(GetAttr(RES_PARATR_GRABBAG)));
- auto it = aGrabBagItem.GetGrabBag().find("OutlineContentVisibleAttr");
- if (it != aGrabBagItem.GetGrabBag().end())
- {
+ const SfxGrabBagItem & rGrabBagItem = dynamic_cast<const SfxGrabBagItem&>(GetAttr(RES_PARATR_GRABBAG));
+ auto it = rGrabBagItem.GetGrabBag().find("OutlineContentVisibleAttr");
+ if (it != rGrabBagItem.GetGrabBag().end())
it->second >>= bOutlineContentVisibleAttr;
- return true;
- }
- return false;
}
void SwTextNode::SetAttrOutlineContentVisible(bool bVisible)
@@ -4204,7 +4185,7 @@ SwNumberTree::tSwNumTreeNumber SwTextNode::GetActualListStartValue() const
if ( pRule )
{
const SwNumFormat* pFormat =
- pRule->GetNumFormat( static_cast<sal_uInt16>(GetAttrListLevel()) );
+ pRule->GetNumFormat( o3tl::narrowing<sal_uInt16>(GetAttrListLevel()) );
if ( pFormat )
{
nListRestartValue = pFormat->GetStart();
@@ -4483,7 +4464,7 @@ bool SwTextNode::GetListTabStopPosition( tools::Long& nListTabStopPosition ) con
const SwNumRule* pNumRule = GetNum() ? GetNum()->GetNumRule() : nullptr;
if ( pNumRule && HasVisibleNumberingOrBullet() && GetActualListLevel() >= 0 )
{
- const SwNumFormat& rFormat = pNumRule->Get( static_cast<sal_uInt16>(GetActualListLevel()) );
+ const SwNumFormat& rFormat = pNumRule->Get( o3tl::narrowing<sal_uInt16>(GetActualListLevel()) );
if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
rFormat.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
{
@@ -4515,7 +4496,7 @@ OUString SwTextNode::GetLabelFollowedBy() const
const SwNumRule* pNumRule = GetNum() ? GetNum()->GetNumRule() : nullptr;
if ( pNumRule && HasVisibleNumberingOrBullet() && GetActualListLevel() >= 0 )
{
- const SwNumFormat& rFormat = pNumRule->Get( static_cast<sal_uInt16>(GetActualListLevel()) );
+ const SwNumFormat& rFormat = pNumRule->Get( o3tl::narrowing<sal_uInt16>(GetActualListLevel()) );
if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
switch ( rFormat.GetLabelFollowedBy() )
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 967f6336186d..620c0d67682a 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1081,7 +1081,7 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
const sal_uInt16 nAscent = pLastFont->GetFontAscent( rInf.GetShell(),
rInf.GetOut() );
aTextSize.setHeight(
- static_cast<tools::Long>(CalcEscHeight( static_cast<sal_uInt16>(aTextSize.Height()), nAscent)) );
+ static_cast<tools::Long>(CalcEscHeight( o3tl::narrowing<sal_uInt16>(aTextSize.Height()), nAscent)) );
}
}
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 41e9adefd9d5..acf8ba4b9eeb 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1821,67 +1821,6 @@ bool SwTextNode::IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich, bool b
|| nWhich == RES_CHRATR_ESCAPEMENT);
}
-//In MS Word, following properties of the paragraph end position won't affect the formatting of bullets, so we ignore them:
-//Font underline;
-//Font Italic of Western, CJK and CTL;
-//Font Bold of Wertern, CJK and CTL;
-static bool lcl_IsIgnoredCharFormatForBullets(const sal_uInt16 nWhich)
-{
- return (nWhich == RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_POSTURE || nWhich == RES_CHRATR_WEIGHT
- || nWhich == RES_CHRATR_CJK_POSTURE || nWhich == RES_CHRATR_CJK_WEIGHT
- || nWhich == RES_CHRATR_CTL_POSTURE || nWhich == RES_CHRATR_CTL_WEIGHT);
-}
-
-//Condition for expanding char set to character style of specified number rule level:
-//The item inside the set should not conflict to any exist and non-default item inside paragraph properties set (SwContentNode::SwPAttrSet);
-//The node should have applied a number rule;
-//The node should be counted in a list, if not, make it to be;
-//The item should not conflict to any exist and non-default item inside the character of specified number rule level;
-//The item should not be ignored depend on the exact number rule type;
-void SwTextNode::TryCharSetExpandToNum(const SfxItemSet& aCharSet)
-{
- SfxItemIter aIter( aCharSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- if (!pItem)
- return;
- const sal_uInt16 nWhich = pItem->Which();
-
- const SfxPoolItem& rInnerItem = GetAttr(nWhich,false);
-
- if (!IsDefaultItem(&rInnerItem) && !IsInvalidItem(&rInnerItem))
- return;
-
- if (!IsInList() && GetNumRule() && !GetListId().isEmpty())
- {
- return;
- }
-
- SwNumRule* pCurrNum = GetNumRule(false);
-
- int nLevel = GetActualListLevel();
-
- if (!(nLevel != -1 && pCurrNum))
- return;
-
- const SwNumFormat* pCurrNumFormat = pCurrNum->GetNumFormat(static_cast<sal_uInt16>(nLevel));
- if (!pCurrNumFormat)
- return;
-
- if (pCurrNumFormat->IsItemize() && lcl_IsIgnoredCharFormatForBullets(nWhich))
- return;
- if (pCurrNumFormat->IsEnumeration() && SwTextNode::IsIgnoredCharFormatForNumbering(nWhich))
- return;
- SwCharFormat* pCurrCharFormat =pCurrNumFormat->GetCharFormat();
-
- if (pCurrCharFormat && pCurrCharFormat->GetItemState(nWhich,false) != SfxItemState::SET)
- {
- pCurrCharFormat->SetFormatAttr(*pItem);
- SwNumFormat aNewNumFormat(*pCurrNumFormat);
- aNewNumFormat.SetCharFormat(pCurrCharFormat);
- pCurrNum->Set(nLevel,aNewNumFormat);
- }
-}
-
// Set these attributes on SwTextNode. If they apply to the entire paragraph
// text, set them in the SwTextNode's item set (SwContentNode::SetAttr).
bool SwTextNode::SetAttr(
@@ -2101,7 +2040,7 @@ static void lcl_MergeListLevelIndentAsLRSpaceItem( const SwTextNode& rTextNode,
const SwNumRule* pRule = rTextNode.GetNumRule();
if ( pRule && rTextNode.GetActualListLevel() >= 0 )
{
- const SwNumFormat& rFormat = pRule->Get(static_cast<sal_uInt16>(rTextNode.GetActualListLevel()));
+ const SwNumFormat& rFormat = pRule->Get(o3tl::narrowing<sal_uInt16>(rTextNode.GetActualListLevel()));
if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
SvxLRSpaceItem aLR( RES_LR_SPACE );
@@ -2183,7 +2122,7 @@ bool SwTextNode::GetParaAttr(SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
else // a query range is defined
{
// #i75299#
- std::unique_ptr< std::vector< SwPoolItemEndPair > > pAttrArr;
+ std::optional< std::vector< SwPoolItemEndPair > > pAttrArr;
const size_t coArrSz = RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN;
@@ -2243,8 +2182,7 @@ bool SwTextNode::GetParaAttr(SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
if (!pAttrArr)
{
- pAttrArr.reset(
- new std::vector< SwPoolItemEndPair >(coArrSz));
+ pAttrArr = std::vector< SwPoolItemEndPair >(coArrSz);
}
std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin();
@@ -2303,7 +2241,7 @@ bool SwTextNode::GetParaAttr(SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
if( rItemPair.mpItem && !IsInvalidItem(rItemPair.mpItem) )
{
const sal_uInt16 nWh =
- static_cast<sal_uInt16>(n + RES_CHRATR_BEGIN);
+ o3tl::narrowing<sal_uInt16>(n + RES_CHRATR_BEGIN);
if (nEnd <= rItemPair.mnEndPos) // behind or exactly end
{
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index f9d23617ece3..71cbb16e2be7 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -231,7 +231,7 @@ SwCharFormat* SwTextRuby::GetCharFormat()
const SwDoc& rDoc = GetTextNode().GetDoc();
const OUString& rStr = rFormat.GetCharFormatName();
const sal_uInt16 nId = rStr.isEmpty()
- ? static_cast<sal_uInt16>(RES_POOLCHR_RUBYTEXT)
+ ? o3tl::narrowing<sal_uInt16>(RES_POOLCHR_RUBYTEXT)
: rFormat.GetCharFormatId();
// JP 10.02.2000, Bug 72806: don't modify the doc for getting the
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 853632d30771..8913fbd94810 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -99,9 +99,9 @@ namespace
struct SwParaIdleData_Impl
{
- SwWrongList* pWrong; // for spell checking
- SwGrammarMarkUp* pGrammarCheck; // for grammar checking / proof reading
- SwWrongList* pSmartTags;
+ std::unique_ptr<SwWrongList> pWrong; // for spell checking
+ std::unique_ptr<SwGrammarMarkUp> pGrammarCheck; // for grammar checking / proof reading
+ std::unique_ptr<SwWrongList> pSmartTags;
sal_uLong nNumberOfWords;
sal_uLong nNumberOfAsianWords;
sal_uLong nNumberOfChars;
@@ -113,9 +113,6 @@ struct SwParaIdleData_Impl
bool bAutoComplDirty; ///< auto complete list dirty
SwParaIdleData_Impl() :
- pWrong ( nullptr ),
- pGrammarCheck ( nullptr ),
- pSmartTags ( nullptr ),
nNumberOfWords ( 0 ),
nNumberOfAsianWords ( 0 ),
nNumberOfChars ( 0 ),
@@ -1071,15 +1068,10 @@ void SwTextNode::SetLanguageAndFont( const SwPaM &rPaM,
LanguageType nLang, sal_uInt16 nLangWhichId,
const vcl::Font *pFont, sal_uInt16 nFontWhichId )
{
- sal_uInt16 aRanges[] = {
- nLangWhichId, nLangWhichId,
- nFontWhichId, nFontWhichId,
- 0, 0, 0 };
- if (!pFont)
- aRanges[2] = aRanges[3] = 0; // clear entries with font WhichId
-
SwEditShell *pEditShell = GetDoc().GetEditShell();
- SfxItemSet aSet( pEditShell->GetAttrPool(), aRanges );
+ SfxItemSet aSet(pEditShell->GetAttrPool(), { { nLangWhichId, nLangWhichId } });
+ if (pFont)
+ aSet.MergeRange(nFontWhichId, nFontWhichId); // Keep it sorted
aSet.Put( SvxLanguageItem( nLang, nLangWhichId ) );
OSL_ENSURE( pFont, "target font missing?" );
@@ -1343,7 +1335,7 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos)
{
if( !pNode->GetWrong() )
{
- pNode->SetWrong( new SwWrongList( WRONGLIST_SPELL ) );
+ pNode->SetWrong( std::make_unique<SwWrongList>( WRONGLIST_SPELL ) );
pNode->GetWrong()->SetInvalid( 0, nEnd );
}
SwWrongList::FreshState const eState(pNode->GetWrong()->Fresh(
@@ -1403,7 +1395,7 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos)
: SwTextNode::WrongState::TODO)
: SwTextNode::WrongState::DONE);
if( !pNode->GetWrong()->Count() && ! pNode->IsWrongDirty() )
- pNode->SetWrong( nullptr );
+ pNode->ClearWrong();
}
else
pNode->SetWrongDirty(SwTextNode::WrongState::DONE);
@@ -1524,7 +1516,7 @@ SwRect SwTextFrame::SmartTagScan(SwTextNode & rNode)
pNode->SetSmartTagDirty( COMPLETE_STRING != pSmartTagList->GetBeginInv() );
if( !pSmartTagList->Count() && !pNode->IsSmartTagDirty() )
- pNode->SetSmartTags( nullptr );
+ pNode->ClearSmartTags();
// Calculate repaint area:
if ( nBegin < nEnd && ( 0 != nNumberOfRemovedEntries ||
@@ -2166,52 +2158,62 @@ void SwTextNode::InitSwParaStatistics( bool bNew )
}
else if ( m_pParaIdleData_Impl )
{
- delete m_pParaIdleData_Impl->pWrong;
- delete m_pParaIdleData_Impl->pGrammarCheck;
- delete m_pParaIdleData_Impl->pSmartTags;
+ m_pParaIdleData_Impl->pWrong.reset();
+ m_pParaIdleData_Impl->pGrammarCheck.reset();
+ m_pParaIdleData_Impl->pSmartTags.reset();
delete m_pParaIdleData_Impl;
m_pParaIdleData_Impl = nullptr;
}
}
-void SwTextNode::SetWrong( SwWrongList* pNew, bool bDelete )
+void SwTextNode::SetWrong( std::unique_ptr<SwWrongList> pNew )
{
if ( m_pParaIdleData_Impl )
- {
- if ( bDelete )
- {
- delete m_pParaIdleData_Impl->pWrong;
- }
- m_pParaIdleData_Impl->pWrong = pNew;
- }
+ m_pParaIdleData_Impl->pWrong = std::move(pNew);
+}
+
+void SwTextNode::ClearWrong()
+{
+ if ( m_pParaIdleData_Impl )
+ m_pParaIdleData_Impl->pWrong.reset();
+}
+
+std::unique_ptr<SwWrongList> SwTextNode::ReleaseWrong()
+{
+ return m_pParaIdleData_Impl ? std::move(m_pParaIdleData_Impl->pWrong) : nullptr;
}
SwWrongList* SwTextNode::GetWrong()
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pWrong : nullptr;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pWrong.get() : nullptr;
}
// #i71360#
const SwWrongList* SwTextNode::GetWrong() const
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pWrong : nullptr;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pWrong.get() : nullptr;
}
-void SwTextNode::SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete )
+void SwTextNode::SetGrammarCheck( std::unique_ptr<SwGrammarMarkUp> pNew )
{
if ( m_pParaIdleData_Impl )
- {
- if ( bDelete )
- {
- delete m_pParaIdleData_Impl->pGrammarCheck;
- }
- m_pParaIdleData_Impl->pGrammarCheck = pNew;
- }
+ m_pParaIdleData_Impl->pGrammarCheck = std::move(pNew);
+}
+
+void SwTextNode::ClearGrammarCheck()
+{
+ if ( m_pParaIdleData_Impl )
+ m_pParaIdleData_Impl->pGrammarCheck.reset();
+}
+
+std::unique_ptr<SwGrammarMarkUp> SwTextNode::ReleaseGrammarCheck()
+{
+ return m_pParaIdleData_Impl ? std::move(m_pParaIdleData_Impl->pGrammarCheck) : nullptr;
}
SwGrammarMarkUp* SwTextNode::GetGrammarCheck()
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pGrammarCheck : nullptr;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pGrammarCheck.get() : nullptr;
}
SwWrongList const* SwTextNode::GetGrammarCheck() const
@@ -2219,24 +2221,29 @@ SwWrongList const* SwTextNode::GetGrammarCheck() const
return static_cast<SwWrongList const*>(const_cast<SwTextNode*>(this)->GetGrammarCheck());
}
-void SwTextNode::SetSmartTags( SwWrongList* pNew, bool bDelete )
+void SwTextNode::SetSmartTags( std::unique_ptr<SwWrongList> pNew )
{
OSL_ENSURE( !pNew || SwSmartTagMgr::Get().IsSmartTagsEnabled(),
"Weird - we have a smart tag list without any recognizers?" );
if ( m_pParaIdleData_Impl )
- {
- if ( bDelete )
- {
- delete m_pParaIdleData_Impl->pSmartTags;
- }
- m_pParaIdleData_Impl->pSmartTags = pNew;
- }
+ m_pParaIdleData_Impl->pSmartTags = std::move(pNew);
+}
+
+void SwTextNode::ClearSmartTags()
+{
+ if ( m_pParaIdleData_Impl )
+ m_pParaIdleData_Impl->pSmartTags.reset();
+}
+
+std::unique_ptr<SwWrongList> SwTextNode::ReleaseSmartTags()
+{
+ return m_pParaIdleData_Impl ? std::move(m_pParaIdleData_Impl->pSmartTags) : nullptr;
}
SwWrongList* SwTextNode::GetSmartTags()
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pSmartTags : nullptr;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pSmartTags.get() : nullptr;
}
SwWrongList const* SwTextNode::GetSmartTags() const
diff --git a/sw/source/core/undo/SwUndoFmt.cxx b/sw/source/core/undo/SwUndoFmt.cxx
index 818cf7e751e1..110f138f5f3b 100644
--- a/sw/source/core/undo/SwUndoFmt.cxx
+++ b/sw/source/core/undo/SwUndoFmt.cxx
@@ -31,7 +31,7 @@
SwUndoFormatCreate::SwUndoFormatCreate
(SwUndoId nUndoId, SwFormat * _pNew, SwFormat const * _pDerivedFrom, SwDoc& rDoc)
: SwUndo(nUndoId, &rDoc), m_pNew(_pNew),
- m_rDoc(rDoc), m_pNewSet(nullptr), m_nId(0), m_bAuto(false)
+ m_rDoc(rDoc), m_nId(0), m_bAuto(false)
{
if (_pDerivedFrom)
m_sDerivedFrom = _pDerivedFrom->GetName();
@@ -54,7 +54,7 @@ void SwUndoFormatCreate::UndoImpl(::sw::UndoRedoContext &)
if (m_pNew)
{
- m_pNewSet = new SfxItemSet(m_pNew->GetAttrSet());
+ m_pNewSet.reset(new SfxItemSet(m_pNew->GetAttrSet()));
m_nId = m_pNew->GetPoolFormatId() & COLL_GET_RANGE_BITS;
m_bAuto = m_pNew->IsAuto();
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 40ca36552139..aa2d2d624fd2 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -102,7 +102,7 @@ void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & rContext, bool bShowSelFrame)
if (RndStdIds::FLY_AT_PAGE == m_nRndId)
{
- aAnchor.SetPageNum( static_cast<sal_uInt16>(m_nNodePagePos) );
+ aAnchor.SetPageNum( o3tl::narrowing<sal_uInt16>(m_nNodePagePos) );
}
else
{
diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx
index c29e4a9a7713..fc7efcdfec70 100644
--- a/sw/source/core/undo/undraw.cxx
+++ b/sw/source/core/undo/undraw.cxx
@@ -298,7 +298,7 @@ void SwUndoDrawGroup::SetGroupFormat( SwDrawFrameFormat* pFormat )
SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup* pObj, const SwDoc& rDoc )
: SwUndo( SwUndoId::DRAWUNGROUP, &rDoc ), m_bDeleteFormat( false )
{
- m_nSize = static_cast<sal_uInt16>(pObj->GetSubList()->GetObjCount()) + 1;
+ m_nSize = o3tl::narrowing<sal_uInt16>(pObj->GetSubList()->GetObjCount()) + 1;
m_pObjArray.reset( new SwUndoGroupObjImpl[ m_nSize ] );
SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index aed2397937c7..cf09ad827d82 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -342,7 +342,7 @@ SwUndoNumRuleStart::SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt
{
if ( pTextNd->HasAttrListRestartValue() )
{
- m_nOldStart = static_cast<sal_uInt16>(pTextNd->GetAttrListRestartValue());
+ m_nOldStart = o3tl::narrowing<sal_uInt16>(pTextNd->GetAttrListRestartValue());
}
else
{
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 0b806e476f6d..ee509e6b602c 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -929,7 +929,7 @@ sal_uInt16 SaveTable::AddFormat( SwFrameFormat* pFormat, bool bIsLine )
m_aSets.push_back(pSet);
m_aFrameFormats.insert(m_aFrameFormats.begin() + nRet, pFormat);
}
- return static_cast<sal_uInt16>(nRet);
+ return o3tl::narrowing<sal_uInt16>(nRet);
}
void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox )
@@ -1491,7 +1491,7 @@ void SwUndoTableNdsChg::SaveNewBoxes( const SwTableNode& rTableNd,
const SwTableSortBoxes& rTableBoxes = rTable.GetTabSortBoxes();
OSL_ENSURE( ! IsDelBox(), "wrong Action" );
- m_pNewSttNds.reset( new std::set<BoxMove> );
+ m_xNewSttNds.emplace();
size_t i = 0;
for (size_t n = 0; n < rOld.size(); ++i)
@@ -1500,12 +1500,12 @@ void SwUndoTableNdsChg::SaveNewBoxes( const SwTableNode& rTableNd,
++n;
else
// new box: insert sorted
- m_pNewSttNds->insert( BoxMove(rTableBoxes[ i ]->GetSttIdx()) );
+ m_xNewSttNds->insert( BoxMove(rTableBoxes[ i ]->GetSttIdx()) );
}
for( ; i < rTableBoxes.size(); ++i )
// new box: insert sorted
- m_pNewSttNds->insert( BoxMove(rTableBoxes[ i ]->GetSttIdx()) );
+ m_xNewSttNds->insert( BoxMove(rTableBoxes[ i ]->GetSttIdx()) );
}
static SwTableLine* lcl_FindTableLine( const SwTable& rTable,
@@ -1543,7 +1543,7 @@ void SwUndoTableNdsChg::SaveNewBoxes( const SwTableNode& rTableNd,
const SwTableSortBoxes& rTableBoxes = rTable.GetTabSortBoxes();
OSL_ENSURE( ! IsDelBox(), "wrong Action" );
- m_pNewSttNds.reset( new std::set<BoxMove> );
+ m_xNewSttNds.emplace();
OSL_ENSURE( rTable.IsNewModel() || rOld.size() + m_nCount * rBoxes.size() == rTableBoxes.size(),
"unexpected boxes" );
@@ -1610,7 +1610,7 @@ void SwUndoTableNdsChg::SaveNewBoxes( const SwTableNode& rTableNd,
( nNodes != ( pSourceBox->GetSttNd()->EndOfSectionIndex() -
pSourceBox->GetSttIdx() ) )
&& ( nNodes - 1 > nLineDiff );
- m_pNewSttNds->insert( BoxMove(pBox->GetSttIdx(), bNodesMoved) );
+ m_xNewSttNds->insert( BoxMove(pBox->GetSttIdx(), bNodesMoved) );
}
}
}
@@ -1669,11 +1669,11 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
}
m_pDelSects->clear();
}
- else if( !m_pNewSttNds->empty() )
+ else if( !m_xNewSttNds->empty() )
{
// Then the nodes have be moved and not deleted!
// But for that we need a temp array.
- std::vector<BoxMove> aTmp( m_pNewSttNds->begin(), m_pNewSttNds->end() );
+ std::vector<BoxMove> aTmp( m_xNewSttNds->begin(), m_xNewSttNds->end() );
// backwards
for (size_t n = aTmp.size(); n > 0 ; )
@@ -1722,7 +1722,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
{
// Remove nodes from nodes array (backwards!)
std::set<BoxMove>::reverse_iterator it;
- for( it = m_pNewSttNds->rbegin(); it != m_pNewSttNds->rend(); ++it )
+ for( it = m_xNewSttNds->rbegin(); it != m_xNewSttNds->rend(); ++it )
{
sal_uLong nIdx = (*it).index;
SwTableBox* pBox = pTableNd->GetTable().GetTableBox( nIdx );
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 5fd92fe63eca..fc30657333b9 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -36,10 +36,10 @@
namespace sw {
-std::unique_ptr<std::vector<SwFrameFormat*>>
+std::optional<std::vector<SwFrameFormat*>>
GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong const nSttNode)
{
- std::unique_ptr<std::vector<SwFrameFormat*>> pFrameFormats;
+ std::optional<std::vector<SwFrameFormat*>> pFrameFormats;
const size_t nArrLen = rDoc.GetSpzFrameFormats()->size();
for (size_t n = 0; n < nArrLen; ++n)
{
@@ -52,7 +52,7 @@ GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong const nSttNode)
|| (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR)))
{
if (!pFrameFormats)
- pFrameFormats.reset( new std::vector<SwFrameFormat*> );
+ pFrameFormats.emplace();
pFrameFormats->push_back( pFormat );
}
}
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 9eaefe985b6f..e7fe4455eb8f 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -35,6 +35,7 @@
#include <o3tl/safeint.hxx>
#include <svtools/unoimap.hxx>
#include <svtools/unoevent.hxx>
+#include <svx/SvxXTextColumns.hxx>
#include <unotbl.hxx>
#include <unostyle.hxx>
#include <unofield.hxx>
@@ -792,7 +793,7 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
xRet = static_cast<cppu::OWeakObject*>(new SwXNumberingRules(rDoc));
break;
case SwServiceType::TextColumns:
- xRet = static_cast<cppu::OWeakObject*>(new SwXTextColumns);
+ xRet = SvxXTextColumns_createInstance();
break;
case SwServiceType::Defaults:
xRet = static_cast<cppu::OWeakObject*>(new SwXTextDefaults(&rDoc));
@@ -1860,7 +1861,7 @@ uno::Any SwXReferenceMarks::getByIndex(sal_Int32 nIndex)
if(0 <= nIndex && nIndex < SAL_MAX_UINT16)
{
SwFormatRefMark *const pMark = const_cast<SwFormatRefMark*>(
- GetDoc()->GetRefMark(static_cast<sal_uInt16>(nIndex)));
+ GetDoc()->GetRefMark(o3tl::narrowing<sal_uInt16>(nIndex)));
if(pMark)
{
xRef = SwXReferenceMark::CreateXReferenceMark(*GetDoc(), pMark);
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 32b449b97403..1c9f9d4b28db 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -72,6 +72,7 @@
#include <fchrfmt.hxx>
#include <editeng/editids.hrc>
#include <editeng/flstitem.hxx>
+#include <editeng/prntitem.hxx>
#include <vcl/metric.hxx>
#include <svtools/ctrltool.hxx>
#include <sfx2/docfilt.hxx>
@@ -1291,7 +1292,7 @@ void makeRedline( SwPaM const & rPaM,
SwDoc& rDoc = rPaM.GetDoc();
// Build set of attributes we want to fetch
- std::vector<sal_uInt16> aWhichPairs;
+ std::vector<std::pair<sal_uInt16, sal_uInt16>> aWhichPairs;
std::vector<SfxItemPropertyMapEntry const*> aEntries;
std::vector<uno::Any> aValues;
aEntries.reserve(aRevertProperties.getLength());
@@ -1313,15 +1314,12 @@ void makeRedline( SwPaM const & rPaM,
}
else if (rPropertyName == "NumberingRules")
{
- aWhichPairs.push_back(RES_PARATR_NUMRULE);
- aWhichPairs.push_back(RES_PARATR_NUMRULE);
+ aWhichPairs.emplace_back(RES_PARATR_NUMRULE, RES_PARATR_NUMRULE);
nNumId = aEntries.size();
}
else
{
- // FIXME: we should have some nice way of merging ranges surely ?
- aWhichPairs.push_back(pEntry->nWID);
- aWhichPairs.push_back(pEntry->nWID);
+ aWhichPairs.emplace_back(pEntry->nWID, pEntry->nWID);
if (rPropertyName == "ParaStyleName")
nStyleId = aEntries.size();
}
@@ -1333,8 +1331,9 @@ void makeRedline( SwPaM const & rPaM,
{
sal_uInt16 nStylePoolId = USHRT_MAX;
OUString sParaStyleName;
- aWhichPairs.push_back(0); // terminate
- SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs.data());
+ SfxItemSet aItemSet(rDoc.GetAttrPool(), nullptr);
+ for (const auto& [nWhich1, nWhich2] : aWhichPairs)
+ aItemSet.MergeRange(nWhich1, nWhich2);
for (size_t i = 0; i < aEntries.size(); ++i)
{
@@ -1388,7 +1387,8 @@ void makeTableRowRedline( SwTableLine& rTableLine,
std::u16string_view rRedlineType,
const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
{
- IDocumentRedlineAccess* pRedlineAccess = &rTableLine.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess();
+ SwDoc* pDoc = rTableLine.GetFrameFormat()->GetDoc();
+ IDocumentRedlineAccess* pRedlineAccess = &pDoc->getIDocumentRedlineAccess();
RedlineType eType;
if ( rRedlineType == u"TableRowInsert" )
@@ -1398,6 +1398,18 @@ void makeTableRowRedline( SwTableLine& rTableLine,
else if ( rRedlineType == u"TableRowDelete" )
{
eType = RedlineType::TableRowDelete;
+
+ // set table row property "HasTextChangesOnly" to false
+ // to handle tracked deletion of the table row on the UI
+ const SvxPrintItem *pHasTextChangesOnlyProp =
+ rTableLine.GetFrameFormat()->GetAttrSet().GetItem<SvxPrintItem>(RES_PRINT);
+ if ( !pHasTextChangesOnlyProp || pHasTextChangesOnlyProp->GetValue() )
+ {
+ SvxPrintItem aSetTracking(RES_PRINT, false);
+ SwPosition aPos( *rTableLine.GetTabBoxes()[0]->GetSttNd() );
+ SwCursor aCursor( aPos, nullptr );
+ pDoc->SetRowNotTracked( aCursor, aSetTracking );
+ }
}
else
{
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 6c336b2738fd..3348abee8fe1 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -666,7 +666,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
else
pObj->SetLayer(m_pDoc->getIDocumentDrawModelAccess().GetInvisibleControlsId());
- std::unique_ptr<SwPaM> pPam(new SwPaM(m_pDoc->GetNodes().GetEndOfContent()));
+ std::optional<SwPaM> pPam(m_pDoc->GetNodes().GetEndOfContent());
std::unique_ptr<SwUnoInternalPaM> pInternalPam;
uno::Reference< text::XTextRange > xRg;
if( pDesc && (xRg = pDesc->GetTextRange()).is() )
@@ -706,7 +706,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
aSet.Put(aAnchor);
SwPaM* pTemp = pInternalPam.get();
if ( !pTemp )
- pTemp = pPam.get();
+ pTemp = &*pPam;
UnoActionContext aAction(m_pDoc);
m_pDoc->getIDocumentContentOperations().InsertDrawObj( *pTemp, *pObj, aSet );
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 07a5b0bed2cc..a4f4cb597415 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2336,9 +2336,7 @@ uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName)
break;
case FN_UNO_ANCHOR_TYPES:
{
- uno::Sequence<text::TextContentAnchorType> aTypes(1);
- text::TextContentAnchorType* pArray = aTypes.getArray();
- pArray[0] = text::TextContentAnchorType_AS_CHARACTER;
+ uno::Sequence<text::TextContentAnchorType> aTypes { text::TextContentAnchorType_AS_CHARACTER };
aRet <<= aTypes;
}
break;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 894e4db8733b..a430d92f5b7f 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1409,7 +1409,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
}
else if(IsDescriptor())
{
- m_pProps->SetProperty(static_cast<sal_uInt16>(RES_FRAMEDIR), 0, _rValue);
+ m_pProps->SetProperty(o3tl::narrowing<sal_uInt16>(RES_FRAMEDIR), 0, _rValue);
}
return;
}
@@ -1476,16 +1476,16 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
pNoText->SetContour(nullptr);
else if(aValue >>= aParam)
{
- tools::PolyPolygon aPoly(static_cast<sal_uInt16>(aParam.getLength()));
+ tools::PolyPolygon aPoly(o3tl::narrowing<sal_uInt16>(aParam.getLength()));
for(const ::drawing::PointSequence& rPointSeq : std::as_const(aParam))
{
sal_Int32 nPoints = rPointSeq.getLength();
const ::awt::Point* pPoints = rPointSeq.getConstArray();
- tools::Polygon aSet( static_cast<sal_uInt16>(nPoints) );
+ tools::Polygon aSet( o3tl::narrowing<sal_uInt16>(nPoints) );
for(sal_Int32 j = 0; j < nPoints; j++)
{
Point aPoint(pPoints[j].X, pPoints[j].Y);
- aSet.SetPoint(aPoint, static_cast<sal_uInt16>(j));
+ aSet.SetPoint(aPoint, o3tl::narrowing<sal_uInt16>(j));
}
// Close polygon if it isn't closed already.
aSet.Optimize( PolyOptimizeFlags::CLOSE );
@@ -1988,13 +1988,14 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
if(FN_UNO_ANCHOR_TYPES == pEntry->nWID)
{
- uno::Sequence<text::TextContentAnchorType> aTypes(5);
- text::TextContentAnchorType* pArray = aTypes.getArray();
- pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
- pArray[1] = text::TextContentAnchorType_AS_CHARACTER;
- pArray[2] = text::TextContentAnchorType_AT_PAGE;
- pArray[3] = text::TextContentAnchorType_AT_FRAME;
- pArray[4] = text::TextContentAnchorType_AT_CHARACTER;
+ uno::Sequence<text::TextContentAnchorType> aTypes
+ {
+ text::TextContentAnchorType_AT_PARAGRAPH,
+ text::TextContentAnchorType_AS_CHARACTER,
+ text::TextContentAnchorType_AT_PAGE,
+ text::TextContentAnchorType_AT_FRAME,
+ text::TextContentAnchorType_AT_CHARACTER
+ };
aAny <<= aTypes;
}
else if(pFormat)
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index c4f5ddf17980..d15dbc6cd0c1 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1924,7 +1924,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark(
// pNewTextAttr comes back with the real format
SwTextAttr *pNewTextAttr = nullptr;
rDoc.getIDocumentContentOperations().InsertPoolItem(rPam, rMark, nInsertFlags,
- /*pLayout*/nullptr, /*bExpandCharToPara*/false, &pNewTextAttr);
+ /*pLayout*/nullptr, &pNewTextAttr);
if (bMark && *rPam.GetPoint() > *rPam.GetMark())
{
rPam.Exchange();
@@ -2557,7 +2557,7 @@ SwXDocumentIndex::StyleAccess_Impl::replaceByIndex(
SwGetPoolIdFromName::TxtColl);
sSetStyles.append(aString);
}
- rTOXBase.SetStyleNames(sSetStyles.makeStringAndClear(), static_cast<sal_uInt16>(nIndex));
+ rTOXBase.SetStyleNames(sSetStyles.makeStringAndClear(), o3tl::narrowing<sal_uInt16>(nIndex));
}
sal_Int32 SAL_CALL
@@ -2579,7 +2579,7 @@ SwXDocumentIndex::StyleAccess_Impl::getByIndex(sal_Int32 nIndex)
SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
const OUString& rStyles =
- rTOXBase.GetStyleNames(static_cast<sal_uInt16>(nIndex));
+ rTOXBase.GetStyleNames(o3tl::narrowing<sal_uInt16>(nIndex));
const sal_Int32 nStyles = comphelper::string::getTokenCount(rStyles, TOX_STYLE_DELIMITER);
uno::Sequence<OUString> aStyles(nStyles);
OUString* pStyles = aStyles.getArray();
@@ -2842,7 +2842,7 @@ SwXDocumentIndex::TokenAccess_Impl::replaceByIndex(
sPattern.append(aToken.GetString());
}
SwForm aForm(rTOXBase.GetTOXForm());
- aForm.SetPattern(static_cast<sal_uInt16>(nIndex), sPattern.makeStringAndClear());
+ aForm.SetPattern(o3tl::narrowing<sal_uInt16>(nIndex), sPattern.makeStringAndClear());
rTOXBase.SetTOXForm(aForm);
}
@@ -2869,7 +2869,7 @@ SwXDocumentIndex::TokenAccess_Impl::getByIndex(sal_Int32 nIndex)
// #i21237#
SwFormTokens aPattern = rTOXBase.GetTOXForm().
- GetPattern(static_cast<sal_uInt16>(nIndex));
+ GetPattern(o3tl::narrowing<sal_uInt16>(nIndex));
sal_Int32 nTokenCount = 0;
uno::Sequence< beans::PropertyValues > aRetSeq;
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 247f3d84ece5..3580a8f416a2 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -542,6 +542,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ u"" UNO_NAME_SIZE_TYPE, RES_FRM_SIZE, cppu::UnoType<sal_Int16>::get() , PROPERTY_NONE, MID_FRMSIZE_SIZE_TYPE },
{ u"" UNO_NAME_WIDTH_TYPE, RES_FRM_SIZE, cppu::UnoType<sal_Int16>::get() , PROPERTY_NONE, MID_FRMSIZE_WIDTH_TYPE },
{ u"" UNO_NAME_IS_SPLIT_ALLOWED, RES_ROW_SPLIT, cppu::UnoType<bool>::get() , PropertyAttribute::MAYBEVOID, 0},
+ { u"" UNO_NAME_HAS_TEXT_CHANGES_ONLY, RES_PRINT, cppu::UnoType<bool>::get() , PropertyAttribute::MAYBEVOID, 0},
{ u"" UNO_NAME_ROW_INTEROP_GRAB_BAG, RES_FRMATR_GRABBAG, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), PROPERTY_NONE, 0 },
{ u"", 0, css::uno::Type(), 0, 0 }
};
@@ -680,23 +681,6 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
m_aMapEntriesArr[nPropertyId] = GetFootnotePropertyMap();
}
break;
- case PROPERTY_MAP_TEXT_COLUMS :
- {
- static SfxItemPropertyMapEntry const aTextColumns_Impl[] =
- {
- {u"" UNO_NAME_IS_AUTOMATIC, WID_TXTCOL_IS_AUTOMATIC, cppu::UnoType<bool>::get(),PropertyAttribute::READONLY, 0},
- {u"" UNO_NAME_AUTOMATIC_DISTANCE, WID_TXTCOL_AUTO_DISTANCE, cppu::UnoType<sal_Int32>::get(),PROPERTY_NONE, 0},
- {u"" UNO_NAME_SEPARATOR_LINE_WIDTH, WID_TXTCOL_LINE_WIDTH, cppu::UnoType<sal_Int32>::get(),PROPERTY_NONE, 0},
- {u"" UNO_NAME_SEPARATOR_LINE_COLOR, WID_TXTCOL_LINE_COLOR, cppu::UnoType<sal_Int32>::get(),PROPERTY_NONE, 0},
- {u"" UNO_NAME_SEPARATOR_LINE_RELATIVE_HEIGHT, WID_TXTCOL_LINE_REL_HGT, cppu::UnoType<sal_Int32>::get(),PROPERTY_NONE, 0},
- {u"" UNO_NAME_SEPARATOR_LINE_VERTIVAL_ALIGNMENT, WID_TXTCOL_LINE_ALIGN, cppu::UnoType<css::style::VerticalAlignment>::get(),PROPERTY_NONE, 0},
- {u"" UNO_NAME_SEPARATOR_LINE_IS_ON, WID_TXTCOL_LINE_IS_ON, cppu::UnoType<bool>::get(),PROPERTY_NONE, 0},
- {u"" UNO_NAME_SEPARATOR_LINE_STYLE, WID_TXTCOL_LINE_STYLE, cppu::UnoType<sal_Int8>::get(),PROPERTY_NONE, 0},
- { u"", 0, css::uno::Type(), 0, 0 }
- };
- m_aMapEntriesArr[nPropertyId] = aTextColumns_Impl;
- }
- break;
case PROPERTY_MAP_REDLINE :
{
m_aMapEntriesArr[nPropertyId] = GetRedlinePropertyMap();
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 803c93f94b1b..ee7b116d9716 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -1275,12 +1275,6 @@ const SfxItemPropertySet* SwUnoPropertyMapProvider::GetPropertySet( sal_uInt16
m_aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FOOTNOTE;
}
break;
- case PROPERTY_MAP_TEXT_COLUMS :
- {
- static SfxItemPropertySet aPROPERTY_MAP_TEXT_COLUMS(pEntries);
- m_aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_COLUMS;
- }
- break;
case PROPERTY_MAP_PARAGRAPH :
{
static SfxItemPropertySet aPROPERTY_MAP_PARAGRAPH(pEntries);
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 079e69ba2abc..4cb772142e16 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -310,7 +310,7 @@ lcl_SetNodeNumStart(SwPaM & rCursor, uno::Any const& rValue)
{
sal_Int16 nTmp = 1;
rValue >>= nTmp;
- sal_uInt16 nStt = (nTmp < 0 ? USHRT_MAX : static_cast<sal_uInt16>(nTmp));
+ sal_uInt16 nStt = (nTmp < 0 ? USHRT_MAX : o3tl::narrowing<sal_uInt16>(nTmp));
SwDoc& rDoc = rCursor.GetDoc();
UnoActionContext aAction(&rDoc);
@@ -2460,17 +2460,17 @@ void SAL_CALL SwXTextCursor::invalidateMarkings(::sal_Int32 nType)
if ( text::TextMarkupType::SPELLCHECK == nType )
{
txtNode->SetWrongDirty(SwTextNode::WrongState::TODO);
- txtNode->SetWrong(nullptr);
+ txtNode->ClearWrong();
}
else if( text::TextMarkupType::PROOFREADING == nType )
{
txtNode->SetGrammarCheckDirty(true);
- txtNode->SetGrammarCheck(nullptr);
+ txtNode->ClearGrammarCheck();
}
else if ( text::TextMarkupType::SMARTTAG == nType )
{
txtNode->SetSmartTagDirty(true);
- txtNode->SetSmartTags(nullptr);
+ txtNode->ClearSmartTags();
}
else return;
@@ -2527,9 +2527,6 @@ SwUnoCursorHelper::CreateSortDescriptor(const bool bFromTable)
pArray[3] = beans::PropertyValue("MaxSortFieldsCount", -1, aVal,
beans::PropertyState_DIRECT_VALUE);
- uno::Sequence< table::TableSortField > aFields(3);
- table::TableSortField* pFields = aFields.getArray();
-
lang::Locale aLang( SvtSysLocale().GetLanguageTag().getLocale());
// get collator algorithm to be used for the locale
uno::Sequence< OUString > aSeq(
@@ -2542,26 +2539,13 @@ SwUnoCursorHelper::CreateSortDescriptor(const bool bFromTable)
aCollAlg = aSeq.getConstArray()[0];
}
- pFields[0].Field = 1;
- pFields[0].IsAscending = true;
- pFields[0].IsCaseSensitive = false;
- pFields[0].FieldType = table::TableSortFieldType_ALPHANUMERIC;
- pFields[0].CollatorLocale = aLang;
- pFields[0].CollatorAlgorithm = aCollAlg;
-
- pFields[1].Field = 1;
- pFields[1].IsAscending = true;
- pFields[1].IsCaseSensitive = false;
- pFields[1].FieldType = table::TableSortFieldType_ALPHANUMERIC;
- pFields[1].CollatorLocale = aLang;
- pFields[1].CollatorAlgorithm = aCollAlg;
-
- pFields[2].Field = 1;
- pFields[2].IsAscending = true;
- pFields[2].IsCaseSensitive = false;
- pFields[2].FieldType = table::TableSortFieldType_ALPHANUMERIC;
- pFields[2].CollatorLocale = aLang;
- pFields[2].CollatorAlgorithm = aCollAlg;
+ uno::Sequence< table::TableSortField > aFields
+ {
+ // Field, IsAscending, IsCaseSensitive, FieldType, CollatorLocale, CollatorAlgorithm
+ { 1, true, false, table::TableSortFieldType_ALPHANUMERIC, aLang, aCollAlg },
+ { 1, true, false, table::TableSortFieldType_ALPHANUMERIC, aLang, aCollAlg },
+ { 1, true, false, table::TableSortFieldType_ALPHANUMERIC, aLang, aCollAlg }
+ };
aVal <<= aFields;
pArray[4] = beans::PropertyValue("SortFields", -1, aVal,
@@ -2588,21 +2572,21 @@ bool SwUnoCursorHelper::ConvertSortProperties(
rSortOpt.cDeli = ' ';
rSortOpt.eDirection = SwSortDirection::Columns; //!! UI text may be contrary though !!
- std::unique_ptr<SwSortKey> pKey1(new SwSortKey);
- pKey1->nColumnId = USHRT_MAX;
- pKey1->bIsNumeric = true;
- pKey1->eSortOrder = SwSortOrder::Ascending;
+ SwSortKey aKey1;
+ aKey1.nColumnId = USHRT_MAX;
+ aKey1.bIsNumeric = true;
+ aKey1.eSortOrder = SwSortOrder::Ascending;
- std::unique_ptr<SwSortKey> pKey2(new SwSortKey);
- pKey2->nColumnId = USHRT_MAX;
- pKey2->bIsNumeric = true;
- pKey2->eSortOrder = SwSortOrder::Ascending;
+ SwSortKey aKey2;
+ aKey2.nColumnId = USHRT_MAX;
+ aKey2.bIsNumeric = true;
+ aKey2.eSortOrder = SwSortOrder::Ascending;
- std::unique_ptr<SwSortKey> pKey3(new SwSortKey);
- pKey3->nColumnId = USHRT_MAX;
- pKey3->bIsNumeric = true;
- pKey3->eSortOrder = SwSortOrder::Ascending;
- SwSortKey* aKeys[3] = {pKey1.get(), pKey2.get(), pKey3.get()};
+ SwSortKey aKey3;
+ aKey3.nColumnId = USHRT_MAX;
+ aKey3.bIsNumeric = true;
+ aKey3.eSortOrder = SwSortOrder::Ascending;
+ SwSortKey* aKeys[3] = {&aKey1, &aKey2, &aKey3};
bool bOldSortdescriptor(false);
bool bNewSortdescriptor(false);
@@ -2787,7 +2771,7 @@ bool SwUnoCursorHelper::ConvertSortProperties(
LanguageTag::convertToLanguageType( pFields[i].CollatorLocale );
aKeys[i]->sSortType = pFields[i].CollatorAlgorithm;
aKeys[i]->nColumnId =
- static_cast<sal_uInt16>(pFields[i].Field);
+ o3tl::narrowing<sal_uInt16>(pFields[i].Field);
aKeys[i]->bIsNumeric = (pFields[i].FieldType ==
table::TableSortFieldType_NUMERIC);
aKeys[i]->eSortOrder = (pFields[i].IsAscending)
@@ -2813,17 +2797,17 @@ bool SwUnoCursorHelper::ConvertSortProperties(
bRet = false;
}
- if (pKey1->nColumnId != USHRT_MAX)
+ if (aKey1.nColumnId != USHRT_MAX)
{
- rSortOpt.aKeys.push_back(std::move(pKey1));
+ rSortOpt.aKeys.push_back(aKey1);
}
- if (pKey2->nColumnId != USHRT_MAX)
+ if (aKey2.nColumnId != USHRT_MAX)
{
- rSortOpt.aKeys.push_back(std::move(pKey2));
+ rSortOpt.aKeys.push_back(aKey2);
}
- if (pKey3->nColumnId != USHRT_MAX)
+ if (aKey3.nColumnId != USHRT_MAX)
{
- rSortOpt.aKeys.push_back(std::move(pKey3));
+ rSortOpt.aKeys.push_back(aKey3);
}
return bRet && !rSortOpt.aKeys.empty();
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 249956dd17c9..5b7d3ab08c17 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -856,9 +856,7 @@ bool ::sw::GetDefaultTextContentValue(
case FN_UNO_TEXT_WRAP: rAny <<= text::WrapTextMode_NONE; break;
case FN_UNO_ANCHOR_TYPE: rAny <<= text::TextContentAnchorType_AT_PARAGRAPH; break;
case FN_UNO_ANCHOR_TYPES:
- { uno::Sequence<text::TextContentAnchorType> aTypes(1);
- text::TextContentAnchorType* pArray = aTypes.getArray();
- pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
+ { uno::Sequence<text::TextContentAnchorType> aTypes { text::TextContentAnchorType_AT_PARAGRAPH };
rAny <<= aTypes;
}
break;
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index a88d2d4f8a98..3156ef10ed35 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -1422,7 +1422,7 @@ SwXMetaField::removeVetoableChangeListener(
}
static uno::Reference<rdf::XURI> const&
-lcl_getURI(const bool bPrefix)
+lcl_getURI(const sal_Int16 eKnown)
{
static uno::Reference< uno::XComponentContext > xContext(
::comphelper::getProcessComponentContext());
@@ -1432,7 +1432,18 @@ lcl_getURI(const bool bPrefix)
static uno::Reference< rdf::XURI > xOdfSuffix(
rdf::URI::createKnown(xContext, rdf::URIs::ODF_SUFFIX),
uno::UNO_SET_THROW);
- return bPrefix ? xOdfPrefix : xOdfSuffix;
+ static uno::Reference< rdf::XURI > xOdfShading(
+ rdf::URI::createKnown(xContext, rdf::URIs::LO_EXT_SHADING),
+ uno::UNO_SET_THROW);
+ switch (eKnown)
+ {
+ case rdf::URIs::ODF_PREFIX:
+ return xOdfPrefix;
+ case rdf::URIs::ODF_SUFFIX:
+ return xOdfSuffix;
+ default:
+ return xOdfShading;
+ }
}
static OUString
@@ -1464,7 +1475,7 @@ void
getPrefixAndSuffix(
const uno::Reference<frame::XModel>& xModel,
const uno::Reference<rdf::XMetadatable>& xMetaField,
- OUString *const o_pPrefix, OUString *const o_pSuffix)
+ OUString *const o_pPrefix, OUString *const o_pSuffix, OUString *const o_pShadingColor)
{
try {
const uno::Reference<rdf::XRepositorySupplier> xRS(
@@ -1475,11 +1486,15 @@ getPrefixAndSuffix(
xMetaField, uno::UNO_QUERY_THROW);
if (o_pPrefix)
{
- *o_pPrefix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(true));
+ *o_pPrefix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(rdf::URIs::ODF_PREFIX));
}
if (o_pSuffix)
{
- *o_pSuffix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(false));
+ *o_pSuffix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(rdf::URIs::ODF_SUFFIX));
+ }
+ if (o_pShadingColor)
+ {
+ *o_pShadingColor = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(rdf::URIs::LO_EXT_SHADING));
}
} catch (uno::RuntimeException &) {
throw;
@@ -1506,7 +1521,7 @@ SwXMetaField::getPresentation(sal_Bool bShowCommand)
const OUString content( getString() );
OUString prefix;
OUString suffix;
- getPrefixAndSuffix(GetModel(), this, &prefix, &suffix);
+ getPrefixAndSuffix(GetModel(), this, &prefix, &suffix, nullptr);
return prefix + content + suffix;
}
}
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index af6633e05222..186b0e98116e 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -90,11 +90,6 @@ namespace
return pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier();
}
}
-// Constants for the css::text::ColumnSeparatorStyle
-#define API_COL_LINE_NONE 0
-#define API_COL_LINE_SOLID 1
-#define API_COL_LINE_DOTTED 2
-#define API_COL_LINE_DASHED 3
#define WID_PREFIX 0
#define WID_SUFFIX 1
@@ -1251,7 +1246,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
SolarMutexGuard aGuard;
OSL_ENSURE( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
- const SwNumFormat& rFormat = rNumRule.Get( static_cast<sal_uInt16>(nIndex) );
+ const SwNumFormat& rFormat = rNumRule.Get( o3tl::narrowing<sal_uInt16>(nIndex) );
SwCharFormat* pCharFormat = rFormat.GetCharFormat();
OUString CharStyleName;
@@ -1479,7 +1474,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
SolarMutexGuard aGuard;
OSL_ENSURE( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
- SwNumFormat aFormat(rNumRule.Get( static_cast<sal_uInt16>(nIndex) ));
+ SwNumFormat aFormat(rNumRule.Get( o3tl::narrowing<sal_uInt16>(nIndex) ));
OUString sHeadingStyleName;
OUString sParagraphStyleName;
@@ -1525,7 +1520,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
}
}
- rNumRule.Set(static_cast<sal_uInt16>(nIndex), aFormat);
+ rNumRule.Set(o3tl::narrowing<sal_uInt16>(nIndex), aFormat);
}
void SwXNumberingRules::SetPropertiesToNumFormat(
@@ -2166,290 +2161,4 @@ SwXChapterNumbering::~SwXChapterNumbering()
{
}
-OUString SwXTextColumns::getImplementationName()
-{
- return "SwXTextColumns";
-}
-
-sal_Bool SwXTextColumns::supportsService(const OUString& rServiceName)
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-Sequence< OUString > SwXTextColumns::getSupportedServiceNames()
-{
- Sequence<OUString> aRet { "com.sun.star.text.TextColumns" };
- return aRet;
-}
-
-SwXTextColumns::SwXTextColumns() :
- m_nReference(0),
- m_bIsAutomaticWidth(true),
- m_nAutoDistance(0),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)),
- m_nSepLineWidth(0),
- m_nSepLineColor(0), //black
- m_nSepLineHeightRelative(100),//full height
- m_nSepLineVertAlign(style::VerticalAlignment_MIDDLE),
- m_bSepLineIsOn(false),
- m_nSepLineStyle(API_COL_LINE_NONE) // None
-{
-}
-
-SwXTextColumns::SwXTextColumns(const SwFormatCol& rFormatCol) :
- m_nReference(0),
- m_aTextColumns(rFormatCol.GetNumCols()),
- m_bIsAutomaticWidth(rFormatCol.IsOrtho()),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS))
-{
- const sal_uInt16 nItemGutterWidth = rFormatCol.GetGutterWidth();
- m_nAutoDistance = m_bIsAutomaticWidth ?
- USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : static_cast<sal_Int32>(nItemGutterWidth)
- : 0;
- m_nAutoDistance = convertTwipToMm100(m_nAutoDistance);
-
- TextColumn* pColumns = m_aTextColumns.getArray();
- const SwColumns& rCols = rFormatCol.GetColumns();
- for(sal_Int32 i = 0; i < m_aTextColumns.getLength(); ++i)
- {
- const SwColumn* pCol = &rCols[i];
-
- pColumns[i].Width = pCol->GetWishWidth();
- m_nReference += pColumns[i].Width;
- pColumns[i].LeftMargin = convertTwipToMm100(pCol->GetLeft ());
- pColumns[i].RightMargin = convertTwipToMm100(pCol->GetRight());
- }
- if(!m_aTextColumns.hasElements())
- m_nReference = USHRT_MAX;
-
- m_nSepLineWidth = rFormatCol.GetLineWidth();
- m_nSepLineColor = rFormatCol.GetLineColor();
- m_nSepLineHeightRelative = rFormatCol.GetLineHeight();
- m_bSepLineIsOn = rFormatCol.GetLineAdj() != COLADJ_NONE;
- sal_Int8 nStyle = API_COL_LINE_NONE;
- switch (rFormatCol.GetLineStyle())
- {
- case SvxBorderLineStyle::SOLID: nStyle = API_COL_LINE_SOLID; break;
- case SvxBorderLineStyle::DOTTED: nStyle= API_COL_LINE_DOTTED; break;
- case SvxBorderLineStyle::DASHED: nStyle= API_COL_LINE_DASHED; break;
- default: break;
- }
- m_nSepLineStyle = nStyle;
- switch(rFormatCol.GetLineAdj())
- {
- case COLADJ_TOP: m_nSepLineVertAlign = style::VerticalAlignment_TOP; break;
- case COLADJ_BOTTOM: m_nSepLineVertAlign = style::VerticalAlignment_BOTTOM; break;
- case COLADJ_CENTER:
- case COLADJ_NONE: m_nSepLineVertAlign = style::VerticalAlignment_MIDDLE;
- }
-}
-
-SwXTextColumns::~SwXTextColumns()
-{
-}
-
-sal_Int32 SwXTextColumns::getReferenceValue()
-{
- SolarMutexGuard aGuard;
- return m_nReference;
-}
-
-sal_Int16 SwXTextColumns::getColumnCount()
-{
- SolarMutexGuard aGuard;
- return static_cast< sal_Int16>( m_aTextColumns.getLength() );
-}
-
-void SwXTextColumns::setColumnCount(sal_Int16 nColumns)
-{
- SolarMutexGuard aGuard;
- if(nColumns <= 0)
- throw uno::RuntimeException();
- m_bIsAutomaticWidth = true;
- m_aTextColumns.realloc(nColumns);
- TextColumn* pCols = m_aTextColumns.getArray();
- m_nReference = USHRT_MAX;
- sal_Int32 nWidth = m_nReference / nColumns;
- sal_Int32 nDiff = m_nReference - nWidth * nColumns;
- sal_Int32 nDist = m_nAutoDistance / 2;
- for(sal_Int16 i = 0; i < nColumns; i++)
- {
- pCols[i].Width = nWidth;
- pCols[i].LeftMargin = i == 0 ? 0 : nDist;
- pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
- }
- pCols[nColumns - 1].Width += nDiff;
-}
-
-uno::Sequence< TextColumn > SwXTextColumns::getColumns()
-{
- SolarMutexGuard aGuard;
- return m_aTextColumns;
-}
-
-void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns)
-{
- SolarMutexGuard aGuard;
- sal_Int32 nReferenceTemp = std::accumulate(rColumns.begin(), rColumns.end(), sal_Int32(0),
- [](const sal_Int32 nSum, const TextColumn& rCol) { return nSum + rCol.Width; });
- m_bIsAutomaticWidth = false;
- m_nReference = !nReferenceTemp ? USHRT_MAX : nReferenceTemp;
- m_aTextColumns = rColumns;
-}
-
-uno::Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo( )
-{
- static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
- return aRef;
-}
-
-void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
-{
- const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
- if (!pEntry)
- throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
- if ( pEntry->nFlags & PropertyAttribute::READONLY)
- throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
-
- switch(pEntry->nWID)
- {
- case WID_TXTCOL_LINE_WIDTH:
- {
- sal_Int32 nTmp = 0;
- aValue >>= nTmp;
- if(nTmp < 0)
- throw IllegalArgumentException();
- m_nSepLineWidth = convertMm100ToTwip(nTmp);
- }
- break;
- case WID_TXTCOL_LINE_COLOR:
- aValue >>= m_nSepLineColor;
- break;
- case WID_TXTCOL_LINE_STYLE:
- {
- aValue >>= m_nSepLineStyle;
- }
- break;
- case WID_TXTCOL_LINE_REL_HGT:
- {
- sal_Int8 nTmp = 0;
- aValue >>= nTmp;
- if(nTmp < 0)
- throw IllegalArgumentException();
- m_nSepLineHeightRelative = nTmp;
- }
- break;
- case WID_TXTCOL_LINE_ALIGN:
- {
- style::VerticalAlignment eAlign;
- if(!(aValue >>= eAlign) )
- {
- sal_Int8 nTmp = 0;
- if (! ( aValue >>= nTmp ) )
- throw IllegalArgumentException();
- m_nSepLineVertAlign = static_cast<style::VerticalAlignment>(nTmp);
- }
- else
- m_nSepLineVertAlign = eAlign;
- }
- break;
- case WID_TXTCOL_LINE_IS_ON:
- m_bSepLineIsOn = *o3tl::doAccess<bool>(aValue);
- break;
- case WID_TXTCOL_AUTO_DISTANCE:
- {
- sal_Int32 nTmp = 0;
- aValue >>= nTmp;
- if(nTmp < 0 || nTmp >= m_nReference)
- throw IllegalArgumentException();
- m_nAutoDistance = nTmp;
- sal_Int32 nColumns = m_aTextColumns.getLength();
- TextColumn* pCols = m_aTextColumns.getArray();
- sal_Int32 nDist = m_nAutoDistance / 2;
- for(sal_Int32 i = 0; i < nColumns; i++)
- {
- pCols[i].LeftMargin = i == 0 ? 0 : nDist;
- pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
- }
- }
- break;
- }
-}
-
-Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName )
-{
- const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
- if (!pEntry)
- throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
-
- Any aRet;
- switch(pEntry->nWID)
- {
- case WID_TXTCOL_LINE_WIDTH:
- aRet <<= static_cast < sal_Int32 >(convertTwipToMm100(m_nSepLineWidth));
- break;
- case WID_TXTCOL_LINE_COLOR:
- aRet <<= m_nSepLineColor;
- break;
- case WID_TXTCOL_LINE_STYLE:
- aRet <<= m_nSepLineStyle;
- break;
- case WID_TXTCOL_LINE_REL_HGT:
- aRet <<= m_nSepLineHeightRelative;
- break;
- case WID_TXTCOL_LINE_ALIGN:
- aRet <<= m_nSepLineVertAlign;
- break;
- case WID_TXTCOL_LINE_IS_ON:
- aRet <<= m_bSepLineIsOn;
- break;
- case WID_TXTCOL_IS_AUTOMATIC :
- aRet <<= m_bIsAutomaticWidth;
- break;
- case WID_TXTCOL_AUTO_DISTANCE:
- aRet <<= m_nAutoDistance;
- break;
- }
- return aRet;
-}
-
-void SwXTextColumns::addPropertyChangeListener(
- const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
-{
-}
-
-void SwXTextColumns::removePropertyChangeListener(
- const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
-{
-}
-
-void SwXTextColumns::addVetoableChangeListener(
- const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
-{
-}
-
-void SwXTextColumns::removeVetoableChangeListener(
- const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
-{
-}
-
-namespace
-{
-}
-
-const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId()
-{
- static const UnoTunnelIdInit theSwXTextColumnsUnoTunnelId;
- return theSwXTextColumnsUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId )
-{
- if( isUnoTunnelId<SwXTextColumns>(rId) )
- {
- return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
- }
- return 0;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 6633906e5346..ac72abefd161 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1899,10 +1899,10 @@ void SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>(const SfxItemPropertyMapEntry&,
{
if(!o_rStyleBase.getNewBase()->IsUserDefined() || !rValue.has<paragraphstyle_t>())
throw lang::IllegalArgumentException();
- static std::unique_ptr<std::map<paragraphstyle_t, SfxStyleSearchBits>> pUnoToCore;
+ static std::optional<std::map<paragraphstyle_t, SfxStyleSearchBits>> pUnoToCore;
if(!pUnoToCore)
{
- pUnoToCore.reset(new std::map<paragraphstyle_t, SfxStyleSearchBits>);
+ pUnoToCore.emplace();
auto pEntries = lcl_GetParagraphStyleCategoryEntries();
std::transform(pEntries->begin(), pEntries->end(), std::inserter(*pUnoToCore, pUnoToCore->end()),
[] (const ParagraphStyleCategoryEntry& rEntry) { return std::pair<paragraphstyle_t, SfxStyleSearchBits>(rEntry.m_eCategory, rEntry.m_nSwStyleBits); });
@@ -2003,10 +2003,10 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertyMapEntry& rEntry, const Sfx
{
using propertytype_t = decltype(rEntry.nWID);
using coresetter_t = std::function<void(SwXStyle&, const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any&, SwStyleBase_Impl&)>;
- static std::unique_ptr<std::map<propertytype_t, coresetter_t>> pUnoToCore;
+ static std::optional<std::map<propertytype_t, coresetter_t>> pUnoToCore;
if(!pUnoToCore)
{
- pUnoToCore.reset(new std::map<propertytype_t, coresetter_t> {
+ pUnoToCore = std::map<propertytype_t, coresetter_t> {
// these explicit std::mem_fn() calls shouldn't be needed, but apparently MSVC is currently too stupid for C++11 again
{ FN_UNO_HIDDEN, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_HIDDEN>) },
{ FN_UNO_STYLE_INTEROP_GRAB_BAG, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_STYLE_INTEROP_GRAB_BAG>) },
@@ -2029,7 +2029,7 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertyMapEntry& rEntry, const Sfx
{ RES_TXTATR_CJK_RUBY, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_TXTATR_CJK_RUBY)>) },
{ RES_PARATR_DROP, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_DROP)>) },
{ RES_PARATR_NUMRULE, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_NUMRULE)>) }
- });
+ };
}
const auto pUnoToCoreIt(pUnoToCore->find(rEntry.nWID));
if(pUnoToCoreIt != pUnoToCore->end())
@@ -2262,10 +2262,10 @@ template<>
uno::Any SwXStyle::GetStyleProperty<FN_UNO_CATEGORY>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
{
PrepareStyleBase(rBase);
- static std::unique_ptr<std::map<collectionbits_t, paragraphstyle_t>> pUnoToCore;
+ static std::optional<std::map<collectionbits_t, paragraphstyle_t>> pUnoToCore;
if(!pUnoToCore)
{
- pUnoToCore.reset(new std::map<collectionbits_t, paragraphstyle_t>);
+ pUnoToCore.emplace();
auto pEntries = lcl_GetParagraphStyleCategoryEntries();
std::transform(pEntries->begin(), pEntries->end(), std::inserter(*pUnoToCore, pUnoToCore->end()),
[] (const ParagraphStyleCategoryEntry& rEntry) { return std::pair<collectionbits_t, paragraphstyle_t>(rEntry.m_nCollectionBits, rEntry.m_eCategory); });
@@ -2343,10 +2343,10 @@ uno::Any SwXStyle::GetStyleProperty_Impl(const SfxItemPropertyMapEntry& rEntry,
{
using propertytype_t = decltype(rEntry.nWID);
using coresetter_t = std::function<uno::Any(SwXStyle&, const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl&)>;
- static std::unique_ptr<std::map<propertytype_t, coresetter_t>> pUnoToCore;
+ static std::optional<std::map<propertytype_t, coresetter_t>> pUnoToCore;
if(!pUnoToCore)
{
- pUnoToCore.reset(new std::map<propertytype_t, coresetter_t> {
+ pUnoToCore = std::map<propertytype_t, coresetter_t> {
// these explicit std::mem_fn() calls shouldn't be needed, but apparently MSVC is currently too stupid for C++11 again
{ FN_UNO_IS_PHYSICAL, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_IS_PHYSICAL>) },
{ FN_UNO_HIDDEN, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_HIDDEN>) },
@@ -2363,7 +2363,7 @@ uno::Any SwXStyle::GetStyleProperty_Impl(const SfxItemPropertyMapEntry& rEntry,
{ SID_SWREGISTER_COLLECTION, std::mem_fn(&SwXStyle::GetStyleProperty<SID_SWREGISTER_COLLECTION>) },
{ RES_BACKGROUND, std::mem_fn(&SwXStyle::GetStyleProperty<sal_uInt16(RES_BACKGROUND)>) },
{ OWN_ATTR_FILLBMP_MODE, std::mem_fn(&SwXStyle::GetStyleProperty<OWN_ATTR_FILLBMP_MODE>) }
- });
+ };
}
const auto pUnoToCoreIt(pUnoToCore->find(rEntry.nWID));
if(pUnoToCoreIt != pUnoToCore->end())
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 395b6864318a..ee6c41b11911 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -204,7 +204,7 @@ static void lcl_SetSpecialProperty(SwFrameFormat* pFormat,
sal_Int32 nRepeat = 0;
aValue >>= nRepeat;
if( nRepeat >= 0 && nRepeat < SAL_MAX_UINT16 )
- pFormat->GetDoc()->SetRowsToRepeat( *pTable, static_cast<sal_uInt16>(nRepeat) );
+ pFormat->GetDoc()->SetRowsToRepeat( *pTable, o3tl::narrowing<sal_uInt16>(nRepeat) );
}
}
break;
@@ -1761,7 +1761,8 @@ namespace {
class SwTableProperties_Impl
{
- SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
+ SwUnoCursorHelper::SwAnyMapHelper m_aAnyMap;
+
public:
SwTableProperties_Impl();
@@ -1778,10 +1779,14 @@ SwTableProperties_Impl::SwTableProperties_Impl()
{ }
void SwTableProperties_Impl::SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rVal)
- { aAnyMap.SetValue( nWhichId, nMemberId, rVal ); }
+ {
+ m_aAnyMap.SetValue(nWhichId, nMemberId, rVal);
+ }
bool SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny )
- { return aAnyMap.FillValue( nWhichId, nMemberId, rpAny ); }
+ {
+ return m_aAnyMap.FillValue(nWhichId, nMemberId, rpAny);
+ }
void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet,
std::function<std::unique_ptr<SfxPoolItem>()> aItemFactory,
@@ -2026,8 +2031,8 @@ void SwXTextTable::initialize(sal_Int32 nR, sal_Int32 nC)
{
if (!m_pImpl->IsDescriptor() || nR <= 0 || nC <= 0 || nR >= SAL_MAX_UINT16 || nC >= SAL_MAX_UINT16)
throw uno::RuntimeException();
- m_pImpl->m_nRows = static_cast<sal_uInt16>(nR);
- m_pImpl->m_nColumns = static_cast<sal_uInt16>(nC);
+ m_pImpl->m_nRows = o3tl::narrowing<sal_uInt16>(nR);
+ m_pImpl->m_nColumns = o3tl::narrowing<sal_uInt16>(nC);
}
uno::Reference<table::XTableRows> SAL_CALL SwXTextTable::getRows()
@@ -2631,7 +2636,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An
aBoxInfo.SetLine(aVertLine.isEmpty() ? nullptr : &aVertLine, SvxBoxInfoItemLine::VERT);
aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT, aBorder.IsVerticalLineValid);
- aBox.SetAllDistances(static_cast<sal_uInt16>(convertMm100ToTwip(aBorder.Distance)));
+ aBox.SetAllDistances(o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(aBorder.Distance)));
aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::DISTANCE, aBorder.IsDistanceValid);
aSet.Put(aBox);
@@ -3968,7 +3973,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
// remove actions - TODO: why?
UnoActionRemoveContext aRemoveContext(&pUnoCursor->GetDoc());
}
- pFrameFormat->GetDoc()->InsertRow(*pUnoCursor, static_cast<sal_uInt16>(nCount), bAppend);
+ pFrameFormat->GetDoc()->InsertRow(*pUnoCursor, o3tl::narrowing<sal_uInt16>(nCount), bAppend);
}
void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
@@ -4124,7 +4129,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
UnoActionRemoveContext aRemoveContext(&pUnoCursor->GetDoc());
}
- pFrameFormat->GetDoc()->InsertCol(*pUnoCursor, static_cast<sal_uInt16>(nCount), bAppend);
+ pFrameFormat->GetDoc()->InsertCol(*pUnoCursor, o3tl::narrowing<sal_uInt16>(nCount), bAppend);
}
///@see SwXTableRows::removeByIndex (TODO: seems to be copy and paste programming here)
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 32cadcff761b..7e0c73d8c778 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1538,8 +1538,8 @@ SwXText::convertToTextFrame(
throw uno::RuntimeException();
}
uno::Reference< text::XTextContent > xRet;
- std::unique_ptr<SwUnoInternalPaM> pTempStartPam(new SwUnoInternalPaM(*GetDoc()));
- std::unique_ptr< SwUnoInternalPaM > pEndPam(new SwUnoInternalPaM(*GetDoc()));
+ std::optional<SwUnoInternalPaM> pTempStartPam(*GetDoc());
+ std::optional<SwUnoInternalPaM> pEndPam(*GetDoc());
if (!::sw::XTextRangeToSwPaM(*pTempStartPam, xStart) ||
!::sw::XTextRangeToSwPaM(*pEndPam, xEnd))
{
@@ -2079,7 +2079,7 @@ lcl_ApplyCellProperties(
}
catch (const uno::Exception&)
{
- TOOLS_WARN_EXCEPTION( "sw.uno", "Exception when getting PropertyState: " << rName );
+ TOOLS_WARN_EXCEPTION( "sw.uno", "Exception when setting cell property " << rName );
}
}
}
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index f20b47e15651..7d544d1cbd2e 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -164,7 +164,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
if ( !pWList )
{
pWList = new SwWrongList( WRONGLIST_SPELL );
- m_pImpl->m_pTextNode->SetWrong( pWList );
+ m_pImpl->m_pTextNode->SetWrong( std::unique_ptr<SwWrongList>(pWList) );
}
}
else if ( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
@@ -180,7 +180,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
if ( !pWList )
{
- m_pImpl->m_pTextNode->SetGrammarCheck( new SwGrammarMarkUp() );
+ m_pImpl->m_pTextNode->SetGrammarCheck( std::make_unique<SwGrammarMarkUp>() );
pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
}
}
@@ -194,7 +194,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
if ( !pWList )
{
pWList = new SwWrongList( WRONGLIST_SMARTTAG );
- m_pImpl->m_pTextNode->SetSmartTags( pWList );
+ m_pImpl->m_pTextNode->SetSmartTags( std::unique_ptr<SwWrongList>(pWList) );
}
}
else
@@ -434,7 +434,7 @@ void SAL_CALL SwXTextMarkup::commitMultiTextMarkup(
pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
if ( !pWList )
{
- m_pImpl->m_pTextNode->SetGrammarCheck( new SwGrammarMarkUp() );
+ m_pImpl->m_pTextNode->SetGrammarCheck( std::make_unique<SwGrammarMarkUp>() );
pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
pWList->SetInvalid( 0, COMPLETE_STRING );
}
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index ac91694845fe..4a19062f4db6 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -362,9 +362,9 @@ bool SwPagePreviewLayout::Prepare( const sal_uInt16 _nProposedStartPageNum,
// determine column and row of proposed start position.
// Note: paint starts at point (0,0)
const sal_uInt16 nColOfProposed =
- static_cast<sal_uInt16>(rProposedStartPos.X() / mnColWidth) + 1;
+ o3tl::narrowing<sal_uInt16>(rProposedStartPos.X() / mnColWidth) + 1;
const sal_uInt16 nRowOfProposed =
- static_cast<sal_uInt16>(rProposedStartPos.Y() / mnRowHeight) + 1;
+ o3tl::narrowing<sal_uInt16>(rProposedStartPos.Y() / mnRowHeight) + 1;
// determine start page == page at proposed start position
// leaving left-top-corner blank is
// controlled by <mbBookPreview>.
@@ -1027,7 +1027,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const tools:
// paint preview background
{
- SwRegionRects aPreviewBackgrdRegion(rOutRect);
+ SwRegionRects aPreviewBackgrdRegion((SwRect(rOutRect)));
// calculate preview background rectangles
for ( auto & rpPreviewPage : maPreviewPages )
{
@@ -1086,14 +1086,14 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const tools:
pOutputDev->SetFont( aOldFont );
// paint shadow and border for empty page
// use new method to paint page border and shadow
- SwPageFrame::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, false, true );
+ SwPageFrame::PaintBorderAndShadow( SwRect(aPageRect), &mrParentViewShell, true, false, true );
}
else
{
const bool bIsLeftShadowed = pPage->IsLeftShadowNeeded();
const bool bIsRightShadowed = pPage->IsRightShadowNeeded();
- mrParentViewShell.maVisArea = aPageRect;
+ mrParentViewShell.maVisArea = SwRect(aPageRect);
aPxPaintRect.Intersection( aPxOutRect );
tools::Rectangle aPaintRect = pOutputDev->PixelToLogic( aPxPaintRect );
mrParentViewShell.Paint(rRenderContext, aPaintRect);
@@ -1106,7 +1106,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const tools:
bIsLeftShadowed, bIsRightShadowed, true );
const vcl::Region aDLRegion(aPageBorderRect.SVRect());
mrParentViewShell.DLPrePaint2(aDLRegion);
- SwPageFrame::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, false, true );
+ SwPageFrame::PaintBorderAndShadow( SwRect(aPageRect), &mrParentViewShell, true, false, true );
mrParentViewShell.DLPostPaint2(true);
}
// <--
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index 215f9e187326..cbc86e76a1c2 100644
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -112,7 +112,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
// page background color is set as the background color at the
// outliner of the draw view. Only necessary for the layers
// hell and heaven
- Color aOldOutlinerBackgrdColor;
+ Color aOldOutlinerBackgroundColor;
// set default horizontal text direction on painting <hell> or
// <heaven>.
EEHorizontalTextDirection aOldEEHoriTextDir = EEHorizontalTextDirection::L2R;
@@ -124,7 +124,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
"incorrect usage of SwViewShellImp::PaintLayer: pPageBackgrdColor have to be set for painting layer <hell> or <heaven>");
if ( _pPageBackgrdColor )
{
- aOldOutlinerBackgrdColor =
+ aOldOutlinerBackgroundColor =
GetDrawView()->GetModel()->GetDrawOutliner().GetBackgroundColor();
GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( *_pPageBackgrdColor );
}
@@ -151,7 +151,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
if ( (_nLayerID == rIDDMA.GetHellId()) ||
(_nLayerID == rIDDMA.GetHeavenId()) )
{
- GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( aOldOutlinerBackgrdColor );
+ GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( aOldOutlinerBackgroundColor );
GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aOldEEHoriTextDir );
}
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 317480500eac..3cadcfd3556a 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -213,7 +213,8 @@ void SwViewShellImp::MakeDrawView()
// to use GetOut() and check the existing cases.
// Check worked well. Took a look at viewing, printing, PDF export and print preview with a test
// document which has an empty 2nd page (right page, see bug)
- OutputDevice* pOutDevForDrawView = GetShell()->GetWin();
+ auto pWin = GetShell()->GetWin();
+ OutputDevice* pOutDevForDrawView = pWin ? pWin->GetOutDev() : nullptr;
if(!pOutDevForDrawView)
{
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 522813e4b912..ff59a3b58c01 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -83,9 +83,9 @@
#include <vcl/sysdata.hxx>
#endif
-bool SwViewShell::mbLstAct = false;
-ShellResource *SwViewShell::mpShellRes = nullptr;
-vcl::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::mpCareDialog(new std::shared_ptr<weld::Window>);
+bool SwViewShell::sbLstAct = false;
+ShellResource *SwViewShell::spShellRes = nullptr;
+vcl::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::spCareDialog(new std::shared_ptr<weld::Window>);
static bool bInSizeNotify = false;
@@ -182,7 +182,7 @@ void SwViewShell::DLPrePaint2(const vcl::Region& rRegion)
// Prefer window; if not available, get mpOut (e.g. printer)
const bool bWindow = GetWin() && !comphelper::LibreOfficeKit::isActive() && !isOutputToWindow();
- mpPrePostOutDev = bWindow ? GetWin(): GetOut();
+ mpPrePostOutDev = bWindow ? GetWin()->GetOutDev() : GetOut();
// #i74769# use SdrPaintWindow now direct
mpTargetPaintWindow = Imp()->GetDrawView()->BeginDrawLayers(mpPrePostOutDev, rRegion);
@@ -257,12 +257,12 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
mbInEndAction = true;
//will this put the EndAction of the last shell in the sequence?
- SwViewShell::mbLstAct = true;
+ SwViewShell::sbLstAct = true;
for(SwViewShell& rShell : GetRingContainer())
{
if(&rShell != this && rShell.ActionPend())
{
- SwViewShell::mbLstAct = false;
+ SwViewShell::sbLstAct = false;
break;
}
}
@@ -285,7 +285,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
if ( mnLockPaint )
aAction.SetPaint( false );
aAction.SetInputType( VclInputFlags::KEYBOARD );
- aAction.Action(GetWin());
+ aAction.Action(GetWin()->GetOutDev());
}
if ( bIsShellForCheckViewLayout )
@@ -401,7 +401,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
if ( bPaint )
{
if (GetWin()->SupportsDoubleBuffering())
- InvalidateWindows(aRect.SVRect());
+ InvalidateWindows(aRect);
else
{
// #i75172# begin DrawingLayer paint
@@ -417,7 +417,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
if (!comphelper::LibreOfficeKit::isActive())
pCurrentLayout->PaintSwFrame( *mpOut, aRect );
else
- pCurrentLayout->GetCurrShell()->InvalidateWindows(aRect.SVRect());
+ pCurrentLayout->GetCurrShell()->InvalidateWindows(aRect);
// #i75172# end DrawingLayer paint
DLPostPaint2(true);
@@ -440,7 +440,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
mbPaintWorks = true;
mbInEndAction = false;
- SwViewShell::mbLstAct = false;
+ SwViewShell::sbLstAct = false;
Imp()->EndAction();
//We artificially end the action here to enable the automatic scrollbars
@@ -473,7 +473,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
CurrShell aCurr( this );
if ( GetWin() && GetWin()->IsVisible() )
{
- if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() )
+ if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && !comphelper::LibreOfficeKit::isActive())
{
//Refresh with virtual device to avoid flickering.
VclPtrInstance<VirtualDevice> pVout( *mpOut );
@@ -1078,7 +1078,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
//First get the old visible page, so we don't have to look
//for it afterwards.
- const SwFrame *pOldPage = Imp()->GetFirstVisPage(GetWin());
+ const SwFrame *pOldPage = Imp()->GetFirstVisPage(GetWin()->GetOutDev());
const SwRect aPrevArea( VisArea() );
const bool bFull = aPrevArea.IsEmpty();
@@ -1125,11 +1125,11 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
while ( pPage && pPage->getFrameArea().Top() <= nBottom )
{
- SwRect aPageRect( pPage->GetBoundRect(GetWin()) );
+ SwRect aPageRect( pPage->GetBoundRect(GetWin()->GetOutDev()) );
if ( bBookMode )
{
const SwPageFrame& rFormatPage = pPage->GetFormatPage();
- aPageRect.SSize( rFormatPage.GetBoundRect(GetWin()).SSize() );
+ aPageRect.SSize( rFormatPage.GetBoundRect(GetWin()->GetOutDev()).SSize() );
}
// #i9719# - consider new border and shadow width
@@ -1218,8 +1218,8 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
if ( HasDrawView() )
{
- Imp()->GetDrawView()->VisAreaChanged( GetWin() );
- Imp()->GetDrawView()->SetActualWin( GetWin() );
+ Imp()->GetDrawView()->VisAreaChanged( GetWin()->GetOutDev() );
+ Imp()->GetDrawView()->SetActualWin( GetWin()->GetOutDev() );
}
GetWin()->PaintImmediately();
@@ -1273,9 +1273,9 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to
//create virtual device and set.
const Size aPixSz = GetWin()->PixelToLogic(Size(1,1));
- VclPtrInstance<VirtualDevice> pVout( *GetWin() );
- pVout->SetLineColor( GetWin()->GetLineColor() );
- pVout->SetFillColor( GetWin()->GetFillColor() );
+ VclPtrInstance<VirtualDevice> pVout( *GetWin()->GetOutDev() );
+ pVout->SetLineColor( GetWin()->GetOutDev()->GetLineColor() );
+ pVout->SetFillColor( GetWin()->GetOutDev()->GetFillColor() );
MapMode aMapMode( GetWin()->GetMapMode() );
pVout->SetMapMode( aMapMode );
Size aSize( maVisArea.Width()+2*aPixSz.Width(), std::abs(lYDiff)+(2*aPixSz.Height()) );
@@ -1330,9 +1330,9 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to
// SW paint stuff
PaintDesktop(*GetOut(), aRect);
- SwViewShell::mbLstAct = true;
+ SwViewShell::sbLstAct = true;
GetLayout()->PaintSwFrame( *GetOut(), aRect );
- SwViewShell::mbLstAct = false;
+ SwViewShell::sbLstAct = false;
// end paint and destroy ObjectContact again
DLPostPaint2(true);
@@ -1394,7 +1394,7 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to
GetWin()->SetMapMode( aTmpMapMode );
if ( Imp()->HasDrawView() )
- Imp()->GetDrawView()->VisAreaChanged( GetWin() );
+ Imp()->GetDrawView()->VisAreaChanged( GetWin()->GetOutDev() );
SetFirstVisPageInvalid();
if ( !Imp()->m_bStopSmooth )
@@ -1636,7 +1636,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
// can't format frames which are locked by the outer action. This may
// cause and endless loop.
++mnStartAction;
- aAction.Action(GetWin());
+ aAction.Action(GetWin()->GetOutDev());
--mnStartAction;
SwRegionRects *pRegion = Imp()->GetRegion();
@@ -1720,7 +1720,7 @@ public:
{
pRef = pValue;
- if (pValue == pShell->GetWin())
+ if (pValue == pShell->GetWin()->GetOutDev())
return;
SdrView* pDrawView(pShell->Imp()->GetDrawView());
@@ -1732,7 +1732,7 @@ public:
if (nullptr != pSdrPageView)
{
- m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*pShell->GetWin());
+ m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*pShell->GetWin()->GetOutDev());
if (nullptr != m_pPatchedPageWindow)
{
@@ -1809,9 +1809,9 @@ void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
//When useful, process or destroy the old InvalidRect.
if ( aRect.IsInside( maInvalidRect ) )
ResetInvalidRect();
- SwViewShell::mbLstAct = true;
+ SwViewShell::sbLstAct = true;
GetLayout()->PaintSwFrame( rRenderContext, aRect );
- SwViewShell::mbLstAct = false;
+ SwViewShell::sbLstAct = false;
}
else
{
@@ -1830,9 +1830,9 @@ void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
//When useful, process or destroy the old InvalidRect.
if ( aRect.IsInside( maInvalidRect ) )
ResetInvalidRect();
- SwViewShell::mbLstAct = true;
+ SwViewShell::sbLstAct = true;
GetLayout()->PaintSwFrame( rRenderContext, aRect );
- SwViewShell::mbLstAct = false;
+ SwViewShell::sbLstAct = false;
// --> OD 2009-08-12 #i101192#
// end Pre/PostPaint encapsulation
DLPostPaint2(true);
@@ -1859,7 +1859,7 @@ void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
for(const auto& rRectangle : aRectangles)
{
- Imp()->AddPaintRect(rRectangle);
+ Imp()->AddPaintRect(SwRect(rRectangle));
}
//RegionHandle hHdl( aRegion.BeginEnumRects() );
@@ -1869,7 +1869,7 @@ void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
//aRegion.EndEnumRects( hHdl );
}
else if ( SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) &&
- GetOut() == GetWin() )
+ GetOut() == GetWin()->GetOutDev() )
{
// #i68597#
const vcl::Region aDLRegion(rRect);
@@ -1938,7 +1938,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
VisPortChgd(SwRect(aOutRect));
// Invoke SwLayAction if layout is not yet ready.
- CheckInvalidForPaint(aOutRect);
+ CheckInvalidForPaint(SwRect(aOutRect));
// draw - works in logic coordinates
Paint(rDevice, aOutRect);
@@ -2075,7 +2075,7 @@ vcl::RenderContext& SwViewShell::GetRefDev() const
if ( GetWin() &&
GetViewOptions()->getBrowseMode() &&
!GetViewOptions()->IsPrtFormat() )
- pTmpOut = GetWin();
+ pTmpOut = GetWin()->GetOutDev();
else
pTmpOut = GetDoc()->getIDocumentDeviceAccess().getReferenceDevice( true );
@@ -2545,12 +2545,12 @@ void SwViewShell::ApplyAccessibilityOptions(SvtAccessibilityOptions const & rAcc
ShellResource* SwViewShell::GetShellRes()
{
- return mpShellRes;
+ return spShellRes;
}
void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew)
{
- (*mpCareDialog.get()) = rNew;
+ (*spCareDialog.get()) = rNew;
}
sal_uInt16 SwViewShell::GetPageCount() const
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 24c7ed35ff03..6ca815c0890c 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -104,10 +104,10 @@ void SwViewShell::Init( const SwViewOption *pNewOpt )
SAL_INFO( "sw.core", "View::Init - after InitPrt" );
if( GetWin() )
{
- SwViewOption::Init( GetWin() );
- GetWin()->SetFillColor();
+ SwViewOption::Init( GetWin()->GetOutDev() );
+ GetWin()->GetOutDev()->SetFillColor();
GetWin()->SetBackground();
- GetWin()->SetLineColor();
+ GetWin()->GetOutDev()->SetLineColor();
}
// Create a new layout, if there is no one available
@@ -150,7 +150,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow,
mpImp( new SwViewShellImp( this ) ),
mpWin( pWindow ),
mpOut( pOutput ? pOutput
- : pWindow ? static_cast<OutputDevice*>(pWindow)
+ : pWindow ? pWindow->GetOutDev()
: static_cast<OutputDevice*>(rDocument.getIDocumentDeviceAccess().getPrinter( true ))),
mpAccOptions( new SwAccessibilityOptions ),
mbShowHeaderSeparator( false ),
@@ -220,7 +220,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow,
mpImp( new SwViewShellImp( this ) ),
mpWin( pWindow ),
mpOut( pOutput ? pOutput
- : pWindow ? static_cast<OutputDevice*>(pWindow)
+ : pWindow ? pWindow->GetOutDev()
: static_cast<OutputDevice*>(rShell.GetDoc()->getIDocumentDeviceAccess().getPrinter( true ))),
mpAccOptions( new SwAccessibilityOptions ),
mbShowHeaderSeparator( false ),
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index bd243d2e074e..768ad00c8cd8 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -554,7 +554,7 @@ bool SwViewShell::PrintOrPDFExport(
pMetaFile->WindStart();
//play back the scaled page
- pMetaFile->Play(pOutDev);
+ pMetaFile->Play(*pOutDev);
pMetaFile.reset();
}
}
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index bff20654c895..93cc659b9c9b 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -45,45 +45,36 @@ namespace {
class SwASC_AttrIter
{
- SwASCWriter& rWrt;
- const SwTextNode& rNd;
- sal_Int32 nCurrentSwPos;
+ SwASCWriter& m_rWrt;
+ const SwTextNode& m_rNd;
+ sal_Int32 m_nCurrentSwPos;
sal_Int32 SearchNext( sal_Int32 nStartPos );
public:
SwASC_AttrIter( SwASCWriter& rWrt, const SwTextNode& rNd, sal_Int32 nStt );
- void NextPos()
- {
- nCurrentSwPos = SearchNext( nCurrentSwPos + 1 );
- }
+ void NextPos() { m_nCurrentSwPos = SearchNext(m_nCurrentSwPos + 1); }
- sal_Int32 WhereNext() const
- {
- return nCurrentSwPos;
- }
+ sal_Int32 WhereNext() const { return m_nCurrentSwPos; }
bool OutAttr( sal_Int32 nSwPos );
};
}
-SwASC_AttrIter::SwASC_AttrIter(
- SwASCWriter& rWr,
- const SwTextNode& rTextNd,
- sal_Int32 nStt )
- : rWrt( rWr )
- , rNd( rTextNd )
- , nCurrentSwPos( 0 )
+SwASC_AttrIter::SwASC_AttrIter(SwASCWriter& rWr, const SwTextNode& rTextNd, sal_Int32 nStt)
+ : m_rWrt(rWr)
+ , m_rNd(rTextNd)
+ , m_nCurrentSwPos(0)
{
- nCurrentSwPos = SearchNext( nStt + 1 );
+ m_nCurrentSwPos = SearchNext(nStt + 1);
}
sal_Int32 SwASC_AttrIter::SearchNext( sal_Int32 nStartPos )
{
sal_Int32 nMinPos = SAL_MAX_INT32;
- const SwpHints* pTextAttrs = rNd.GetpSwpHints();
+ const SwpHints* pTextAttrs = m_rNd.GetpSwpHints();
if( pTextAttrs )
{
// TODO: This can be optimized, if we make use of the fact that the TextAttrs
@@ -123,7 +114,7 @@ sal_Int32 SwASC_AttrIter::SearchNext( sal_Int32 nStartPos )
bool SwASC_AttrIter::OutAttr( sal_Int32 nSwPos )
{
bool bRet = false;
- const SwpHints* pTextAttrs = rNd.GetpSwpHints();
+ const SwpHints* pTextAttrs = m_rNd.GetpSwpHints();
if( pTextAttrs )
{
for( size_t i = 0; i < pTextAttrs->Count(); ++i )
@@ -150,16 +141,16 @@ bool SwASC_AttrIter::OutAttr( sal_Int32 nSwPos )
if( !rFootnote.GetNumStr().isEmpty() )
sOut = rFootnote.GetNumStr();
else if( rFootnote.IsEndNote() )
- sOut = rWrt.m_pDoc->GetEndNoteInfo().m_aFormat.
- GetNumStr( rFootnote.GetNumber() );
+ sOut = m_rWrt.m_pDoc->GetEndNoteInfo().m_aFormat.GetNumStr(
+ rFootnote.GetNumber());
else
- sOut = rWrt.m_pDoc->GetFootnoteInfo().m_aFormat.
- GetNumStr( rFootnote.GetNumber() );
+ sOut = m_rWrt.m_pDoc->GetFootnoteInfo().m_aFormat.GetNumStr(
+ rFootnote.GetNumber());
}
break;
}
if( !sOut.isEmpty() )
- rWrt.Strm().WriteUnicodeOrByteText( sOut );
+ m_rWrt.Strm().WriteUnicodeOrByteText(sOut);
}
else if( nSwPos < pHt->GetStart() )
break;
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index b58f268547ef..871c8315a575 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -21,7 +21,9 @@
#include <tools/stream.hxx>
#include <hintids.hxx>
+#include <sfx2/docfile.hxx>
#include <sfx2/printer.hxx>
+#include <sfx2/sfxsids.hrc>
#include <editeng/fontitem.hxx>
#include <editeng/langitem.hxx>
#include <editeng/formatbreakitem.hxx>
@@ -48,15 +50,16 @@ namespace {
class SwASCIIParser
{
- SwDoc& rDoc;
- std::unique_ptr<SwPaM> pPam;
- SvStream& rInput;
- std::unique_ptr<char[]> pArr;
- const SwAsciiOptions& rOpt;
- std::unique_ptr<SfxItemSet> pItemSet;
- tools::Long nFileSize;
- SvtScriptType nScript;
- bool bNewDoc;
+ SwDoc& m_rDoc;
+ std::unique_ptr<SwPaM> m_pPam;
+ SvStream& m_rInput;
+ std::unique_ptr<char[]> m_pArr;
+ const SwAsciiOptions& m_rOpt;
+ SwAsciiOptions m_usedAsciiOptions;
+ std::unique_ptr<SfxItemSet> m_pItemSet;
+ tools::Long m_nFileSize;
+ SvtScriptType m_nScript;
+ bool m_bNewDoc;
ErrCode ReadChars();
void InsertText( const OUString& rStr );
@@ -69,6 +72,7 @@ public:
bool bReadNewDoc, const SwAsciiOptions& rOpts );
ErrCode CallParser();
+ SwAsciiOptions GetUsedAsciiOptions() {return m_usedAsciiOptions;};
};
}
@@ -86,103 +90,116 @@ ErrCode AsciiReader::Read( SwDoc& rDoc, const OUString&, SwPaM &rPam, const OUSt
!m_bInsertMode, m_aOption.GetASCIIOpts() ));
ErrCode nRet = xParser->CallParser();
+ OUString optionsString;
+ xParser->GetUsedAsciiOptions().WriteUserData(optionsString);
+
+ if(m_pMedium != nullptr && m_pMedium->GetItemSet() != nullptr)
+ m_pMedium->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, optionsString));
+
xParser.reset();
// after Read reset the options
m_aOption.ResetASCIIOpts();
return nRet;
}
-SwASCIIParser::SwASCIIParser(SwDoc& rD, const SwPaM& rCursor, SvStream& rIn,
- bool bReadNewDoc, const SwAsciiOptions& rOpts)
- : rDoc(rD), rInput(rIn), rOpt(rOpts), nFileSize(0), nScript(SvtScriptType::NONE)
- , bNewDoc(bReadNewDoc)
+SwASCIIParser::SwASCIIParser(SwDoc& rD, const SwPaM& rCursor, SvStream& rIn, bool bReadNewDoc,
+ const SwAsciiOptions& rOpts)
+ : m_rDoc(rD)
+ , m_rInput(rIn)
+ , m_rOpt(rOpts)
+ , m_usedAsciiOptions(rOpts)
+ , m_nFileSize(0)
+ , m_nScript(SvtScriptType::NONE)
+ , m_bNewDoc(bReadNewDoc)
{
- pPam.reset( new SwPaM( *rCursor.GetPoint() ) );
- pArr.reset( new char [ ASC_BUFFLEN + 2 ] );
+ m_pPam.reset(new SwPaM(*rCursor.GetPoint()));
+ m_pArr.reset(new char[ASC_BUFFLEN + 2]);
- pItemSet = std::make_unique<SfxItemSet>( rDoc.GetAttrPool(),
- svl::Items<RES_CHRATR_FONT, RES_CHRATR_LANGUAGE,
- RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_LANGUAGE,
- RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_LANGUAGE>{} );
+ m_pItemSet = std::make_unique<SfxItemSet>(
+ m_rDoc.GetAttrPool(),
+ svl::Items<RES_CHRATR_FONT, RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_LANGUAGE>{});
// set defaults from the options
- if( rOpt.GetLanguage() )
+ if (m_rOpt.GetLanguage())
{
- SvxLanguageItem aLang( rOpt.GetLanguage(), RES_CHRATR_LANGUAGE );
- pItemSet->Put( aLang );
+ SvxLanguageItem aLang(m_rOpt.GetLanguage(), RES_CHRATR_LANGUAGE);
+ m_pItemSet->Put(aLang);
aLang.SetWhich(RES_CHRATR_CJK_LANGUAGE);
- pItemSet->Put( aLang );
+ m_pItemSet->Put(aLang);
aLang.SetWhich(RES_CHRATR_CTL_LANGUAGE);
- pItemSet->Put( aLang );
+ m_pItemSet->Put(aLang);
}
- if( rOpt.GetFontName().isEmpty() )
+ if (m_rOpt.GetFontName().isEmpty())
return;
- vcl::Font aTextFont( rOpt.GetFontName(), Size( 0, 10 ) );
- if( rDoc.getIDocumentDeviceAccess().getPrinter( false ) )
- aTextFont = rDoc.getIDocumentDeviceAccess().getPrinter( false )->GetFontMetric( aTextFont );
+ vcl::Font aTextFont(m_rOpt.GetFontName(), Size(0, 10));
+ if (m_rDoc.getIDocumentDeviceAccess().getPrinter(false))
+ aTextFont = m_rDoc.getIDocumentDeviceAccess().getPrinter(false)->GetFontMetric(aTextFont);
SvxFontItem aFont( aTextFont.GetFamilyType(), aTextFont.GetFamilyName(),
OUString(), aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT );
- pItemSet->Put( aFont );
+ m_pItemSet->Put(aFont);
aFont.SetWhich(RES_CHRATR_CJK_FONT);
- pItemSet->Put( aFont );
+ m_pItemSet->Put(aFont);
aFont.SetWhich(RES_CHRATR_CTL_FONT);
- pItemSet->Put( aFont );
+ m_pItemSet->Put(aFont);
}
// Calling the parser
ErrCode SwASCIIParser::CallParser()
{
- rInput.ResetError();
- nFileSize = rInput.TellEnd();
- rInput.Seek(STREAM_SEEK_TO_BEGIN);
- rInput.ResetError();
+ m_rInput.ResetError();
+ m_nFileSize = m_rInput.TellEnd();
+ m_rInput.Seek(STREAM_SEEK_TO_BEGIN);
+ m_rInput.ResetError();
- ::StartProgress( STR_STATSTR_W4WREAD, 0, nFileSize, rDoc.GetDocShell() );
+ ::StartProgress(STR_STATSTR_W4WREAD, 0, m_nFileSize, m_rDoc.GetDocShell());
std::unique_ptr<SwPaM> pInsPam;
sal_Int32 nSttContent = 0;
- if (!bNewDoc)
+ if (!m_bNewDoc)
{
- const SwNodeIndex& rTmp = pPam->GetPoint()->nNode;
+ const SwNodeIndex& rTmp = m_pPam->GetPoint()->nNode;
pInsPam.reset(new SwPaM( rTmp, rTmp, 0, -1 ));
- nSttContent = pPam->GetPoint()->nContent.GetIndex();
+ nSttContent = m_pPam->GetPoint()->nContent.GetIndex();
}
SwTextFormatColl *pColl = nullptr;
- if (bNewDoc)
+ if (m_bNewDoc)
{
- pColl = rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_HTML_PRE, false);
+ pColl = m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_HTML_PRE,
+ false);
if (!pColl)
- pColl = rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD,false);
+ pColl = m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD,
+ false);
if (pColl)
- rDoc.SetTextFormatColl(*pPam, pColl);
+ m_rDoc.SetTextFormatColl(*m_pPam, pColl);
}
ErrCode nError = ReadChars();
- if( pItemSet )
+ if (m_pItemSet)
{
// set only the attribute, for scanned scripts.
- if( !( SvtScriptType::LATIN & nScript ))
+ if (!(SvtScriptType::LATIN & m_nScript))
{
- pItemSet->ClearItem( RES_CHRATR_FONT );
- pItemSet->ClearItem( RES_CHRATR_LANGUAGE );
+ m_pItemSet->ClearItem(RES_CHRATR_FONT);
+ m_pItemSet->ClearItem(RES_CHRATR_LANGUAGE);
}
- if( !( SvtScriptType::ASIAN & nScript ))
+ if (!(SvtScriptType::ASIAN & m_nScript))
{
- pItemSet->ClearItem( RES_CHRATR_CJK_FONT );
- pItemSet->ClearItem( RES_CHRATR_CJK_LANGUAGE );
+ m_pItemSet->ClearItem(RES_CHRATR_CJK_FONT);
+ m_pItemSet->ClearItem(RES_CHRATR_CJK_LANGUAGE);
}
- if( !( SvtScriptType::COMPLEX & nScript ))
+ if (!(SvtScriptType::COMPLEX & m_nScript))
{
- pItemSet->ClearItem( RES_CHRATR_CTL_FONT );
- pItemSet->ClearItem( RES_CHRATR_CTL_LANGUAGE );
+ m_pItemSet->ClearItem(RES_CHRATR_CTL_FONT);
+ m_pItemSet->ClearItem(RES_CHRATR_CTL_LANGUAGE);
}
- if( pItemSet->Count() )
+ if (m_pItemSet->Count())
{
- if( bNewDoc )
+ if (m_bNewDoc)
{
if (pColl)
{
@@ -206,37 +223,37 @@ ErrCode SwASCIIParser::CallParser()
while (*pWhichIds)
{
const SfxPoolItem *pItem;
- if (SfxItemState::SET == pItemSet->GetItemState(*pWhichIds,
- false, &pItem))
+ if (SfxItemState::SET
+ == m_pItemSet->GetItemState(*pWhichIds, false, &pItem))
{
pColl->SetFormatAttr( *pItem );
- pItemSet->ClearItem( *pWhichIds );
+ m_pItemSet->ClearItem(*pWhichIds);
}
++pWhichIds;
}
}
- if (pItemSet->Count())
- rDoc.SetDefault(*pItemSet);
+ if (m_pItemSet->Count())
+ m_rDoc.SetDefault(*m_pItemSet);
}
else if( pInsPam )
{
// then set over the insert range the defined attributes
- *pInsPam->GetMark() = *pPam->GetPoint();
+ *pInsPam->GetMark() = *m_pPam->GetPoint();
++pInsPam->GetPoint()->nNode;
pInsPam->GetPoint()->nContent.Assign(
pInsPam->GetContentNode(), nSttContent );
// !!!!!
OSL_ENSURE( false, "Have to change - hard attr. to para. style" );
- rDoc.getIDocumentContentOperations().InsertItemSet( *pInsPam, *pItemSet );
+ m_rDoc.getIDocumentContentOperations().InsertItemSet(*pInsPam, *m_pItemSet);
}
}
- pItemSet.reset();
+ m_pItemSet.reset();
}
pInsPam.reset();
- ::EndProgress( rDoc.GetDocShell() );
+ ::EndProgress(m_rDoc.GetDocShell());
return nError;
}
@@ -247,20 +264,21 @@ ErrCode SwASCIIParser::ReadChars()
sal_Unicode cLastCR = 0;
bool bSwapUnicode = false;
- const SwAsciiOptions *pUseMe=&rOpt;
+ const SwAsciiOptions* pUseMe = &m_rOpt;
SwAsciiOptions aEmpty;
- if (nFileSize >= 2 &&
- aEmpty.GetFontName() == rOpt.GetFontName() &&
- aEmpty.GetCharSet() == rOpt.GetCharSet() &&
- aEmpty.GetLanguage() == rOpt.GetLanguage() &&
- aEmpty.GetParaFlags() == rOpt.GetParaFlags())
+ if (m_nFileSize >= 2 && aEmpty.GetFontName() == m_rOpt.GetFontName()
+ && aEmpty.GetCharSet() == m_rOpt.GetCharSet()
+ && aEmpty.GetLanguage() == m_rOpt.GetLanguage()
+ && aEmpty.GetParaFlags() == m_rOpt.GetParaFlags())
{
sal_Size nLen, nOrig;
- nOrig = nLen = rInput.ReadBytes(pArr.get(), ASC_BUFFLEN);
+ nOrig = nLen = m_rInput.ReadBytes(m_pArr.get(), ASC_BUFFLEN);
rtl_TextEncoding eCharSet;
LineEnd eLineEnd;
+ bool bHasBom;
const bool bRet
- = SwIoSystem::IsDetectableText(pArr.get(), nLen, &eCharSet, &bSwapUnicode, &eLineEnd);
+ = SwIoSystem::IsDetectableText(m_pArr.get(), nLen, &eCharSet,
+ &bSwapUnicode, &eLineEnd, &bHasBom);
if (!bRet)
return ERRCODE_IO_BROKENPACKAGE;
@@ -269,12 +287,14 @@ ErrCode SwASCIIParser::ReadChars()
{
aEmpty.SetCharSet(eCharSet);
aEmpty.SetParaFlags(eLineEnd);
- rInput.SeekRel(-(tools::Long(nLen)));
+ aEmpty.SetIncludeBOM(bHasBom);
+ m_rInput.SeekRel(-(tools::Long(nLen)));
}
else
- rInput.SeekRel(-(tools::Long(nOrig)));
+ m_rInput.SeekRel(-(tools::Long(nOrig)));
pUseMe=&aEmpty;
}
+ m_usedAsciiOptions = *pUseMe;
rtl_TextToUnicodeConverter hConverter=nullptr;
rtl_TextToUnicodeContext hContext=nullptr;
@@ -292,8 +312,8 @@ ErrCode SwASCIIParser::ReadChars()
}
else if (pUseMe != &aEmpty) //Already successfully figured out type
{
- rInput.StartReadingUnicodeText( currentCharSet );
- bSwapUnicode = rInput.IsEndianSwap();
+ m_rInput.StartReadingUnicodeText(currentCharSet);
+ bSwapUnicode = m_rInput.IsEndianSwap();
}
std::unique_ptr<sal_Unicode[]> aWork;
@@ -307,9 +327,10 @@ ErrCode SwASCIIParser::ReadChars()
// Read a new block
sal_Size lGCount;
- if( ERRCODE_NONE != rInput.GetError() || 0 == (lGCount =
- rInput.ReadBytes( pArr.get() + nArrOffset,
- ASC_BUFFLEN - nArrOffset )))
+ if (ERRCODE_NONE != m_rInput.GetError()
+ || 0
+ == (lGCount = m_rInput.ReadBytes(m_pArr.get() + nArrOffset,
+ ASC_BUFFLEN - nArrOffset)))
break; // break from the while loop
/*
@@ -328,32 +349,29 @@ ErrCode SwASCIIParser::ReadChars()
sal_Unicode* pBuf = aWork.get();
pBuf[nNewLen] = 0; // ensure '\0'
- nNewLen = rtl_convertTextToUnicode( hConverter, hContext,
- pArr.get(), lGCount, pBuf, nNewLen,
- (
- RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
- RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
- RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT |
- RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE
- ),
- &nInfo,
- &nCntBytes );
+ nNewLen = rtl_convertTextToUnicode(hConverter, hContext, m_pArr.get(), lGCount,
+ pBuf, nNewLen,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE),
+ &nInfo, &nCntBytes);
nArrOffset = lGCount - nCntBytes;
if( 0 != nArrOffset )
- memmove( pArr.get(), pArr.get() + nCntBytes, nArrOffset );
+ memmove(m_pArr.get(), m_pArr.get() + nCntBytes, nArrOffset);
pStt = pLastStt = aWork.get();
pEnd = pStt + nNewLen;
}
else
{
- pStt = pLastStt = reinterpret_cast<sal_Unicode*>(pArr.get());
+ pStt = pLastStt = reinterpret_cast<sal_Unicode*>(m_pArr.get());
auto nChars = lGCount / 2;
pEnd = pStt + nChars;
if( bSwapUnicode )
{
- char* pF = pArr.get(), *pN = pArr.get() + 1;
+ char *pF = m_pArr.get(), *pN = m_pArr.get() + 1;
for (sal_Size n = 0; n < nChars; ++n, pF += 2, pN += 2)
{
char c = *pF;
@@ -366,7 +384,7 @@ ErrCode SwASCIIParser::ReadChars()
*pEnd = 0;
nReadCnt += lGCount;
- ::SetProgressState( nReadCnt, rDoc.GetDocShell() );
+ ::SetProgressState(nReadCnt, m_rDoc.GetDocShell());
if( cLastCR )
{
@@ -375,9 +393,8 @@ ErrCode SwASCIIParser::ReadChars()
cLastCR = 0;
nLineLen = 0;
// We skip the last one at the end
- if( !rInput.eof() || !(pEnd == pStt ||
- ( !*pEnd && pEnd == pStt+1 ) ) )
- rDoc.getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
+ if (!m_rInput.eof() || !(pEnd == pStt || (!*pEnd && pEnd == pStt + 1)))
+ m_rDoc.getIDocumentContentOperations().SplitNode(*m_pPam->GetPoint(), false);
}
}
@@ -392,7 +409,7 @@ ErrCode SwASCIIParser::ReadChars()
++pStt;
// We skip the last one at the end
- if( !rInput.eof() || pEnd != pStt )
+ if (!m_rInput.eof() || pEnd != pStt)
bSplitNode = true;
}
break;
@@ -416,7 +433,7 @@ ErrCode SwASCIIParser::ReadChars()
}
// We skip the last one at the end
- if( bChkSplit && ( !rInput.eof() || pEnd != pStt ))
+ if (bChkSplit && (!m_rInput.eof() || pEnd != pStt))
bSplitNode = true;
}
break;
@@ -429,9 +446,10 @@ ErrCode SwASCIIParser::ReadChars()
{
InsertText( OUString( pLastStt ));
}
- rDoc.getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
- rDoc.getIDocumentContentOperations().InsertPoolItem(
- *pPam, SvxFormatBreakItem( SvxBreak::PageBefore, RES_BREAK ) );
+ m_rDoc.getIDocumentContentOperations().SplitNode(*m_pPam->GetPoint(),
+ false);
+ m_rDoc.getIDocumentContentOperations().InsertPoolItem(
+ *m_pPam, SvxFormatBreakItem(SvxBreak::PageBefore, RES_BREAK));
pLastStt = pStt;
nLineLen = 0;
bIns = false;
@@ -439,11 +457,11 @@ ErrCode SwASCIIParser::ReadChars()
break;
case 0x1a:
- if( nReadCnt == nFileSize && pStt+1 == pEnd )
- *pStt = 0;
- else
- *pStt = '#'; // Replacement visualisation
- break;
+ if (nReadCnt == m_nFileSize && pStt + 1 == pEnd)
+ *pStt = 0;
+ else
+ *pStt = '#'; // Replacement visualisation
+ break;
case '\t': break;
@@ -462,7 +480,7 @@ ErrCode SwASCIIParser::ReadChars()
sal_Unicode c = *pStt;
*pStt = 0;
InsertText( OUString( pLastStt ));
- rDoc.getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
+ m_rDoc.getIDocumentContentOperations().SplitNode(*m_pPam->GetPoint(), false);
pLastStt = pStt;
nLineLen = 0;
*pStt = c;
@@ -474,10 +492,10 @@ ErrCode SwASCIIParser::ReadChars()
{
// We found a CR/LF, thus save the text
InsertText( OUString( pLastStt ));
- if(bNewDoc)
- rDoc.getIDocumentContentOperations().AppendTextNode( *pPam->GetPoint() );
+ if (m_bNewDoc)
+ m_rDoc.getIDocumentContentOperations().AppendTextNode(*m_pPam->GetPoint());
else
- rDoc.getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
+ m_rDoc.getIDocumentContentOperations().SplitNode(*m_pPam->GetPoint(), false);
pLastStt = pStt;
nLineLen = 0;
}
@@ -493,12 +511,11 @@ ErrCode SwASCIIParser::ReadChars()
void SwASCIIParser::InsertText( const OUString& rStr )
{
- rDoc.getIDocumentContentOperations().InsertString( *pPam, rStr );
+ m_rDoc.getIDocumentContentOperations().InsertString(*m_pPam, rStr);
- if( pItemSet && g_pBreakIt && nScript != ( SvtScriptType::LATIN |
- SvtScriptType::ASIAN |
- SvtScriptType::COMPLEX ) )
- nScript |= g_pBreakIt->GetAllScriptsOfText( rStr );
+ if (m_pItemSet && g_pBreakIt
+ && m_nScript != (SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX))
+ m_nScript |= g_pBreakIt->GetAllScriptsOfText(rStr);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx
index 2d530e7531b5..1bba438e87e8 100644
--- a/sw/source/filter/ascii/wrtasc.cxx
+++ b/sw/source/filter/ascii/wrtasc.cxx
@@ -27,6 +27,8 @@
#include <frmfmt.hxx>
#include "wrtasc.hxx"
#include <frameformats.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/sfxsids.hrc>
#include <strings.hrc>
@@ -85,6 +87,7 @@ SwASCWriter::~SwASCWriter() {}
ErrCode SwASCWriter::WriteStream()
{
bool bIncludeBOM = GetAsciiOptions().GetIncludeBOM();
+ bool bIncludeHidden = GetAsciiOptions().GetIncludeHidden();
if( m_bASCII_ParaAsCR ) // If predefined
m_sLineEnd = "\015";
@@ -147,7 +150,7 @@ ErrCode SwASCWriter::WriteStream()
continue; // reset while loop!
}
}
- else
+ else if (!pNd->IsHidden() || bIncludeHidden)
{
if (bWriteSttTag)
{
@@ -202,6 +205,23 @@ ErrCode SwASCWriter::WriteStream()
return ERRCODE_NONE;
}
+void SwASCWriter::SetupFilterOptions(SfxMedium& rMedium)
+{
+ const SfxItemSet* pSet = rMedium.GetItemSet();
+ if( nullptr != pSet )
+ {
+ const SfxPoolItem* pItem;
+ if( SfxItemState::SET == pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
+ {
+ SwAsciiOptions aOpt;
+ OUString sItemOpt;
+ sItemOpt = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ aOpt.ReadUserData(sItemOpt);
+ SetAsciiOptions(aOpt);
+ }
+ }
+}
+
void GetASCWriter(
const OUString& rFltNm, [[maybe_unused]] const OUString& /*rBaseURL*/, WriterRef& xRet )
{
diff --git a/sw/source/filter/ascii/wrtasc.hxx b/sw/source/filter/ascii/wrtasc.hxx
index 8be5e5352f61..b2a91c589599 100644
--- a/sw/source/filter/ascii/wrtasc.hxx
+++ b/sw/source/filter/ascii/wrtasc.hxx
@@ -36,6 +36,7 @@ public:
SwASCWriter(const OUString& rFilterName);
virtual ~SwASCWriter() override;
+ void SetupFilterOptions(SfxMedium& rMedium) override;
const OUString& GetLineEnd() const { return m_sLineEnd; }
};
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index e8a64eda2d83..27e7f1e7ba55 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -354,9 +354,9 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
if( nMaxFrame < MINLAY )
nMaxFrame = MINLAY;
- if( nWidth > static_cast<sal_uInt16>(nMaxFrame) )
+ if( nWidth > o3tl::narrowing<sal_uInt16>(nMaxFrame) )
nWidth = nMaxFrame;
- else if( nWidth > static_cast<sal_uInt16>(nMinFrame) )
+ else if( nWidth > o3tl::narrowing<sal_uInt16>(nMinFrame) )
nWidth = nMinFrame;
}
}
@@ -542,6 +542,7 @@ OUString NameFromCharSet(rtl_TextEncoding nChrSet)
// 3. Fontname
// 4. Language
// 5. Whether to include byte-order-mark - as true/false
+// 6. Whether to include hidden paragraphs and text - as true/false
// the delimiter character is ","
void SwAsciiOptions::ReadUserData( const OUString& rStr )
@@ -565,6 +566,9 @@ void SwAsciiOptions::ReadUserData( const OUString& rStr )
m_nLanguage = LanguageTag::convertToLanguageTypeWithFallback(sToken);
if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 5. Include BOM?
m_bIncludeBOM = !(sToken.equalsIgnoreAsciiCase("FALSE"));
+ // 6. Include hidden text
+ if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty())
+ m_bIncludeHidden = !(sToken.equalsIgnoreAsciiCase("FALSE"));
}
void SwAsciiOptions::WriteUserData(OUString& rStr)
@@ -598,7 +602,18 @@ void SwAsciiOptions::WriteUserData(OUString& rStr)
rStr += ",";
// 5. Whether to include byte-order-mark
- if( m_bIncludeBOM )
+ if(m_bIncludeBOM)
+ {
+ rStr += "true";
+ }
+ else
+ {
+ rStr += "false";
+ }
+ rStr += ",";
+
+ // 6. Whether to include hidden paragraphs and text
+ if(m_bIncludeHidden)
{
rStr += "true";
}
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index 43bea4896896..e90e274f04c4 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -78,15 +78,12 @@ static OUString lcl_getTypePath(OUString& rType)
SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, std::unique_ptr<SfxPoolItem> pHt)
: m_aMkPos(rStartPos)
, m_aPtPos(rStartPos)
- , pAttr( std::move(pHt) )
+ , m_pAttr( std::move(pHt) )
, m_isAnnotationOnEnd(false)
- , mnStartCP(-1)
- , mnEndCP(-1)
- , bIsParaEnd(false)
{
- bOld = false; // used for marking Attributes *before* skipping field results
- bOpen = true; // lock the attribute --> may first
- bConsumedByField = false;
+ m_bOld = false; // used for marking Attributes *before* skipping field results
+ m_bOpen = true; // lock the attribute --> may first
+ m_bConsumedByField = false;
}
SwFltStackEntry::~SwFltStackEntry()
@@ -100,20 +97,17 @@ void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos)
// Everything with sal_uInt16s, lest the inserting of new text at
// the cursor position moves the attribute's range
// That's not the desired behavior!
- bOpen = false; // release and remember END
+ m_bOpen = false; // release and remember END
m_aPtPos.FromSwPosition(rEndPos);
}
bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const eCheck,
- const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, bool bIsParaEnd,
+ const SwFltPosition &rMkPos, const SwFltPosition &rPtPos,
sal_uInt16 nWhich)
{
// does this range actually contain something?
// empty range is allowed if at start of empty paragraph
// fields are special: never have range, so leave them
-
- // The only position of 0x0D will not be able to make region in the old logic
- // because it is beyond the length of para...need special consideration here.
sal_uLong nMk = rMkPos.m_nNode.GetIndex() + 1;
const SwNodes& rMkNodes = rMkPos.m_nNode.GetNodes();
if (nMk >= rMkNodes.Count())
@@ -123,8 +117,7 @@ bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const e
((0 != rPtPos.m_nContent) || (pContentNode && (0 != pContentNode->Len())))
&& ( RES_TXTATR_FIELD != nWhich
&& RES_TXTATR_ANNOTATION != nWhich
- && RES_TXTATR_INPUTFIELD != nWhich )
- && !(bIsParaEnd && pContentNode && pContentNode->IsTextNode() && 0 != pContentNode->Len() ))
+ && RES_TXTATR_INPUTFIELD != nWhich ))
{
return false;
}
@@ -168,12 +161,11 @@ bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const e
bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode eCheck) const
{
- return MakeRegion(rDoc, rRegion, eCheck, m_aMkPos, m_aPtPos, bIsParaEnd,
- pAttr->Which());
+ return MakeRegion(rDoc, rRegion, eCheck, m_aMkPos, m_aPtPos, m_pAttr->Which());
}
SwFltControlStack::SwFltControlStack(SwDoc& rDo, sal_uLong nFieldFl)
- : nFieldFlags(nFieldFl),bHasSdOD(true), bSdODChecked(false), rDoc(rDo), bIsEndStack(false)
+ : m_nFieldFlags(nFieldFl), m_rDoc(rDo), m_bIsEndStack(false)
{
}
@@ -204,7 +196,7 @@ void SwFltControlStack::MoveAttrs(const SwPosition& rPos, MoveAttrsMode eMode)
{
rEntry.m_aMkPos.m_nContent++;
OSL_ENSURE( rEntry.m_aMkPos.m_nContent
- <= rDoc.GetNodes()[nPosNd]->GetContentNode()->Len(),
+ <= m_rDoc.GetNodes()[nPosNd]->GetContentNode()->Len(),
"Attribute ends after end of line" );
}
if (
@@ -218,14 +210,14 @@ void SwFltControlStack::MoveAttrs(const SwPosition& rPos, MoveAttrsMode eMode)
assert(!(rEntry.m_isAnnotationOnEnd && rEntry.m_aPtPos.m_nContent > nPosCt));
if ( eMode == MoveAttrsMode::POSTIT_INSERTED
&& rEntry.m_aPtPos.m_nContent == nPosCt
- && rEntry.pAttr->Which() == RES_FLTR_ANNOTATIONMARK)
+ && rEntry.m_pAttr->Which() == RES_FLTR_ANNOTATIONMARK)
{
rEntry.m_isAnnotationOnEnd = true;
eMode = MoveAttrsMode::DEFAULT; // only set 1 flag
}
rEntry.m_aPtPos.m_nContent++;
OSL_ENSURE( rEntry.m_aPtPos.m_nContent
- <= rDoc.GetNodes()[nPosNd]->GetContentNode()->Len(),
+ <= m_rDoc.GetNodes()[nPosNd]->GetContentNode()->Len(),
"Attribute ends after end of line" );
}
}
@@ -236,7 +228,7 @@ void SwFltControlStack::MarkAllAttrsOld()
{
size_t nCnt = m_Entries.size();
for (size_t i=0; i < nCnt; ++i)
- m_Entries[i]->bOld = true;
+ m_Entries[i]->m_bOld = true;
}
namespace
@@ -245,12 +237,12 @@ namespace
const SfxPoolItem& rAttr)
{
return (pExtendCandidate &&
- !pExtendCandidate->bConsumedByField &&
+ !pExtendCandidate->m_bConsumedByField &&
//if we bring character attributes into the fold we need to both
//a) consider RES_CHRATR_FONTSIZE and RES_CHRATR_FONT wrt Word's CJK/CTL variants
//b) consider crossing table cell boundaries (tdf#102334)
isPARATR_LIST(rAttr.Which()) &&
- *(pExtendCandidate->pAttr) == rAttr);
+ *(pExtendCandidate->m_pAttr) == rAttr);
}
}
@@ -270,12 +262,11 @@ void SwFltControlStack::NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr
//from. If so we merge it with this one and elide adding another
//to the stack
pExtendCandidate->SetEndPos(rPos);
- pExtendCandidate->bOpen=true;
+ pExtendCandidate->m_bOpen=true;
}
else
{
SwFltStackEntry *pTmp = new SwFltStackEntry(rPos, std::unique_ptr<SfxPoolItem>(rAttr.Clone()) );
- pTmp->SetStartCP(GetCurrAttrCP());
m_Entries.push_back(std::unique_ptr<SwFltStackEntry>(pTmp));
}
}
@@ -288,14 +279,6 @@ void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt)
auto aElement = m_Entries.begin() + nCnt;
m_Entries.erase(aElement);
}
- //Clear the para end position recorded in reader intermittently for the least impact on loading performance
- //Because the attributes handled based on the unit of para
- if ( empty() )
- {
- ClearParaEndPosition();
- bHasSdOD = true;
- bSdODChecked = false;
- }
}
// SwFltControlStack::StealAttr() removes attributes of the given type
@@ -331,8 +314,8 @@ void SwFltControlStack::KillUnlockedAttrs(const SwPosition& rPos)
{
nCnt --;
SwFltStackEntry& rEntry = *m_Entries[nCnt];
- if( !rEntry.bOld
- && !rEntry.bOpen
+ if( !rEntry.m_bOld
+ && !rEntry.m_bOpen
&& (rEntry.m_aMkPos == aFltPos)
&& (rEntry.m_aPtPos == aFltPos))
{
@@ -363,7 +346,7 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
bool bLastEntry = aI == m_Entries.end() - 1;
SwFltStackEntry& rEntry = **aI;
- if (rEntry.bOpen)
+ if (rEntry.m_bOpen)
{
// set end of attribute
bool bF = false;
@@ -371,32 +354,31 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
{
bF = true;
}
- else if (nAttrId == rEntry.pAttr->Which())
+ else if (nAttrId == rEntry.m_pAttr->Which())
{
if( nAttrId != RES_FLTR_BOOKMARK && nAttrId != RES_FLTR_ANNOTATIONMARK && nAttrId != RES_FLTR_RDFMARK )
{
// query handle
bF = true;
}
- else if (nAttrId == RES_FLTR_BOOKMARK && nHand == static_cast<SwFltBookmark*>(rEntry.pAttr.get())->GetHandle())
+ else if (nAttrId == RES_FLTR_BOOKMARK && nHand == static_cast<SwFltBookmark*>(rEntry.m_pAttr.get())->GetHandle())
{
bF = true;
}
- else if (nAttrId == RES_FLTR_ANNOTATIONMARK && nHand == static_cast<CntUInt16Item*>(rEntry.pAttr.get())->GetValue())
+ else if (nAttrId == RES_FLTR_ANNOTATIONMARK && nHand == static_cast<CntUInt16Item*>(rEntry.m_pAttr.get())->GetValue())
{