summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
commit04cbeac1177f9d1a893f56430e1e46e8c650c120 (patch)
tree1dfdf1e44ba056403edb32766ffcc9f63dbf302a /sw/source
parent05a1db9d3e14f223a2160902ce3f076bed2f7ce2 (diff)
parent91022595b4982107069d099ba61a19430023e184 (diff)
merge commit to DEV300_m57
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/access/acchyperlink.cxx4
-rw-r--r--sw/source/core/access/accnotextframe.cxx118
-rw-r--r--sw/source/core/access/accnotextframe.hxx12
-rw-r--r--sw/source/core/access/acctextframe.cxx112
-rw-r--r--sw/source/core/access/acctextframe.hxx11
-rw-r--r--sw/source/core/attr/calbck.cxx4
-rw-r--r--sw/source/core/bastyp/breakit.cxx13
-rw-r--r--sw/source/core/bastyp/index.cxx2
-rw-r--r--sw/source/core/crsr/crossrefbookmark.cxx5
-rw-r--r--sw/source/core/crsr/crsrsh.cxx64
-rw-r--r--sw/source/core/crsr/findattr.cxx4
-rw-r--r--sw/source/core/crsr/findtxt.cxx2
-rw-r--r--sw/source/core/crsr/pam.cxx237
-rw-r--r--sw/source/core/crsr/swcrsr.cxx261
-rw-r--r--sw/source/core/crsr/trvlreg.cxx2
-rw-r--r--sw/source/core/crsr/trvltbl.cxx5
-rw-r--r--sw/source/core/crsr/unocrsr.cxx42
-rw-r--r--sw/source/core/crsr/viscrs.cxx259
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx4
-rw-r--r--sw/source/core/doc/doc.cxx12
-rw-r--r--sw/source/core/doc/docbm.cxx77
-rw-r--r--sw/source/core/doc/doccomp.cxx6
-rw-r--r--sw/source/core/doc/doccorr.cxx12
-rw-r--r--sw/source/core/doc/docdde.cxx2
-rw-r--r--sw/source/core/doc/docedt.cxx93
-rw-r--r--sw/source/core/doc/docfld.cxx9
-rw-r--r--sw/source/core/doc/docfly.cxx72
-rw-r--r--sw/source/core/doc/docfmt.cxx75
-rw-r--r--sw/source/core/doc/docftn.cxx44
-rw-r--r--sw/source/core/doc/docglbl.cxx4
-rw-r--r--sw/source/core/doc/docglos.cxx2
-rw-r--r--sw/source/core/doc/doclay.cxx4
-rw-r--r--sw/source/core/doc/docnew.cxx441
-rw-r--r--sw/source/core/doc/docnum.cxx12
-rw-r--r--sw/source/core/doc/docredln.cxx16
-rw-r--r--sw/source/core/doc/doctxm.cxx8
-rw-r--r--sw/source/core/doc/notxtfrm.cxx62
-rw-r--r--sw/source/core/doc/swserv.cxx7
-rw-r--r--sw/source/core/doc/tblcpy.cxx2
-rw-r--r--sw/source/core/doc/tblrwcl.cxx17
-rw-r--r--sw/source/core/doc/visiturl.cxx4
-rw-r--r--sw/source/core/docnode/ndcopy.cxx76
-rw-r--r--sw/source/core/docnode/ndnotxt.cxx58
-rw-r--r--sw/source/core/docnode/ndtbl.cxx13
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx5
-rw-r--r--sw/source/core/docnode/section.cxx4
-rw-r--r--sw/source/core/draw/dcontact.cxx38
-rw-r--r--sw/source/core/draw/dflyobj.cxx201
-rw-r--r--sw/source/core/draw/dpage.cxx4
-rw-r--r--sw/source/core/draw/dview.cxx75
-rw-r--r--sw/source/core/edit/acorrect.cxx4
-rw-r--r--sw/source/core/edit/edattr.cxx13
-rw-r--r--sw/source/core/edit/eddel.cxx26
-rw-r--r--sw/source/core/edit/edglss.cxx6
-rw-r--r--sw/source/core/edit/editsh.cxx47
-rw-r--r--sw/source/core/edit/edsect.cxx6
-rw-r--r--sw/source/core/edit/edws.cxx18
-rw-r--r--sw/source/core/fields/authfld.cxx5
-rw-r--r--sw/source/core/fields/cellfml.cxx2
-rw-r--r--sw/source/core/frmedt/fecopy.cxx4
-rw-r--r--sw/source/core/frmedt/fefly1.cxx132
-rw-r--r--sw/source/core/frmedt/feshview.cxx8
-rw-r--r--sw/source/core/frmedt/fetab.cxx47
-rw-r--r--sw/source/core/frmedt/tblsel.cxx16
-rw-r--r--sw/source/core/graphic/ndgrf.cxx3
-rw-r--r--sw/source/core/inc/crossrefbookmark.hxx2
-rw-r--r--sw/source/core/inc/dflyobj.hxx5
-rw-r--r--sw/source/core/inc/dview.hxx4
-rw-r--r--sw/source/core/inc/pagefrm.hxx2
-rw-r--r--sw/source/core/inc/undoflystrattr.hxx (renamed from sw/source/ui/inc/itemdef.hxx)38
-rw-r--r--sw/source/core/inc/viewimp.hxx2
-rw-r--r--sw/source/core/layout/atrfrm.cxx74
-rw-r--r--sw/source/core/layout/colfrm.cxx9
-rw-r--r--sw/source/core/layout/flowfrm.cxx2
-rw-r--r--sw/source/core/layout/fly.cxx12
-rw-r--r--sw/source/core/layout/ftnfrm.cxx4
-rw-r--r--sw/source/core/layout/pagechg.cxx4
-rw-r--r--sw/source/core/layout/pagedesc.cxx7
-rw-r--r--sw/source/core/layout/paintfrm.cxx19
-rw-r--r--sw/source/core/layout/tabfrm.cxx10
-rw-r--r--sw/source/core/layout/trvlfrm.cxx6
-rw-r--r--sw/source/core/ole/ndole.cxx3
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx16
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx2
-rw-r--r--sw/source/core/text/atrstck.cxx12
-rw-r--r--sw/source/core/text/frmform.cxx4
-rw-r--r--sw/source/core/text/itratr.cxx18
-rw-r--r--sw/source/core/text/itrform2.cxx5
-rw-r--r--sw/source/core/text/itrtxt.cxx2
-rw-r--r--sw/source/core/text/makefile.mk3
-rw-r--r--sw/source/core/text/porfly.cxx4
-rw-r--r--sw/source/core/text/porlay.cxx33
-rw-r--r--sw/source/core/text/txtdrop.cxx2
-rw-r--r--sw/source/core/text/txtfld.cxx14
-rw-r--r--sw/source/core/text/txtfrm.cxx14
-rw-r--r--sw/source/core/text/txtftn.cxx10
-rw-r--r--sw/source/core/text/txtio.cxx43
-rw-r--r--sw/source/core/text/txttab.cxx10
-rw-r--r--sw/source/core/tox/txmsrt.cxx78
-rw-r--r--sw/source/core/txtnode/atrfld.cxx48
-rw-r--r--sw/source/core/txtnode/atrflyin.cxx4
-rw-r--r--sw/source/core/txtnode/atrftn.cxx172
-rw-r--r--sw/source/core/txtnode/atrref.cxx26
-rw-r--r--sw/source/core/txtnode/atrtox.cxx26
-rw-r--r--sw/source/core/txtnode/fntcache.cxx19
-rw-r--r--sw/source/core/txtnode/ndhints.cxx105
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx504
-rw-r--r--sw/source/core/txtnode/thints.cxx341
-rw-r--r--sw/source/core/txtnode/txatbase.cxx30
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx132
-rw-r--r--sw/source/core/txtnode/txtedt.cxx367
-rw-r--r--sw/source/core/undo/makefile.mk3
-rw-r--r--sw/source/core/undo/rolbck.cxx1142
-rw-r--r--sw/source/core/undo/unattr.cxx888
-rw-r--r--sw/source/core/undo/unbkmk.cxx31
-rw-r--r--sw/source/core/undo/undel.cxx39
-rw-r--r--sw/source/core/undo/undo.hrc4
-rw-r--r--sw/source/core/undo/undo.src8
-rw-r--r--sw/source/core/undo/undobj.cxx53
-rw-r--r--sw/source/core/undo/undoflystrattr.cxx107
-rw-r--r--sw/source/core/undo/unins.cxx141
-rw-r--r--sw/source/core/undo/unmove.cxx18
-rw-r--r--sw/source/core/undo/unovwr.cxx10
-rw-r--r--sw/source/core/undo/unsect.cxx8
-rw-r--r--sw/source/core/undo/unspnd.cxx4
-rw-r--r--sw/source/core/undo/untbl.cxx101
-rw-r--r--sw/source/core/undo/untblk.cxx8
-rw-r--r--sw/source/core/unocore/unobkm.cxx2
-rw-r--r--sw/source/core/unocore/unochart.cxx23
-rw-r--r--sw/source/core/unocore/unocoll.cxx145
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx14
-rw-r--r--sw/source/core/unocore/unofield.cxx38
-rw-r--r--sw/source/core/unocore/unoframe.cxx176
-rw-r--r--sw/source/core/unocore/unomap.cxx7
-rw-r--r--sw/source/core/unocore/unoobj.cxx24
-rw-r--r--sw/source/core/unocore/unoobj2.cxx200
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx316
-rw-r--r--sw/source/core/unocore/unoport.cxx9
-rw-r--r--sw/source/core/unocore/unoportenum.cxx246
-rw-r--r--sw/source/core/unocore/unoprnms.cxx3
-rw-r--r--sw/source/core/unocore/unosett.cxx3
-rw-r--r--sw/source/core/unocore/unotbl.cxx54
-rw-r--r--sw/source/core/unocore/unotext.cxx98
-rw-r--r--sw/source/core/view/viewsh.cxx18
-rw-r--r--sw/source/core/view/vprint.cxx18
-rw-r--r--sw/source/filter/html/htmlfly.cxx2
-rw-r--r--sw/source/filter/html/htmlgrin.cxx2
-rw-r--r--sw/source/filter/html/htmlplug.cxx12
-rw-r--r--sw/source/filter/html/swhtml.cxx18
-rw-r--r--sw/source/filter/inc/fltshell.hxx22
-rw-r--r--sw/source/filter/inc/msfilter.hxx4
-rw-r--r--sw/source/filter/inc/wrtswtbl.hxx15
-rw-r--r--sw/source/filter/rtf/rtfatr.cxx41
-rw-r--r--sw/source/filter/rtf/rtffly.cxx16
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx9
-rw-r--r--sw/source/filter/writer/writer.cxx6
-rw-r--r--sw/source/filter/ww1/fltshell.cxx71
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.cxx7
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx584
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3331
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx616
-rw-r--r--sw/source/filter/ww8/docxexport.cxx812
-rw-r--r--sw/source/filter/ww8/docxexport.hxx228
-rw-r--r--sw/source/filter/ww8/docxexportfilter.cxx190
-rw-r--r--sw/source/filter/ww8/docxexportfilter.hxx65
-rw-r--r--sw/source/filter/ww8/docxfootnotes.hxx103
-rw-r--r--sw/source/filter/ww8/dump/ww8scan.hxx7
-rw-r--r--sw/source/filter/ww8/escher.hxx6
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx34
-rw-r--r--sw/source/filter/ww8/writerhelper.hxx43
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx167
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx1783
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx408
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx1657
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx1218
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1000
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx85
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx3499
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx459
-rw-r--r--sw/source/filter/ww8/ww8glsy.cxx93
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par.cxx115
-rw-r--r--sw/source/filter/ww8/ww8par.hxx5
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx132
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx46
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx17
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx35
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx94
-rw-r--r--sw/source/filter/ww8/ww8struc.hxx27
-rw-r--r--sw/source/filter/xml/swxml.cxx60
-rw-r--r--sw/source/filter/xml/wrtxml.cxx36
-rw-r--r--sw/source/filter/xml/xmltbli.cxx121
-rw-r--r--sw/source/filter/xml/xmltbli.hxx11
-rw-r--r--sw/source/filter/xml/xmltexte.cxx6
-rw-r--r--sw/source/ui/app/apphdl.cxx20
-rw-r--r--sw/source/ui/app/appopt.cxx3
-rw-r--r--sw/source/ui/app/docsh.cxx59
-rw-r--r--sw/source/ui/app/docsh2.cxx27
-rw-r--r--sw/source/ui/app/mn.src12
-rw-r--r--sw/source/ui/app/swmodul1.cxx2
-rw-r--r--sw/source/ui/config/optdlg.src10
-rw-r--r--sw/source/ui/config/optload.cxx4
-rw-r--r--sw/source/ui/config/optpage.cxx80
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx231
-rw-r--r--sw/source/ui/dbui/mailmergehelper.cxx12
-rw-r--r--sw/source/ui/dbui/makefile.mk1
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.cxx67
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.cxx5
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx2
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx6
-rw-r--r--sw/source/ui/dochdl/swdtflvr.cxx25
-rw-r--r--sw/source/ui/docvw/edtwin.cxx6
-rw-r--r--sw/source/ui/docvw/edtwin2.cxx37
-rw-r--r--sw/source/ui/docvw/postit.cxx729
-rw-r--r--sw/source/ui/docvw/romenu.cxx42
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx44
-rw-r--r--sw/source/ui/fldui/flddinf.hxx2
-rw-r--r--sw/source/ui/fldui/fldmgr.cxx32
-rw-r--r--sw/source/ui/fldui/fldref.cxx6
-rw-r--r--sw/source/ui/frmdlg/column.cxx2
-rw-r--r--sw/source/ui/inc/column.hxx1
-rw-r--r--sw/source/ui/inc/convert.hxx4
-rw-r--r--sw/source/ui/inc/fldmgr.hxx2
-rw-r--r--sw/source/ui/inc/hidfunc.h1
-rw-r--r--sw/source/ui/inc/insrc.hxx85
-rw-r--r--sw/source/ui/inc/swdtflvr.hxx1
-rw-r--r--sw/source/ui/inc/table.hrc2
-rw-r--r--sw/source/ui/inc/uivwimp.hxx2
-rw-r--r--sw/source/ui/inc/wrtsh.hxx1
-rw-r--r--sw/source/ui/index/cnttab.src18
-rw-r--r--sw/source/ui/misc/glshell.cxx10
-rw-r--r--sw/source/ui/misc/pggrid.cxx2
-rw-r--r--sw/source/ui/ribbar/conrect.cxx8
-rwxr-xr-xsw/source/ui/shells/annotsh.cxx2
-rw-r--r--sw/source/ui/shells/basesh.cxx88
-rw-r--r--sw/source/ui/shells/beziersh.cxx2
-rw-r--r--sw/source/ui/shells/drawsh.cxx2
-rw-r--r--sw/source/ui/shells/drformsh.cxx4
-rw-r--r--sw/source/ui/shells/drwbassh.cxx14
-rw-r--r--sw/source/ui/shells/drwtxtsh.cxx12
-rw-r--r--sw/source/ui/shells/frmsh.cxx73
-rw-r--r--sw/source/ui/shells/grfsh.cxx32
-rw-r--r--sw/source/ui/shells/listsh.cxx2
-rw-r--r--sw/source/ui/shells/mediash.cxx10
-rw-r--r--sw/source/ui/shells/olesh.cxx8
-rw-r--r--sw/source/ui/shells/slotadd.cxx4
-rw-r--r--sw/source/ui/shells/tabsh.cxx35
-rw-r--r--sw/source/ui/shells/textsh.cxx18
-rw-r--r--sw/source/ui/table/colwd.src18
-rw-r--r--sw/source/ui/table/convert.cxx4
-rw-r--r--sw/source/ui/table/convert.src6
-rw-r--r--sw/source/ui/table/insrc.cxx94
-rw-r--r--sw/source/ui/table/insrc.hrc43
-rw-r--r--sw/source/ui/table/insrc.src155
-rw-r--r--sw/source/ui/table/makefile.mk2
-rw-r--r--sw/source/ui/uiview/pview.cxx27
-rw-r--r--sw/source/ui/uiview/srcview.cxx2
-rw-r--r--sw/source/ui/uiview/view.cxx1
-rw-r--r--sw/source/ui/uiview/view0.cxx4
-rw-r--r--sw/source/ui/uiview/view2.cxx6
-rw-r--r--sw/source/ui/uiview/viewdraw.cxx2
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx4
-rw-r--r--sw/source/ui/uno/unoatxt.cxx4
-rw-r--r--sw/source/ui/uno/unomod.cxx39
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx30
-rw-r--r--sw/source/ui/uno/unotxvw.cxx6
-rw-r--r--sw/source/ui/web/wdocsh.cxx2
-rw-r--r--sw/source/ui/web/wformsh.cxx2
-rw-r--r--sw/source/ui/web/wfrmsh.cxx2
-rw-r--r--sw/source/ui/web/wgrfsh.cxx3
-rw-r--r--sw/source/ui/web/wlistsh.cxx4
-rw-r--r--sw/source/ui/web/wolesh.cxx3
-rw-r--r--sw/source/ui/web/wtabsh.cxx2
-rw-r--r--sw/source/ui/web/wtextsh.cxx4
-rw-r--r--sw/source/ui/web/wview.cxx2
-rw-r--r--sw/source/ui/wrtsh/select.cxx12
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx15
277 files changed, 19016 insertions, 9874 deletions
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
index 6a9ff9738165..ece5bbb614c5 100644
--- a/sw/source/core/access/acchyperlink.cxx
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -101,8 +101,8 @@ sal_Bool SAL_CALL SwAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex )
const SwTxtINetFmt* pTxtAttr2 = rINetFmt.GetTxtINetFmt();
if( pTxtAttr2 )
{
- const_cast< SwTxtINetFmt* >( pTxtAttr2 )->SetVisited( sal_True );
- const_cast< SwTxtINetFmt* >( pTxtAttr2 )->SetValidVis( sal_True );
+ const_cast<SwTxtINetFmt*>(pTxtAttr2)->SetVisited(true);
+ const_cast<SwTxtINetFmt*>(pTxtAttr2)->SetVisitedValid(true);
}
bRet = sal_True;
}
diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx
index e89e74c9dbcf..4bb7c73362aa 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -42,6 +42,9 @@
#include <ndnotxt.hxx>
#include <flyfrm.hxx>
#include <cntfrm.hxx>
+// --> OD 2009-07-14 #i73249#
+#include <hints.hxx>
+// <--
#include "accnotextframe.hxx"
using namespace ::com::sun::star;
@@ -67,13 +70,25 @@ SwAccessibleNoTextFrame::SwAccessibleNoTextFrame(
sal_Int16 nInitRole,
const SwFlyFrm* pFlyFrm ) :
SwAccessibleFrameBase( pInitMap, nInitRole, pFlyFrm ),
- aDepend( this, const_cast < SwNoTxtNode * >( GetNoTxtNode() ) )
+ aDepend( this, const_cast < SwNoTxtNode * >( GetNoTxtNode() ) ),
+ msTitle(),
+ msDesc()
{
- const SwNoTxtNode *pNd = GetNoTxtNode();
+ const SwNoTxtNode* pNd = GetNoTxtNode();
+ // --> OD 2009-07-14 #i73249#
+ // consider new attributes Title and Description
if( pNd )
- sDesc = OUString( pNd->GetAlternateText() );
- if( !sDesc.getLength() )
- sDesc = GetName();
+ {
+ msTitle = pNd->GetTitle();
+
+ msDesc = pNd->GetDescription();
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+ }
+ // <--
}
SwAccessibleNoTextFrame::~SwAccessibleNoTextFrame()
@@ -82,36 +97,70 @@ SwAccessibleNoTextFrame::~SwAccessibleNoTextFrame()
void SwAccessibleNoTextFrame::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
{
- SwAccessibleFrameBase::Modify( pOld, pNew );
+ const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+ // --> OD 2009-07-14 #i73249#
+ // suppress handling of RES_NAME_CHANGED in case that attribute Title is
+ // used as the accessible name.
+ if ( nWhich != RES_NAME_CHANGED ||
+ msTitle.getLength() == 0 )
+ {
+ SwAccessibleFrameBase::Modify( pOld, pNew );
+ }
- sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
const SwNoTxtNode *pNd = GetNoTxtNode();
ASSERT( pNd == aDepend.GetRegisteredIn(), "invalid frame" );
switch( nWhich )
{
- case RES_NAME_CHANGED:
- if( pNd->GetAlternateText().Len() )
- break;
- case RES_ALT_TEXT_CHANGED:
- if( pNd && GetFrm() )
+ // --> OD 2009-07-14 #i73249#
+ case RES_TITLE_CHANGED:
{
- OUString sOldDesc( sDesc );
-
- const String& rDesc = pNd->GetAlternateText();
- sDesc = rDesc;
- if( !sDesc.getLength() )
- sDesc = GetName();
-
- if( sDesc != sOldDesc )
+ const String& sOldTitle(
+ dynamic_cast<SwStringMsgPoolItem*>(pOld)->GetString() );
+ const String& sNewTitle(
+ dynamic_cast<SwStringMsgPoolItem*>(pNew)->GetString() );
+ if ( sOldTitle == sNewTitle )
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
- aEvent.OldValue <<= sOldDesc;
- aEvent.NewValue <<= sDesc;
- FireAccessibleEvent( aEvent );
+ break;
+ }
+ msTitle = sNewTitle;
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ aEvent.OldValue <<= OUString( sOldTitle );
+ aEvent.NewValue <<= msTitle;
+ FireAccessibleEvent( aEvent );
+
+ if ( pNd->GetDescription().Len() != 0 )
+ {
+ break;
+ }
+ }
+ // intentional no break here
+ case RES_DESCRIPTION_CHANGED:
+ {
+ if ( pNd && GetFrm() )
+ {
+ const OUString sOldDesc( msDesc );
+
+ const String& rDesc = pNd->GetDescription();
+ msDesc = rDesc;
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+
+ if ( msDesc != sOldDesc )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
+ aEvent.OldValue <<= sOldDesc;
+ aEvent.NewValue <<= msDesc;
+ FireAccessibleEvent( aEvent );
+ }
}
}
break;
+ // <--
/*
case RES_OBJECTDYING:
if( aDepend.GetRegisteredIn() ==
@@ -138,6 +187,23 @@ void SwAccessibleNoTextFrame::Dispose( sal_Bool bRecursive )
SwAccessibleFrameBase::Dispose( bRecursive );
}
+// --> OD 2009-07-14 #i73249#
+OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleName (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ if ( msTitle.getLength() != 0 )
+ {
+ return msTitle;
+ }
+
+ return SwAccessibleFrameBase::getAccessibleName();
+}
+// <--
+
OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleDescription (void)
throw (uno::RuntimeException)
{
@@ -145,7 +211,7 @@ OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleDescription (void)
CHECK_FOR_DEFUNC( XAccessibleContext )
- return sDesc;
+ return msDesc;
}
diff --git a/sw/source/core/access/accnotextframe.hxx b/sw/source/core/access/accnotextframe.hxx
index 25e4b402c4b2..d96c510266ae 100644
--- a/sw/source/core/access/accnotextframe.hxx
+++ b/sw/source/core/access/accnotextframe.hxx
@@ -39,7 +39,10 @@ class SwAccessibleNoTextFrame : public SwAccessibleFrameBase,
public ::com::sun::star::accessibility::XAccessibleImage
{
SwDepend aDepend;
- ::rtl::OUString sDesc;
+ // --> OD 2009-07-14 #i73249#
+ ::rtl::OUString msTitle;
+ // <--
+ ::rtl::OUString msDesc;
protected:
@@ -57,6 +60,13 @@ public:
//===== XAccessibleContext ==============================================
+ // --> OD 2009-07-14 #i73249#
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // <--
+
/// Return this object's description.
virtual ::rtl::OUString SAL_CALL
getAccessibleDescription (void)
diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx
index 2ac42327a73e..d91a9ef514f1 100644
--- a/sw/source/core/access/acctextframe.cxx
+++ b/sw/source/core/access/acctextframe.cxx
@@ -46,6 +46,9 @@
#include <flyfrm.hxx>
#include <accmap.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
+// --> OD 2009-07-14 #i73249#
+#include <hints.hxx>
+// <--
#include "acctextframe.hxx"
using namespace ::com::sun::star;
@@ -61,8 +64,23 @@ const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleTex
SwAccessibleTextFrame::SwAccessibleTextFrame(
SwAccessibleMap* pInitMap,
const SwFlyFrm* pFlyFrm ) :
- SwAccessibleFrameBase( pInitMap, AccessibleRole::TEXT_FRAME, pFlyFrm )
+ SwAccessibleFrameBase( pInitMap, AccessibleRole::TEXT_FRAME, pFlyFrm ),
+ msTitle(),
+ msDesc()
{
+ if ( pFlyFrm )
+ {
+ const SwFlyFrmFmt* pFlyFrmFmt =
+ dynamic_cast<const SwFlyFrmFmt*>( pFlyFrm->GetFmt() );
+ msTitle = pFlyFrmFmt->GetObjTitle();
+
+ msDesc = pFlyFrmFmt->GetObjDescription();
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+ }
}
SwAccessibleTextFrame::~SwAccessibleTextFrame()
@@ -71,32 +89,92 @@ SwAccessibleTextFrame::~SwAccessibleTextFrame()
void SwAccessibleTextFrame::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
{
- sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+ const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+ // --> OD 2009-07-14 #i73249#
+ // suppress handling of RES_NAME_CHANGED in case that attribute Title is
+ // used as the accessible name.
+ if ( nWhich != RES_NAME_CHANGED ||
+ msTitle.getLength() == 0 )
+ {
+ SwAccessibleFrameBase::Modify( pOld, pNew );
+ }
+
const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( GetFrm() );
switch( nWhich )
{
- case RES_NAME_CHANGED:
- if( pFlyFrm )
+ // --> OD 2009-07-14 #i73249#
+ case RES_TITLE_CHANGED:
{
- OUString sOldDesc( GetName() );
- SwAccessibleFrameBase::Modify( pOld, pNew );
-
- if( sOldDesc != GetName() )
+ const String& sOldTitle(
+ dynamic_cast<SwStringMsgPoolItem*>(pOld)->GetString() );
+ const String& sNewTitle(
+ dynamic_cast<SwStringMsgPoolItem*>(pNew)->GetString() );
+ if ( sOldTitle == sNewTitle )
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
- aEvent.OldValue <<= sOldDesc;
- aEvent.NewValue <<= GetName();
- FireAccessibleEvent( aEvent );
+ break;
+ }
+ msTitle = sNewTitle;
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ aEvent.OldValue <<= OUString( sOldTitle );
+ aEvent.NewValue <<= msTitle;
+ FireAccessibleEvent( aEvent );
+
+ const SwFlyFrmFmt* pFlyFrmFmt =
+ dynamic_cast<const SwFlyFrmFmt*>( pFlyFrm->GetFmt() );
+ if ( pFlyFrmFmt->GetObjDescription().Len() != 0 )
+ {
+ break;
+ }
+ }
+ // intentional no break here
+ case RES_DESCRIPTION_CHANGED:
+ {
+ if ( pFlyFrm )
+ {
+ const OUString sOldDesc( msDesc );
+
+ const SwFlyFrmFmt* pFlyFrmFmt =
+ dynamic_cast<const SwFlyFrmFmt*>( pFlyFrm->GetFmt() );
+ const String& rDesc = pFlyFrmFmt->GetObjDescription();
+ msDesc = rDesc;
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+
+ if ( msDesc != sOldDesc )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
+ aEvent.OldValue <<= sOldDesc;
+ aEvent.NewValue <<= msDesc;
+ FireAccessibleEvent( aEvent );
+ }
}
}
break;
- default:
- SwAccessibleFrameBase::Modify( pOld, pNew );
- break;
+ // <--
}
}
+// --> OD 2009-07-14 #i73249#
+OUString SAL_CALL SwAccessibleTextFrame::getAccessibleName (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ if ( msTitle.getLength() != 0 )
+ {
+ return msTitle;
+ }
+
+ return SwAccessibleFrameBase::getAccessibleName();
+}
+// <--
OUString SAL_CALL SwAccessibleTextFrame::getAccessibleDescription (void)
throw (uno::RuntimeException)
{
@@ -104,7 +182,7 @@ OUString SAL_CALL SwAccessibleTextFrame::getAccessibleDescription (void)
CHECK_FOR_DEFUNC( XAccessibleContext )
- return GetName();
+ return msDesc;
}
diff --git a/sw/source/core/access/acctextframe.hxx b/sw/source/core/access/acctextframe.hxx
index 8fed22488b9b..f306b25f2478 100644
--- a/sw/source/core/access/acctextframe.hxx
+++ b/sw/source/core/access/acctextframe.hxx
@@ -39,6 +39,11 @@ namespace com { namespace star {
class SwAccessibleTextFrame : public SwAccessibleFrameBase
{
+private:
+ // --> OD 2009-07-14 #i73249#
+ ::rtl::OUString msTitle;
+ ::rtl::OUString msDesc;
+ // <--
protected:
@@ -53,6 +58,12 @@ public:
//===== XAccessibleContext ==============================================
+ // --> OD 2009-07-14 #i73249#
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // <--
/// Return this object's description.
virtual ::rtl::OUString SAL_CALL
getAccessibleDescription (void)
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index fb3c2ff37c13..5827fb55c29e 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -386,8 +386,10 @@ SwClient *SwModify::_Remove(SwClient * pDepend)
void SwModify::CheckCaching( const USHORT nWhich )
{
- if( RES_CHRATR_BEGIN <= nWhich && RES_CHRATR_END > nWhich )
+ if (isCHRATR(nWhich))
+ {
SetInSwFntCache( FALSE );
+ }
else
switch ( nWhich )
{
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index f463c818c604..1dd1616df3b7 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -32,6 +32,7 @@
#include "precompiled_sw.hxx"
#include "breakit.hxx"
+#include <unicode/uchar.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
@@ -119,6 +120,18 @@ USHORT SwBreakIt::GetRealScriptOfText( const String& rTxt,
--nPos;
nScript = xBreak->getScriptType( rTxt, nPos );
sal_Int32 nChgPos = 0;
+ if ( i18n::ScriptType::WEAK == nScript && nPos + 1 < rTxt.Len() )
+ {
+ // A weak character followed by a mark may be meant to combine with
+ // the mark, so prefer the following character's script
+ switch ( u_charType(rTxt.GetChar(nPos + 1) ) ) {
+ case U_NON_SPACING_MARK:
+ case U_ENCLOSING_MARK:
+ case U_COMBINING_SPACING_MARK:
+ nScript = xBreak->getScriptType( rTxt, nPos+1 );
+ break;
+ }
+ }
if( i18n::ScriptType::WEAK == nScript && nPos &&
0 < (nChgPos = xBreak->beginOfScript( rTxt, nPos, nScript )) )
nScript = xBreak->getScriptType( rTxt, nChgPos-1 );
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 56c02a51c330..2a84c2ef18e3 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -302,7 +302,7 @@ SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
pArr->pFirst = pArr->pLast = this;
nIndex = nIdx;
}
- else if( nIdx > ((pArr->pLast->nIndex - pArr->pFirst->nIndex) / 2) )
+ else if( pArr->pLast && (nIdx > ((pArr->pLast->nIndex - pArr->pFirst->nIndex) / 2)) )
ChgValue( *pArr->pLast, nIdx );
else
ChgValue( *pArr->pFirst, nIdx );
diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx
index 38b502caee75..d148027f13d3 100644
--- a/sw/source/core/crsr/crossrefbookmark.cxx
+++ b/sw/source/core/crsr/crossrefbookmark.cxx
@@ -75,11 +75,6 @@ namespace sw { namespace mark
return *static_cast<SwPosition*>(NULL);
}
- bool CrossRefBookmark::IsLegalName(const ::rtl::OUString& rName)
- {
- return CrossRefNumItemBookmark::IsLegalName(rName) || CrossRefHeadingBookmark::IsLegalName(rName);
- }
-
CrossRefHeadingBookmark::CrossRefHeadingBookmark(const SwPaM& rPaM,
const KeyCode& rCode,
const OUString& rName,
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 3b291f059784..3637cc19354d 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -59,9 +59,7 @@
#include <callnk.hxx>
#include <viscrs.hxx>
#include <section.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <scriptinfo.hxx>
#include <globdoc.hxx>
#include <pamtyp.hxx>
@@ -173,7 +171,7 @@ BOOL SwCrsrShell::DestroyCrsr()
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
SwCursor* pNextCrsr = (SwCursor*)pCurCrsr->GetNext();
delete pCurCrsr;
- pCurCrsr = (SwShellCrsr*)*pNextCrsr;
+ pCurCrsr = dynamic_cast<SwShellCrsr*>(pNextCrsr);
UpdateCrsr();
return TRUE;
}
@@ -201,9 +199,8 @@ SwPaM* SwCrsrShell::GetCrsr( BOOL bMakeTblCrsr ) const
if( pTblCrsr->IsChgd() )
{
- SwCrsrShell* pThis = (SwCrsrShell*)this;
- pThis->pCurCrsr = (SwShellCrsr*)
- *pTblCrsr->MakeBoxSels( pThis->pCurCrsr );
+ const_cast<SwCrsrShell*>(this)->pCurCrsr =
+ dynamic_cast<SwShellCrsr*>(pTblCrsr->MakeBoxSels( pCurCrsr ));
}
}
return pCurCrsr;
@@ -539,7 +536,7 @@ BOOL SwCrsrShell::SttEndDoc( BOOL bStt )
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
- SwShellCrsr* pTmpCrsr = pBlockCrsr ? pBlockCrsr->getShellCrsr() : pCurCrsr;
+ SwShellCrsr* pTmpCrsr = pBlockCrsr ? &pBlockCrsr->getShellCrsr() : pCurCrsr;
BOOL bRet = pTmpCrsr->SttEndDoc( bStt );
if( bRet )
{
@@ -920,7 +917,8 @@ BOOL SwCrsrShell::ChgCurrPam( const Point & rPt,
UpdateCrsr(); // Cursor steht schon richtig
return TRUE;
}
- } while( pCurCrsr != ( pCmp = (SwShellCrsr*)*((SwCursor*)pCmp->GetNext()) ) );
+ } while( pCurCrsr !=
+ ( pCmp = dynamic_cast<SwShellCrsr*>(pCmp->GetNext()) ) );
return FALSE;
}
@@ -1124,7 +1122,7 @@ BOOL SwCrsrShell::GoNextCrsr()
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
- pCurCrsr = (SwShellCrsr*)*((SwCursor*)pCurCrsr->GetNext());
+ pCurCrsr = dynamic_cast<SwShellCrsr*>(pCurCrsr->GetNext());
// Bug 24086: auch alle anderen anzeigen
if( !ActionPend() )
@@ -1146,7 +1144,7 @@ BOOL SwCrsrShell::GoPrevCrsr()
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
- pCurCrsr = (SwShellCrsr*)*((SwCursor*)pCurCrsr->GetPrev());
+ pCurCrsr = dynamic_cast<SwShellCrsr*>(pCurCrsr->GetPrev());
// Bug 24086: auch alle anderen anzeigen
if( !ActionPend() )
@@ -1957,7 +1955,9 @@ BOOL SwCrsrShell::Pop( BOOL bOldCrsr )
// der Nachfolger wird der Aktuelle
if( pCrsrStk->GetNext() != pCrsrStk )
- pTmp = (SwShellCrsr*)*((SwCursor*)pCrsrStk->GetNext());
+ {
+ pTmp = dynamic_cast<SwShellCrsr*>(pCrsrStk->GetNext());
+ }
if( bOldCrsr ) // loesche vom Stack
delete pCrsrStk; //
@@ -2029,7 +2029,9 @@ void SwCrsrShell::Combine()
SwShellCrsr * pTmp = 0;
if( pCrsrStk->GetNext() != pCrsrStk )
- pTmp = (SwShellCrsr*)*((SwCursor*)pCrsrStk->GetNext());
+ {
+ pTmp = dynamic_cast<SwShellCrsr*>(pCrsrStk->GetNext());
+ }
delete pCrsrStk;
pCrsrStk = pTmp;
if( !pCurCrsr->IsInProtectTable( TRUE ) &&
@@ -2567,22 +2569,6 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx )
* Alle Ansichten eines Dokumentes stehen im Ring der Shells.
*/
-SwOverlayType impGetOverlayType(OutputDevice* pOut)
-{
- if(!pOut)
- {
- pOut = Application::GetDefaultDevice();
- }
-
- if(pOut->GetSettings().GetStyleSettings().GetHighContrastMode()
- || !pOut->supportsOperation( OutDevSupport_TransparentRect ))
- {
- return SW_OVERLAY_INVERT;
- }
-
- return SW_OVERLAY_TRANSPARENT;
-}
-
SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
: ViewShell( rShell, pInitWin ),
SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
@@ -2590,9 +2576,8 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
eMvState( MV_NONE ),
// --> OD 2008-04-02 #refactorlists#
sMarkedListId(),
- nMarkedListLevel( 0 ),
+ nMarkedListLevel( 0 )
// <--
- maSwOverlayType(SW_OVERLAY_INVERT)
{
SET_CURR_SHELL( this );
// Nur die Position vom aktuellen Cursor aus der Copy-Shell uebernehmen
@@ -2608,9 +2593,6 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
// UpdateCrsr( 0 );
// OD 11.02.2003 #100556#
mbMacroExecAllowed = rShell.IsMacroExecAllowed();
-
- // #i88893# init cursor selection type
- maSwOverlayType = impGetOverlayType(pInitWin);
}
@@ -2626,9 +2608,8 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin,
eMvState( MV_NONE ), // state for crsr-travelling - GetCrsrOfst
// --> OD 2008-04-02 #refactorlists#
sMarkedListId(),
- nMarkedListLevel( 0 ),
+ nMarkedListLevel( 0 )
// <--
- maSwOverlayType(SW_OVERLAY_INVERT)
{
SET_CURR_SHELL( this );
/*
@@ -2656,9 +2637,6 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin,
// UpdateCrsr( 0 );
// OD 11.02.2003 #100556#
mbMacroExecAllowed = true;
-
- // #i88893# init cursor selection type
- maSwOverlayType = impGetOverlayType(pInitWin);
}
@@ -3041,16 +3019,6 @@ BOOL SwCrsrShell::HasReadonlySel() const
return bRet;
}
-// SwCursor - Methode !!!!
-BOOL SwCursor::IsReadOnlyAvailable() const
-{
- const SwShellCrsr* pShCrsr = *this;
- const SwUnoCrsr* pUnoCrsr = *this;
- return pShCrsr ? pShCrsr->GetShell()->IsReadOnlyAvailable() :
- pUnoCrsr ? TRUE : FALSE;
-}
-
-
BOOL SwCrsrShell::IsSelFullPara() const
{
BOOL bRet = FALSE;
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index 61aa9f95ffd7..4a98c1ce558e 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -888,7 +888,7 @@ BOOL SwPaM::Find( const SfxPoolItem& rAttr, BOOL bValue, SwMoveFn fnMove,
{
// stelle fest welches Attribut gesucht wird:
USHORT nWhich = rAttr.Which();
- int bCharAttr = RES_CHRATR_BEGIN <= nWhich && nWhich < RES_TXTATR_END;
+ int bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich);
SwPaM* pPam = MakeRegion( fnMove, pRegion );
@@ -931,7 +931,7 @@ BOOL SwPaM::Find( const SfxPoolItem& rAttr, BOOL bValue, SwMoveFn fnMove,
bFound = TRUE;
break;
}
- else if( RES_TXTATR_BEGIN < nWhich ) // TextAttribut
+ else if (isTXTATR(nWhich))
continue; // --> also weiter
}
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 90680b7a1d22..89686a3673bc 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -623,7 +623,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
p->MoveTo( (Ring*)pRegion );
} while( p != pPrev );
}
- rSttCntIdx = nSttCnt;
+ pCrsr->Start()->nContent = nSttCnt;
return FIND_NO_RING;
}
return bFnd ? FIND_FOUND : FIND_NOT_FOUND;
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 8563610af3d2..9a211a61a70e 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -74,24 +74,29 @@ inline xub_StrLen GetSttOrEnd( BOOL bCondition, const SwCntntNode& rNd )
*************************************************************************/
-SwPosition::SwPosition( const SwNodeIndex &rNode, const SwIndex &rCntnt )
- : nNode( rNode ),nContent( rCntnt )
+SwPosition::SwPosition( const SwNodeIndex & rNodeIndex, const SwIndex & rCntnt )
+ : nNode( rNodeIndex ), nContent( rCntnt )
{
}
-SwPosition::SwPosition( const SwNodeIndex &rNode )
- : nNode( rNode ), nContent( 0 )
+SwPosition::SwPosition( const SwNodeIndex & rNodeIndex )
+ : nNode( rNodeIndex ), nContent( nNode.GetNode().GetCntntNode() )
{
}
SwPosition::SwPosition( const SwNode& rNode )
- : nNode( rNode ), nContent( 0 )
+ : nNode( rNode ), nContent( nNode.GetNode().GetCntntNode() )
{
}
+SwPosition::SwPosition( SwCntntNode & rNode, const xub_StrLen nOffset )
+ : nNode( rNode ), nContent( &rNode, nOffset )
+{
+}
-SwPosition::SwPosition(const SwPosition &rPos)
- : nNode(rPos.nNode),nContent(rPos.nContent)
+
+SwPosition::SwPosition( const SwPosition & rPos )
+ : nNode( rPos.nNode ), nContent( rPos.nContent )
{
}
@@ -380,129 +385,170 @@ SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, BOOL bChk )
*************************************************************************/
SwPaM::SwPaM( const SwPosition& rPos, SwPaM* pRing )
- : Ring( pRing ), aBound1( rPos ), aBound2( rPos ), bIsInFrontOfLabel(FALSE)
+ : Ring( pRing )
+ , m_Bound1( rPos )
+ , m_Bound2( rPos.nNode.GetNode().GetNodes() ) // default initialize
+ , m_pPoint( &m_Bound1 )
+ , m_pMark( m_pPoint )
+ , m_bIsInFrontOfLabel( false )
{
- pPoint = pMark = &aBound1;
}
-SwPaM::SwPaM( const SwPosition& rMk, const SwPosition& rPt, SwPaM* pRing )
- : Ring( pRing ), aBound1( rMk ), aBound2( rPt ), bIsInFrontOfLabel(FALSE)
+SwPaM::SwPaM( const SwPosition& rMark, const SwPosition& rPoint, SwPaM* pRing )
+ : Ring( pRing )
+ , m_Bound1( rMark )
+ , m_Bound2( rPoint )
+ , m_pPoint( &m_Bound2 )
+ , m_pMark( &m_Bound1 )
+ , m_bIsInFrontOfLabel( false )
{
- pMark = &aBound1;
- pPoint = &aBound2;
}
-SwPaM::SwPaM( const SwNodeIndex& rMk, const SwNodeIndex& rPt,
- long nMkOffset, long nPtOffset, SwPaM* pRing )
- : Ring( pRing ), aBound1( rMk ), aBound2( rPt ), bIsInFrontOfLabel(FALSE)
+SwPaM::SwPaM( const SwNodeIndex& rMark, const SwNodeIndex& rPoint,
+ long nMarkOffset, long nPointOffset, SwPaM* pRing )
+ : Ring( pRing )
+ , m_Bound1( rMark )
+ , m_Bound2( rPoint )
+ , m_pPoint( &m_Bound2 )
+ , m_pMark( &m_Bound1 )
+ , m_bIsInFrontOfLabel( false )
{
- if( nMkOffset )
- aBound1.nNode += nMkOffset;
- if( nPtOffset )
- aBound2.nNode += nPtOffset;
-
- aBound1.nContent.Assign( aBound1.nNode.GetNode().GetCntntNode(), 0 );
- aBound2.nContent.Assign( aBound2.nNode.GetNode().GetCntntNode(), 0 );
- pMark = &aBound1;
- pPoint = &aBound2;
+ if ( nMarkOffset )
+ {
+ m_pMark->nNode += nMarkOffset;
+ }
+ if ( nPointOffset )
+ {
+ m_pPoint->nNode += nPointOffset;
+ }
+
+ m_Bound1.nContent.Assign( m_Bound1.nNode.GetNode().GetCntntNode(), 0 );
+ m_Bound2.nContent.Assign( m_Bound2.nNode.GetNode().GetCntntNode(), 0 );
}
-SwPaM::SwPaM( const SwNode& rMk, const SwNode& rPt,
- long nMkOffset, long nPtOffset, SwPaM* pRing )
- : Ring( pRing ), aBound1( rMk ), aBound2( rPt ), bIsInFrontOfLabel(FALSE)
+SwPaM::SwPaM( const SwNode& rMark, const SwNode& rPoint,
+ long nMarkOffset, long nPointOffset, SwPaM* pRing )
+ : Ring( pRing )
+ , m_Bound1( rMark )
+ , m_Bound2( rPoint )
+ , m_pPoint( &m_Bound2 )
+ , m_pMark( &m_Bound1 )
+ , m_bIsInFrontOfLabel( false )
{
- if( nMkOffset )
- aBound1.nNode += nMkOffset;
- if( nPtOffset )
- aBound2.nNode += nPtOffset;
-
- aBound1.nContent.Assign( aBound1.nNode.GetNode().GetCntntNode(), 0 );
- aBound2.nContent.Assign( aBound2.nNode.GetNode().GetCntntNode(), 0 );
- pMark = &aBound1;
- pPoint = &aBound2;
+ if ( nMarkOffset )
+ {
+ m_pMark->nNode += nMarkOffset;
+ }
+ if ( nPointOffset )
+ {
+ m_pPoint->nNode += nPointOffset;
+ }
+
+ m_Bound1.nContent.Assign( m_Bound1.nNode.GetNode().GetCntntNode(), 0 );
+ m_Bound2.nContent.Assign( m_Bound2.nNode.GetNode().GetCntntNode(), 0 );
}
-SwPaM::SwPaM( const SwNodeIndex& rMk, xub_StrLen nMkCntnt,
- const SwNodeIndex& rPt, xub_StrLen nPtCntnt, SwPaM* pRing )
- : Ring( pRing ), aBound1( rMk ), aBound2( rPt ), bIsInFrontOfLabel(FALSE)
+SwPaM::SwPaM( const SwNodeIndex& rMark , xub_StrLen nMarkCntnt,
+ const SwNodeIndex& rPoint, xub_StrLen nPointCntnt, SwPaM* pRing )
+ : Ring( pRing )
+ , m_Bound1( rMark )
+ , m_Bound2( rPoint )
+ , m_pPoint( &m_Bound2 )
+ , m_pMark( &m_Bound1 )
+ , m_bIsInFrontOfLabel( false )
{
- aBound1.nContent.Assign( rMk.GetNode().GetCntntNode(), nMkCntnt );
- aBound2.nContent.Assign( rPt.GetNode().GetCntntNode(), nPtCntnt );
- pMark = &aBound1;
- pPoint = &aBound2;
+ m_pPoint->nContent.Assign( rPoint.GetNode().GetCntntNode(), nPointCntnt);
+ m_pMark ->nContent.Assign( rMark .GetNode().GetCntntNode(), nMarkCntnt );
}
-SwPaM::SwPaM( const SwNode& rMk, xub_StrLen nMkCntnt,
- const SwNode& rPt, xub_StrLen nPtCntnt, SwPaM* pRing )
- : Ring( pRing ), aBound1( rMk ), aBound2( rPt ), bIsInFrontOfLabel(FALSE)
+SwPaM::SwPaM( const SwNode& rMark , xub_StrLen nMarkCntnt,
+ const SwNode& rPoint, xub_StrLen nPointCntnt, SwPaM* pRing )
+ : Ring( pRing )
+ , m_Bound1( rMark )
+ , m_Bound2( rPoint )
+ , m_pPoint( &m_Bound2 )
+ , m_pMark( &m_Bound1 )
+ , m_bIsInFrontOfLabel( false )
{
- aBound1.nContent.Assign( aBound1.nNode.GetNode().GetCntntNode(), nMkCntnt );
- aBound2.nContent.Assign( aBound2.nNode.GetNode().GetCntntNode(), nPtCntnt );
- pMark = &aBound1;
- pPoint = &aBound2;
+ m_pPoint->nContent.Assign( m_pPoint->nNode.GetNode().GetCntntNode(),
+ nPointCntnt);
+ m_pMark ->nContent.Assign( m_pMark ->nNode.GetNode().GetCntntNode(),
+ nMarkCntnt );
}
-SwPaM::SwPaM( const SwNode& rNd, xub_StrLen nCntnt, SwPaM* pRing )
- : Ring( pRing ), aBound1( rNd ), aBound2( rNd ), bIsInFrontOfLabel(FALSE)
+SwPaM::SwPaM( const SwNode& rNode, xub_StrLen nCntnt, SwPaM* pRing )
+ : Ring( pRing )
+ , m_Bound1( rNode )
+ , m_Bound2( m_Bound1.nNode.GetNode().GetNodes() ) // default initialize
+ , m_pPoint( &m_Bound1 )
+ , m_pMark( &m_Bound1 )
+ , m_bIsInFrontOfLabel( false )
{
- aBound1.nContent.Assign( aBound1.nNode.GetNode().GetCntntNode(), nCntnt );
- aBound2.nContent = aBound1.nContent;
- pPoint = pMark = &aBound1;
+ m_pPoint->nContent.Assign( m_pPoint->nNode.GetNode().GetCntntNode(),
+ nCntnt );
}
-SwPaM::SwPaM( const SwNodeIndex& rNd, xub_StrLen nCntnt, SwPaM* pRing )
- : Ring( pRing ), aBound1( rNd ), aBound2( rNd ), bIsInFrontOfLabel(FALSE)
+SwPaM::SwPaM( const SwNodeIndex& rNodeIdx, xub_StrLen nCntnt, SwPaM* pRing )
+ : Ring( pRing )
+ , m_Bound1( rNodeIdx )
+ , m_Bound2( rNodeIdx.GetNode().GetNodes() ) // default initialize
+ , m_pPoint( &m_Bound1 )
+ , m_pMark( &m_Bound1 )
+ , m_bIsInFrontOfLabel( false )
{
- aBound1.nContent.Assign( rNd.GetNode().GetCntntNode(), nCntnt );
- aBound2.nContent = aBound1.nContent;
- pPoint = pMark = &aBound1;
+ m_pPoint->nContent.Assign( rNodeIdx.GetNode().GetCntntNode(), nCntnt );
}
SwPaM::~SwPaM() {}
// @@@ semantic: no copy ctor.
SwPaM::SwPaM( SwPaM &rPam )
- : Ring( &rPam ),
- aBound1( *(rPam.pPoint) ),
- aBound2( *(rPam.pMark) ),
- bIsInFrontOfLabel(FALSE)
+ : Ring( &rPam )
+ , m_Bound1( *(rPam.m_pPoint) )
+ , m_Bound2( *(rPam.m_pMark) )
+ , m_pPoint( &m_Bound1 ), m_pMark( rPam.HasMark() ? &m_Bound2 : m_pPoint )
+ , m_bIsInFrontOfLabel( false )
{
- pPoint = &aBound1;
- pMark = rPam.HasMark() ? &aBound2 : pPoint;
}
// @@@ semantic: no copy assignment for super class Ring.
SwPaM &SwPaM::operator=( const SwPaM &rPam )
{
- *pPoint = *( rPam.pPoint );
- if( rPam.HasMark() )
+ *m_pPoint = *( rPam.m_pPoint );
+ if ( rPam.HasMark() )
{
SetMark();
- *pMark = *( rPam.pMark );
+ *m_pMark = *( rPam.m_pMark );
}
else
+ {
DeleteMark();
+ }
return *this;
}
void SwPaM::SetMark()
{
- if(pPoint == &aBound1)
- pMark = &aBound2;
+ if (m_pPoint == &m_Bound1)
+ {
+ m_pMark = &m_Bound2;
+ }
else
- pMark = &aBound1;
- (*pMark) = (*pPoint);
+ {
+ m_pMark = &m_Bound1;
+ }
+ (*m_pMark) = (*m_pPoint);
}
#ifdef DBG_UTIL
void SwPaM::Exchange()
{
- if(pPoint != pMark)
+ if (m_pPoint != m_pMark)
{
- SwPosition *pTmp = pPoint;
- pPoint = pMark;
- pMark = pTmp;
+ SwPosition *pTmp = m_pPoint;
+ m_pPoint = m_pMark;
+ m_pMark = pTmp;
}
}
#endif
@@ -514,7 +560,7 @@ BOOL SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo )
{
BOOL bRet = (*fnGo)( *this, fnMove );
- bIsInFrontOfLabel = FALSE;
+ m_bIsInFrontOfLabel = false;
return bRet;
}
@@ -545,7 +591,7 @@ SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg )
SwPaM* pPam;
if( pOrigRg == 0 )
{
- pPam = new SwPaM( *pPoint );
+ pPam = new SwPaM( *m_pPoint );
pPam->SetMark(); // setze Anfang fest
pPam->Move( fnMove, fnGoSection); // an Anfang / Ende vom Node
@@ -567,9 +613,11 @@ SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg )
SwPaM & SwPaM::Normalize(BOOL bPointFirst)
{
if (HasMark())
- if ((bPointFirst && *pPoint > *pMark) ||
- (! bPointFirst && *pPoint < *pMark))
+ if ( ( bPointFirst && *m_pPoint > *m_pMark) ||
+ (!bPointFirst && *m_pPoint < *m_pMark) )
+ {
Exchange();
+ }
return *this;
}
@@ -581,7 +629,7 @@ USHORT SwPaM::GetPageNum( BOOL bAtPoint, const Point* pLayPos )
const SwCntntFrm* pCFrm;
const SwPageFrm *pPg;
const SwCntntNode *pNd ;
- const SwPosition* pPos = bAtPoint ? pPoint : pMark;
+ const SwPosition* pPos = bAtPoint ? m_pPoint : m_pMark;
if( 0 != ( pNd = pPos->nNode.GetNode().GetCntntNode() ) &&
0 != ( pCFrm = pNd->GetFrm( pLayPos, pPos, FALSE )) &&
@@ -803,13 +851,22 @@ SwCntntNode* GetNode( SwPaM & rPam, BOOL& rbFirst, SwMoveFn fnMove,
{
rbFirst = FALSE;
pNd = rPam.GetCntntNode();
- if( pNd &&
- ( 0 == ( pFrm = pNd->GetFrm()) ||
- ( !bInReadOnly && pFrm->IsProtected() ) ||
- (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()) ) ||
- ( !bInReadOnly && pNd->FindSectionNode() &&
- pNd->FindSectionNode()->GetSection().IsProtect() ))
- pNd = 0;
+ if( pNd )
+ {
+ if(
+ (
+ 0 == ( pFrm = pNd->GetFrm()) ||
+ ( !bInReadOnly && pFrm->IsProtected() ) ||
+ (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow())
+ ) ||
+ ( !bInReadOnly && pNd->FindSectionNode() &&
+ pNd->FindSectionNode()->GetSection().IsProtect()
+ )
+ )
+ {
+ pNd = 0;
+ }
+ }
}
if( !pNd ) // steht Cursor auf keinem ContentNode ?
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 197bc62c08ba..b7a336b5929c 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -35,13 +35,8 @@
#include <hintids.hxx>
#include <svx/protitem.hxx>
-#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HDL
#include <com/sun/star/i18n/WordType.hdl>
-#endif
-#ifndef _COM_SUN_STAR_I18N_CHARTYPE_HDL
#include <com/sun/star/i18n/CharType.hdl>
-#endif
-
#include <unotools/charclass.hxx>
#include <svtools/ctloptions.hxx>
@@ -60,9 +55,7 @@
#include <txtfrm.hxx>
#include <scriptinfo.hxx>
#include <crstate.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <frmatr.hxx>
#include <breakit.hxx>
#include <crsskip.hxx>
@@ -73,8 +66,10 @@
#endif
#include <redline.hxx> // SwRedline
+
using namespace ::com::sun::star::i18n;
+
static const USHORT coSrchRplcThreshold = 60000;
struct _PercentHdl
@@ -162,11 +157,20 @@ SwCursor* SwCursor::Create( SwPaM* pRing ) const
return new SwCursor( *GetPoint(), pRing, false );
}
-SwCursor::operator SwTableCursor* () { return 0; }
-SwCursor::operator SwShellCrsr* () { return 0; }
-SwCursor::operator SwShellTableCrsr* () { return 0; }
-SwCursor::operator SwUnoCrsr* () { return 0; }
-SwCursor::operator SwUnoTableCrsr* () { return 0; }
+bool SwCursor::IsReadOnlyAvailable() const
+{
+ return false;
+}
+
+BOOL SwCursor::IsSkipOverHiddenSections() const
+{
+ return TRUE;
+}
+
+BOOL SwCursor::IsSkipOverProtectSections() const
+{
+ return !IsReadOnlyAvailable();
+}
// Sicher die aktuelle Position, damit ggfs. auf diese zurueck
@@ -206,36 +210,41 @@ BOOL SwCursor::IsNoCntnt() const
GetDoc()->GetNodes().GetEndOfExtras().GetIndex();
}
+bool SwCursor::IsSelOvrCheck(int)
+{
+ return false;
+}
+
+// extracted from IsSelOvr()
+bool SwTableCursor::IsSelOvrCheck(int eFlags)
+{
+ SwNodes& rNds = GetDoc()->GetNodes();
+ // check sections of nodes array
+ if( (nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION & eFlags)
+ && HasMark() )
+ {
+ SwNodeIndex aOldPos( rNds, GetSavePos()->nNode );
+ if( !CheckNodesRange( aOldPos, GetPoint()->nNode, TRUE ))
+ {
+ GetPoint()->nNode = aOldPos;
+ GetPoint()->nContent.Assign( GetCntntNode(), GetSavePos()->nCntnt );
+ return true;
+ }
+ }
+ return SwCursor::IsSelOvrCheck(eFlags);
+}
BOOL SwCursor::IsSelOvr( int eFlags )
{
- SwTableCursor* pTblCrsr = *this;
SwDoc* pDoc = GetDoc();
SwNodes& rNds = pDoc->GetNodes();
- BOOL bSkipOverHiddenSections, bSkipOverProtectSections;
- SwUnoCrsr* pUnoCrsr = *this;
- if( pUnoCrsr )
- {
- bSkipOverHiddenSections = pUnoCrsr->IsSkipOverHiddenSections();
- bSkipOverProtectSections = pUnoCrsr->IsSkipOverProtectSections();
- }
- else
- {
- bSkipOverHiddenSections = TRUE;
- bSkipOverProtectSections = !IsReadOnlyAvailable();
- }
+ BOOL bSkipOverHiddenSections = IsSkipOverHiddenSections();
+ BOOL bSkipOverProtectSections = IsSkipOverProtectSections();
- // Bereiche vom Nodes-Array ueberpruefen
- if( (nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION & eFlags) && pTblCrsr && HasMark() )
+ if ( IsSelOvrCheck( eFlags ) )
{
- SwNodeIndex aOldPos( rNds, pSavePos->nNode );
- if( !CheckNodesRange( aOldPos, GetPoint()->nNode, TRUE ))
- {
- GetPoint()->nNode = aOldPos;
- GetPoint()->nContent.Assign( GetCntntNode(), pSavePos->nCntnt );
- return TRUE;
- }
+ return TRUE;
}
// neu: Bereiche ueberpruefen
@@ -343,7 +352,7 @@ BOOL SwCursor::IsSelOvr( int eFlags )
// neu: Bereiche ueberpruefen
const SwNode* pNd = &GetPoint()->nNode.GetNode();
- if( pNd->IsCntntNode() && 0 == (SwUnoCrsr*)*this )
+ if( pNd->IsCntntNode() && !dynamic_cast<SwUnoCrsr*>(this) )
{
const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->GetFrm();
if( pFrm && pFrm->IsValid() && 0 == pFrm->Frm().Height() &&
@@ -419,7 +428,7 @@ BOOL SwCursor::IsSelOvr( int eFlags )
const SwTableNode* pPtNd = pNd->FindTableNode();
if( (pNd = &GetMark()->nNode.GetNode())->IsCntntNode() &&
- !((SwCntntNode*)pNd)->GetFrm() && 0 == (SwUnoCrsr*)*this )
+ !((SwCntntNode*)pNd)->GetFrm() && !dynamic_cast<SwUnoCrsr*>(this) )
{
DeleteMark();
RestoreSavePos();
@@ -691,8 +700,10 @@ BOOL SwCursor::IsAtValidPos( BOOL bPoint ) const
const SwNode* pNd = &pPos->nNode.GetNode();
if( pNd->IsCntntNode() && !((SwCntntNode*)pNd)->GetFrm() &&
- 0 == (const SwUnoCrsr*)*this )
+ !dynamic_cast<const SwUnoCrsr*>(this) )
+ {
return FALSE;
+ }
//JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt
if( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() )
@@ -741,8 +752,8 @@ ULONG lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
int bSrchBkwrd = fnMove == fnMoveBackward, bEnde = FALSE;
SwPaM *pTmpCrsr = pCurCrsr, *pSaveCrsr = pCurCrsr;
- // nur beim ShellCrsr einen Prgogressbar erzeugen
- BOOL bIsUnoCrsr = 0 != (SwUnoCrsr*)*pCurCrsr;
+ // only create progress-bar for ShellCrsr
+ bool bIsUnoCrsr = 0 != dynamic_cast<SwUnoCrsr*>(pCurCrsr);
_PercentHdl* pPHdl = 0;
USHORT nCrsrCnt = 0;
if( FND_IN_SEL & eFndRngs )
@@ -829,16 +840,20 @@ ULONG lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
if( *pSttPos == *pEndPos ) // im Bereich, aber am Ende
break; // fertig
- if( !nCrsrCnt && !bIsUnoCrsr )
+ if( !nCrsrCnt && pPHdl )
+ {
pPHdl->NextPos( *aRegion.GetMark() );
+ }
}
if( bEnde || !( eFndRngs & ( FND_IN_SELALL | FND_IN_SEL )) )
break;
pTmpCrsr = ((SwPaM*)pTmpCrsr->GetNext());
- if( nCrsrCnt && !bIsUnoCrsr )
+ if( nCrsrCnt && pPHdl )
+ {
pPHdl->NextPos( ++pPHdl->nActPos );
+ }
} while( pTmpCrsr != pSaveCrsr );
@@ -1472,60 +1487,71 @@ BOOL SwCursor::GoSentence( SentenceMoveType eMoveType )
return bRet;
}
-BOOL SwCursor::LeftRight( BOOL bLeft, USHORT nCnt, USHORT nMode,
- BOOL bVisualAllowed,BOOL bSkipHidden, BOOL bInsertCrsr )
+BOOL SwTableCursor::LeftRight( BOOL bLeft, USHORT nCnt, USHORT /*nMode*/,
+ BOOL /*bVisualAllowed*/, BOOL /*bSkipHidden*/, BOOL /*bInsertCrsr*/ )
{
- SwTableCursor* pTblCrsr = (SwTableCursor*)*this;
- if( pTblCrsr )
- return bLeft ? pTblCrsr->GoPrevCell( nCnt )
- : pTblCrsr->GoNextCell( nCnt );
+ return bLeft ? GoPrevCell( nCnt )
+ : GoNextCell( nCnt );
+}
+
+// calculate cursor bidi level: extracted from LeftRight()
+const SwCntntFrm*
+SwCursor::DoSetBidiLevelLeftRight(
+ BOOL & io_rbLeft, BOOL bVisualAllowed, BOOL bInsertCrsr)
+{
// calculate cursor bidi level
const SwCntntFrm* pSttFrm = NULL;
SwNode& rNode = GetPoint()->nNode.GetNode();
- const BOOL bDoNotSetBidiLevel = 0 != (SwUnoCrsr*)*this;
- if ( !bDoNotSetBidiLevel )
+ if( rNode.IsTxtNode() )
{
- if( rNode.IsTxtNode() )
+ const SwTxtNode& rTNd = *rNode.GetTxtNode();
+ SwIndex& rIdx = GetPoint()->nContent;
+ xub_StrLen nPos = rIdx.GetIndex();
+
+ const SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
+ if ( bVisualAllowed && rCTLOptions.IsCTLFontEnabled() &&
+ SvtCTLOptions::MOVEMENT_VISUAL ==
+ rCTLOptions.GetCTLCursorMovement() )
{
- const SwTxtNode& rTNd = *rNode.GetTxtNode();
- SwIndex& rIdx = GetPoint()->nContent;
- xub_StrLen nPos = rIdx.GetIndex();
-
- const SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
- if ( bVisualAllowed && rCTLOptions.IsCTLFontEnabled() &&
- SvtCTLOptions::MOVEMENT_VISUAL ==
- rCTLOptions.GetCTLCursorMovement() )
+ // for visual cursor travelling (used in bidi layout)
+ // we first have to convert the logic to a visual position
+ Point aPt;
+ pSttFrm = rTNd.GetFrm( &aPt, GetPoint() );
+ if( pSttFrm )
{
- // for visual cursor travelling (used in bidi layout)
- // we first have to convert the logic to a visual position
- Point aPt;
- pSttFrm = rTNd.GetFrm( &aPt, GetPoint() );
- if( pSttFrm )
- {
- BYTE nCrsrLevel = GetCrsrBidiLevel();
- sal_Bool bForward = ! bLeft;
- ((SwTxtFrm*)pSttFrm)->PrepareVisualMove( nPos, nCrsrLevel,
- bForward, bInsertCrsr );
- rIdx = nPos;
- SetCrsrBidiLevel( nCrsrLevel );
- bLeft = ! bForward;
- }
+ BYTE nCrsrLevel = GetCrsrBidiLevel();
+ sal_Bool bForward = ! io_rbLeft;
+ ((SwTxtFrm*)pSttFrm)->PrepareVisualMove( nPos, nCrsrLevel,
+ bForward, bInsertCrsr );
+ rIdx = nPos;
+ SetCrsrBidiLevel( nCrsrLevel );
+ io_rbLeft = ! bForward;
}
- else
+ }
+ else
+ {
+ const SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( rTNd );
+ if ( pSI )
{
- const SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( rTNd );
- if ( pSI )
- {
- const xub_StrLen nMoveOverPos = bLeft ?
- ( nPos ? nPos - 1 : 0 ) :
- nPos;
- SetCrsrBidiLevel( pSI->DirType( nMoveOverPos ) );
- }
+ const xub_StrLen nMoveOverPos = io_rbLeft ?
+ ( nPos ? nPos - 1 : 0 ) :
+ nPos;
+ SetCrsrBidiLevel( pSI->DirType( nMoveOverPos ) );
}
}
}
+ return pSttFrm;
+}
+
+BOOL SwCursor::LeftRight( BOOL bLeft, USHORT nCnt, USHORT nMode,
+ BOOL bVisualAllowed,BOOL bSkipHidden, BOOL bInsertCrsr )
+{
+ // calculate cursor bidi level
+ SwNode& rNode = GetPoint()->nNode.GetNode();
+ const SwCntntFrm* pSttFrm = // may side-effect bLeft!
+ DoSetBidiLevelLeftRight(bLeft, bVisualAllowed, bInsertCrsr);
// kann der Cursor n-mal weiterverschoben werden ?
SwCrsrSaveState aSave( *this );
@@ -1650,10 +1676,40 @@ BOOL SwCursor::LeftRight( BOOL bLeft, USHORT nCnt, USHORT nMode,
nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
}
+// calculate cursor bidi level: extracted from UpDown()
+void SwCursor::DoSetBidiLevelUpDown()
+{
+ SwNode& rNode = GetPoint()->nNode.GetNode();
+ if ( rNode.IsTxtNode() )
+ {
+ const SwScriptInfo* pSI =
+ SwScriptInfo::GetScriptInfo( (SwTxtNode&)rNode );
+ if ( pSI )
+ {
+ SwIndex& rIdx = GetPoint()->nContent;
+ xub_StrLen nPos = rIdx.GetIndex();
+
+ if( nPos && nPos < ((SwTxtNode&)rNode).GetTxt().Len() )
+ {
+ const BYTE nCurrLevel = pSI->DirType( nPos );
+ const BYTE nPrevLevel = pSI->DirType( nPos - 1 );
+
+ if ( nCurrLevel % 2 != nPrevLevel % 2 )
+ {
+ // set cursor level to the lower of the two levels
+ SetCrsrBidiLevel( Min( nCurrLevel, nPrevLevel ) );
+ }
+ else
+ SetCrsrBidiLevel( nCurrLevel );
+ }
+ }
+ }
+}
+
BOOL SwCursor::UpDown( BOOL bUp, USHORT nCnt,
Point* pPt, long nUpDownX )
{
- SwTableCursor* pTblCrsr = (SwTableCursor*)*this;
+ SwTableCursor* pTblCrsr = dynamic_cast<SwTableCursor*>(this);
sal_Bool bAdjustTableCrsr = sal_False;
// vom Tabellen Crsr Point/Mark in der gleichen Box ??
@@ -1752,36 +1808,7 @@ BOOL SwCursor::UpDown( BOOL bUp, USHORT nCnt,
else
*GetPoint() = aOldPos;
- // calculate cursor bidi level
- const BOOL bDoNotSetBidiLevel = 0 != (SwUnoCrsr*)*this;
-
- if ( ! bDoNotSetBidiLevel )
- {
- SwNode& rNode = GetPoint()->nNode.GetNode();
- if ( rNode.IsTxtNode() )
- {
- const SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( (SwTxtNode&)rNode );
- if ( pSI )
- {
- SwIndex& rIdx = GetPoint()->nContent;
- xub_StrLen nPos = rIdx.GetIndex();
-
- if( nPos && nPos < ((SwTxtNode&)rNode).GetTxt().Len() )
- {
- const BYTE nCurrLevel = pSI->DirType( nPos );
- const BYTE nPrevLevel = pSI->DirType( nPos - 1 );
-
- if ( nCurrLevel % 2 != nPrevLevel % 2 )
- {
- // set cursor level to the lower of the two levels
- SetCrsrBidiLevel( Min( nCurrLevel, nPrevLevel ) );
- }
- else
- SetCrsrBidiLevel( nCurrLevel );
- }
- }
- }
- }
+ DoSetBidiLevelUpDown(); // calculate cursor bidi level
}
return bRet;
@@ -1895,12 +1922,15 @@ BOOL SwCursor::GoPrevNextCell( BOOL bNext, USHORT nCnt )
return !IsInProtectTable( TRUE );
}
+BOOL SwTableCursor::GotoTable( const String& /*rName*/ )
+{
+ return FALSE; // invalid action
+}
+
BOOL SwCursor::GotoTable( const String& rName )
{
BOOL bRet = FALSE;
- // Tabellenselektion oder ueberhaupt Selection ?
- // Das ist eine ungueltige Action !
- if( !(SwTableCursor*)*this && !HasMark() )
+ if ( !HasMark() )
{
SwTable* pTmpTbl = SwTable::FindTable( GetDoc()->FindTblFmtByName( rName ) );
if( pTmpTbl )
@@ -2017,7 +2047,6 @@ SwTableCursor::SwTableCursor( const SwPosition &rPos, SwPaM* pRing )
SwTableCursor::~SwTableCursor() {}
-SwTableCursor::operator SwTableCursor* () { return this; }
BOOL lcl_SeekEntry( const SwSelBoxes& rTmp, const SwStartNode* pSrch, USHORT& rFndPos )
{
diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx
index 77387be91fc4..017ea9811f91 100644
--- a/sw/source/core/crsr/trvlreg.cxx
+++ b/sw/source/core/crsr/trvlreg.cxx
@@ -238,7 +238,7 @@ BOOL GotoCurrRegionAndSkip( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
BOOL SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion )
{
SwCrsrSaveState aSaveState( *this );
- return !(SwTableCursor*)*this &&
+ return !dynamic_cast<SwTableCursor*>(this) &&
(*fnWhichRegion)( *this, fnPosRegion, IsReadOnlyAvailable() ) &&
!IsSelOvr() &&
( GetPoint()->nNode.GetIndex() != pSavePos->nNode ||
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 1a30931f290f..108da63d9b17 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -32,9 +32,7 @@
#include "precompiled_sw.hxx"
#include <hintids.hxx>
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
#include <svx/protitem.hxx>
#include <crsrsh.hxx>
#include <doc.hxx>
@@ -54,6 +52,7 @@
#include <cellfrm.hxx>
#include <rowfrm.hxx>
+
// setze Crsr in die naechsten/vorherigen Celle
BOOL SwCrsrShell::GoNextCell( BOOL bAppendLine )
{
@@ -653,7 +652,7 @@ BOOL GotoCurrTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl,
BOOL SwCursor::MoveTable( SwWhichTable fnWhichTbl, SwPosTable fnPosTbl )
{
BOOL bRet = FALSE;
- SwTableCursor* pTblCrsr = (SwTableCursor*)*this;
+ SwTableCursor* pTblCrsr = dynamic_cast<SwTableCursor*>(this);
if( pTblCrsr || !HasMark() ) // nur wenn kein Mark oder ein TblCrsr
{
diff --git a/sw/source/core/crsr/unocrsr.cxx b/sw/source/core/crsr/unocrsr.cxx
index bfc179db489e..aa52f61c8317 100644
--- a/sw/source/core/crsr/unocrsr.cxx
+++ b/sw/source/core/crsr/unocrsr.cxx
@@ -85,14 +85,21 @@ SwUnoCrsr::~SwUnoCrsr()
SwUnoCrsr * SwUnoCrsr::Clone() const
{
- SwUnoCrsr * pNewCrsr = 0;
-
- // check if the cursor is a SwUnoTableCrsr, if so clone that type
- const SwUnoTableCrsr * pUnoTableCrsr = *this;
- if (pUnoTableCrsr)
- pNewCrsr = GetDoc()->CreateUnoCrsr( *GetPoint(), sal_True /* create SwUnoTableCrsr */ );
- else
- pNewCrsr = GetDoc()->CreateUnoCrsr( *GetPoint() );
+ SwUnoCrsr * pNewCrsr = GetDoc()->CreateUnoCrsr( *GetPoint() );
+ if (HasMark())
+ {
+ pNewCrsr->SetMark();
+ *pNewCrsr->GetMark() = *GetMark();
+ }
+ return pNewCrsr;
+}
+
+SwUnoTableCrsr * SwUnoTableCrsr::Clone() const
+{
+ SwUnoTableCrsr * pNewCrsr = dynamic_cast<SwUnoTableCrsr*>(
+ GetDoc()->CreateUnoCrsr(
+ *GetPoint(), sal_True /* create SwUnoTableCrsr */ ) );
+ OSL_ENSURE(pNewCrsr, "Clone: cannot create SwUnoTableCrsr?");
if (HasMark())
{
pNewCrsr->SetMark();
@@ -101,8 +108,22 @@ SwUnoCrsr * SwUnoCrsr::Clone() const
return pNewCrsr;
}
-SwUnoCrsr::operator SwUnoCrsr* () { return this; }
+bool SwUnoCrsr::IsReadOnlyAvailable() const
+{
+ return true;
+}
+
+const SwCntntFrm*
+SwUnoCrsr::DoSetBidiLevelLeftRight( BOOL &, BOOL, BOOL )
+{
+ return 0; // not for uno cursor
+}
+
+void SwUnoCrsr::DoSetBidiLevelUpDown()
+{
+ return; // not for uno cursor
+}
BOOL SwUnoCrsr::IsSelOvr( int eFlags )
{
@@ -208,9 +229,6 @@ SwUnoTableCrsr::~SwUnoTableCrsr()
delete aTblSel.GetNext(); // und loeschen
}
-SwUnoTableCrsr::operator SwUnoCrsr* () { return this; }
-SwUnoTableCrsr::operator SwTableCursor* () { return this; }
-SwUnoTableCrsr::operator SwUnoTableCrsr* () { return this; }
/*
SwCursor* SwUnoTableCrsr::Create( SwPaM* pRing ) const
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index a7fc7ea3665b..ae0530452635 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -37,15 +37,9 @@
#include <svtools/svstdarr.hxx>
#endif
-#ifndef _DIALOG_HXX //autogen
#include <vcl/dialog.hxx>
-#endif
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _WRKWIN_HXX //autogen
#include <vcl/wrkwin.hxx>
-#endif
#include <viewopt.hxx>
#include <frmtool.hxx>
#include <viscrs.hxx>
@@ -65,14 +59,10 @@
#include <comcore.hrc> // ResId fuer Abfrage wenn zu Search & Replaces
#endif
-// #i75172#
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <svx/sdrpaintwindow.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <vcl/hatch.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/sdr/overlay/overlayselection.hxx>
extern void SwCalcPixStatics( OutputDevice *pOut );
@@ -525,192 +515,6 @@ void SwVisCrsr::_SetPosAndShow()
}
//////////////////////////////////////////////////////////////////////////////
-// #i75172#
-
-namespace sdr
-{
- namespace overlay
- {
- class OverlaySwSelPaintRects : public OverlayObject
- {
- // geometry
- std::vector< basegfx::B2DRange > maRanges;
- SwOverlayType mePaintType;
-
- // Draw geometry
- virtual void drawGeometry(OutputDevice& rOutputDevice);
-
- // Create the BaseRange. This method needs to calculate maBaseRange.
- virtual void createBaseRange(OutputDevice& rOutputDevice);
-
- public:
- OverlaySwSelPaintRects(Color aBaseColor, const std::vector< basegfx::B2DRange >& rRanges, SwOverlayType eType);
- virtual ~OverlaySwSelPaintRects();
-
- // data access
- const std::vector< basegfx::B2DRange >& getB2DRanges() const { return maRanges; }
- void setB2DRanges(const std::vector< basegfx::B2DRange >& rNew);
-
- // Hittest with logical coordinates
- virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol) const;
-
- // transform object coordinates. Needs to transform maSecondPosition
- // and maThirdPosition.
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
- };
-
- void OverlaySwSelPaintRects::drawGeometry(OutputDevice& rOutputDevice)
- {
- // safe original AA and switch off for selection
- const sal_uInt16 nOriginalAA(rOutputDevice.GetAntialiasing());
- rOutputDevice.SetAntialiasing(0);
-
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(getBaseColor());
-
- if ( mePaintType == SW_OVERLAY_INVERT )
- {
- rOutputDevice.Push();
- rOutputDevice.SetRasterOp( ROP_XOR );
- rOutputDevice.SetFillColor( COL_WHITE );
- }
-
- for(sal_uInt32 a(0); a < maRanges.size(); a++)
- {
- const basegfx::B2DRange& rRange(maRanges[a]);
-
- switch(mePaintType)
- {
- default: // SW_OVERLAY_INVERT
- {
- const Rectangle aRectangle(
- basegfx::fround(rRange.getMinX()), basegfx::fround(rRange.getMinY()),
- basegfx::fround(rRange.getMaxX()) - 1, basegfx::fround(rRange.getMaxY()) - 1);
- Rectangle aPntRect(aRectangle);
-
- // avoid single-pixel overlaps
- Rectangle aCalcRect( aPntRect );
- bool bChange(false);
-
- ++aCalcRect.Bottom();
- ++aCalcRect.Right();
-
- aPntRect = rOutputDevice.LogicToPixel( aPntRect );
- aCalcRect = rOutputDevice.LogicToPixel( aCalcRect );
-
- if(aPntRect.Bottom() == aCalcRect.Bottom())
- {
- --aPntRect.Bottom();
- bChange = true;
- }
-
- if(aPntRect.Right() == aCalcRect.Right())
- {
- --aPntRect.Right();
- bChange = true;
- }
-
- if(bChange)
- {
- aPntRect = rOutputDevice.PixelToLogic(aPntRect);
- }
- else
- {
- aPntRect = aRectangle;
- }
-
- rOutputDevice.DrawRect(aPntRect);
- break;
- }
- case SW_OVERLAY_TRANSPARENT :
- {
- const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
- rOutputDevice.DrawTransparent(basegfx::B2DPolyPolygon(aPolygon), 0.5);
- break;
- }
- }
- }
-
- if(mePaintType == SW_OVERLAY_INVERT)
- {
- rOutputDevice.Pop();
- }
-
- // restore original AA
- rOutputDevice.SetAntialiasing(nOriginalAA);
- }
-
- void OverlaySwSelPaintRects::createBaseRange(OutputDevice& /*rOutputDevice*/)
- {
- maBaseRange.reset();
-
- for(sal_uInt32 a(0); a < maRanges.size(); a++)
- {
- const basegfx::B2DRange& rCandidate = maRanges[a];
- maBaseRange.expand(rCandidate);
- }
- }
-
- OverlaySwSelPaintRects::OverlaySwSelPaintRects(Color aBaseColor, const std::vector< basegfx::B2DRange >& rRanges, SwOverlayType eType)
- : OverlayObject(aBaseColor),
- maRanges(rRanges),
- mePaintType(eType)
- {
- }
-
- OverlaySwSelPaintRects::~OverlaySwSelPaintRects()
- {
- if(getOverlayManager())
- {
- getOverlayManager()->remove(*this);
- }
- }
-
- void OverlaySwSelPaintRects::setB2DRanges(const std::vector< basegfx::B2DRange >& rNew)
- {
- if(rNew != maRanges)
- {
- maRanges = rNew;
- objectChange();
- }
- }
-
- sal_Bool OverlaySwSelPaintRects::isHit(const basegfx::B2DPoint& rPos, double /*fTol*/) const
- {
- if(isHittable())
- {
- for(sal_uInt32 a(0); a < maRanges.size(); a++)
- {
- const basegfx::B2DRange& rCandidate = maRanges[a];
-
- if(rCandidate.isInside(rPos))
- {
- return true;
- }
- }
- }
-
- return sal_False;
- }
-
- void OverlaySwSelPaintRects::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- for(sal_uInt32 a(0); a < maRanges.size(); a++)
- {
- basegfx::B2DRange& rCandidate = maRanges[a];
- rCandidate.transform(rMatrix);
- }
-
- // register change (after change)
- objectChange();
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh )
: SwRects( 0 ),
@@ -758,8 +562,11 @@ void SwSelPaintRects::Show()
if(pView && pView->PaintWindowCount())
{
+ // reset rects
SwRects::Remove( 0, SwRects::Count() );
FillRects();
+
+ // get new rects
std::vector< basegfx::B2DRange > aNewRanges;
for(sal_uInt16 a(0); a < Count(); a++)
@@ -776,7 +583,7 @@ void SwSelPaintRects::Show()
{
if(aNewRanges.size())
{
- static_cast< sdr::overlay::OverlaySwSelPaintRects* >(mpCursorOverlay)->setB2DRanges(aNewRanges);
+ static_cast< sdr::overlay::OverlaySelection* >(mpCursorOverlay)->setRanges(aNewRanges);
}
else
{
@@ -791,20 +598,34 @@ void SwSelPaintRects::Show()
if(pTargetOverlay)
{
- Color aHighlight(COL_BLACK);
- const OutputDevice *pOut = GetShell()->GetOut();
-
- if(pOut)
+ // #i97672# get the system's hilight color and limit it to the maximum
+ // allowed luminance. This is needed to react on too bright hilight colors
+ // which would otherwise vive a bad visualisation
+ const OutputDevice *pOut = Application::GetDefaultDevice();
+ Color aHighlight(pOut->GetSettings().GetStyleSettings().GetHighlightColor());
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const basegfx::BColor aSelection(aHighlight.getBColor());
+ const double fLuminance(aSelection.luminance());
+ const double fMaxLum(aSvtOptionsDrawinglayer.GetSelectionMaximumLuminancePercent() / 100.0);
+
+ if(fLuminance > fMaxLum)
{
- aHighlight = pOut->GetSettings().GetStyleSettings().GetHighlightColor();
+ const double fFactor(fMaxLum / fLuminance);
+ const basegfx::BColor aNewSelection(
+ aSelection.getRed() * fFactor,
+ aSelection.getGreen() * fFactor,
+ aSelection.getBlue() * fFactor);
+
+ aHighlight = Color(aNewSelection);
}
- SwOverlayType aType(GetShell()->getSwOverlayType());
-#ifdef DBG_UTIL
- static bool bChange(false);
- if(bChange) aType = (SW_OVERLAY_INVERT == aType) ? SW_OVERLAY_TRANSPARENT : SW_OVERLAY_INVERT;
-#endif
- mpCursorOverlay = new sdr::overlay::OverlaySwSelPaintRects(aHighlight, aNewRanges, aType);
+ // create correct selection
+ mpCursorOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_TRANSPARENT,
+ aHighlight,
+ aNewRanges,
+ true);
+
pTargetOverlay->add(*mpCursorOverlay);
}
}
@@ -907,7 +728,11 @@ SwShellCrsr::SwShellCrsr( SwShellCrsr& rICrsr )
SwShellCrsr::~SwShellCrsr() {}
-SwShellCrsr::operator SwShellCrsr* () { return this; }
+
+bool SwShellCrsr::IsReadOnlyAvailable() const
+{
+ return GetShell()->IsReadOnlyAvailable();
+}
void SwShellCrsr::SetMark()
{
@@ -936,7 +761,7 @@ void SwShellCrsr::Show()
SwShellCrsr * pTmp = this;
do {
pTmp->SwSelPaintRects::Show();
- } while( this != ( pTmp = (SwShellCrsr*)*(SwCursor*)(pTmp->GetNext() )));
+ } while( this != ( pTmp = dynamic_cast<SwShellCrsr*>(pTmp->GetNext()) ) );
SHOWBOOKMARKS1( 1 )
SHOWREDLINES1( 1 )
@@ -948,7 +773,6 @@ void SwShellCrsr::Show()
void SwShellCrsr::Invalidate( const SwRect& rRect )
{
SwShellCrsr * pTmp = this;
- SwCursor* pTmpCrsr;
do
{
@@ -963,9 +787,7 @@ void SwShellCrsr::Invalidate( const SwRect& rRect )
do
{
pTmpRing = pTmpRing->GetNext();
- pTmpCrsr = dynamic_cast<SwCursor*>(pTmpRing);
- if ( pTmpCrsr )
- pTmp = (SwShellCrsr*)*pTmpCrsr;
+ pTmp = dynamic_cast<SwShellCrsr*>(pTmpRing);
}
while ( !pTmp );
}
@@ -981,7 +803,7 @@ void SwShellCrsr::Hide()
SwShellCrsr * pTmp = this;
do {
pTmp->SwSelPaintRects::Hide();
- } while( this != ( pTmp = (SwShellCrsr*)*(SwCursor*)(pTmp->GetNext() )));
+ } while( this != ( pTmp = dynamic_cast<SwShellCrsr*>(pTmp->GetNext()) ) );
SHOWBOOKMARKS1( 2 )
SHOWREDLINES1( 2 )
@@ -1086,9 +908,6 @@ SwShellTableCrsr::SwShellTableCrsr( const SwCrsrShell& rCrsrSh,
SwShellTableCrsr::~SwShellTableCrsr() {}
void SwShellTableCrsr::SetMark() { SwShellCrsr::SetMark(); }
-SwShellTableCrsr::operator SwShellCrsr* () { return this; }
-SwShellTableCrsr::operator SwTableCursor* () { return this; }
-SwShellTableCrsr::operator SwShellTableCrsr* () { return this; }
SwCursor* SwShellTableCrsr::Create( SwPaM* pRing ) const
{
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 530dc1e90e0b..17b13bbdcdb0 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -552,6 +552,10 @@ String lcl_dbg_out(const SwNode & rNode)
aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US);
#endif
+ aTmpStr += String(" type=\"", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String::CreateFromInt32(sal_Int32( rNode.GetNodeType() ) );
+ aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US);
+
aTmpStr += String(" pointer=\"", RTL_TEXTENCODING_ASCII_US);
char aBuffer[128];
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index ae48966e31b8..926a555c8a4e 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1710,11 +1710,13 @@ BOOL SwDoc::ConvertFieldsToText()
sText.Erase();
//now remove the field and insert the string
- SwPaM aPam(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart());
- aPam.SetMark();
- aPam.Move();
- DeleteAndJoin(aPam);
- Insert( aPam, sText, true );
+ SwPaM aPam1(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart());
+ aPam1.Move();
+ Insert( aPam1, sText, true );//insert first to keep the field's attributes
+ SwPaM aPam2(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart());
+ aPam2.SetMark();
+ aPam2.Move();
+ DeleteAndJoin(aPam2);//remove the field
}
}
++aBegin;
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index f4c3d3017972..d838b277bdf5 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -535,11 +535,11 @@ namespace sw { namespace mark
}
void MarkManager::deleteMarks(
- const SwNodeIndex& rStt,
- const SwNodeIndex& rEnd,
- ::std::vector<SaveBookmark>* pSaveBkmk,
- const SwIndex* pSttIdx,
- const SwIndex* pEndIdx)
+ const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd,
+ ::std::vector<SaveBookmark>* pSaveBkmk,
+ const SwIndex* pSttIdx,
+ const SwIndex* pEndIdx )
{
vector<const_iterator_t> vMarksToDelete;
bool isSortingNeeded = false;
@@ -574,12 +574,29 @@ namespace sw { namespace mark
isPosInRange = true, isOtherPosInRange = true;
}
- if(isPosInRange && isOtherPosInRange)
+ if(isPosInRange && (isOtherPosInRange || !pMark->IsExpanded()))
{
// completely in range
- if(pSaveBkmk)
- pSaveBkmk->push_back(SaveBookmark(true, true, *pMark, rStt, pSttIdx));
- vMarksToDelete.push_back(ppMark);
+
+ // --> OD 2009-08-07 #i92125#
+ bool bKeepCrossRefBkmk( false );
+ {
+ if ( rStt == rEnd &&
+ ( IDocumentMarkAccess::GetType(*pMark) ==
+ IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK ||
+ IDocumentMarkAccess::GetType(*pMark) ==
+ IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
+ {
+ bKeepCrossRefBkmk = true;
+ }
+ }
+ if ( !bKeepCrossRefBkmk )
+ {
+ if(pSaveBkmk)
+ pSaveBkmk->push_back(SaveBookmark(true, true, *pMark, rStt, pSttIdx));
+ vMarksToDelete.push_back(ppMark);
+ }
+ // <--
}
else if(isPosInRange ^ isOtherPosInRange)
{
@@ -596,13 +613,24 @@ namespace sw { namespace mark
rEnd,
isPosInRange ? pMark->GetOtherMarkPos() : pMark->GetMarkPos());
- if(isPosInRange)
- pMark->SetMarkPos(*pNewPos);
- else
- pMark->SetOtherMarkPos(*pNewPos);
+ // --> OD 2009-08-06 #i92125#
+ // no move of position for cross-reference bookmarks,
+ // if move occurs inside a certain node
+ if ( ( IDocumentMarkAccess::GetType(*pMark) !=
+ IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK &&
+ IDocumentMarkAccess::GetType(*pMark) !=
+ IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) ||
+ pMark->GetMarkPos().nNode != pNewPos->nNode )
+ {
+ if(isPosInRange)
+ pMark->SetMarkPos(*pNewPos);
+ else
+ pMark->SetOtherMarkPos(*pNewPos);
- // illegal selection? collapse the mark and restore sorting later
- isSortingNeeded |= lcl_FixCorrectedMark(isPosInRange, isOtherPosInRange, pMark);
+ // illegal selection? collapse the mark and restore sorting later
+ isSortingNeeded |= lcl_FixCorrectedMark(isPosInRange, isOtherPosInRange, pMark);
+ }
+ // <--
}
}
@@ -613,7 +641,9 @@ namespace sw { namespace mark
for(vector<const_iterator_t>::reverse_iterator pppMark = vMarksToDelete.rbegin();
pppMark != vMarksToDelete.rend();
pppMark++)
+ {
deleteMark(*pppMark);
+ }
if(isSortingNeeded)
sortMarks();
#if FALSE
@@ -1332,7 +1362,8 @@ void _SaveCntntIdx(SwDoc* pDoc,
aSave.IncCount();
FOREACHPAM_END()
- SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ];
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]);
if( pUnoTblCrsr )
{
FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
@@ -1474,8 +1505,9 @@ void _RestoreCntntIdx(SwDoc* pDoc,
if( pPos )
break;
- SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ i ];
- if( pUnoTblCrsr )
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ i ]);
+ if ( pUnoTblCrsr )
{
FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
if( aSave.GetCount() == nCnt )
@@ -1487,7 +1519,7 @@ void _RestoreCntntIdx(SwDoc* pDoc,
++nCnt;
FOREACHPAM_END()
}
- if( pPos )
+ if ( pPos )
break;
}
}
@@ -1629,8 +1661,9 @@ void _RestoreCntntIdx(SvULongs& rSaveArr,
if( pPos )
break;
- SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ i ];
- if( pUnoTblCrsr )
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ i ]);
+ if ( pUnoTblCrsr )
{
FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
if( aSave.GetCount() == nCnt )
@@ -1642,7 +1675,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr,
++nCnt;
FOREACHPAM_END()
}
- if( pPos )
+ if ( pPos )
break;
}
}
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index fe513d51e4da..fb94d433d14f 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1196,7 +1196,7 @@ BOOL SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
SwPaM aCpyPam( rSrcNd, nStt );
aCpyPam.SetMark();
aCpyPam.GetPoint()->nContent = nSEnd;
- aCpyPam.GetDoc()->Copy( aCpyPam, *aPam.GetPoint() );
+ aCpyPam.GetDoc()->Copy( aCpyPam, *aPam.GetPoint(), false );
pDoc->DoUndo( bUndo );
}
@@ -1367,7 +1367,7 @@ void SwCompareData::ShowDelete( const CompareData& rData, ULONG nStt,
SwNodeIndex aInsPos( *pLineNd, nOffset );
SwNodeIndex aSavePos( aInsPos, -1 );
- ((SwCompareData&)rData).rDoc.CopyWithFlyInFly( aRg, aInsPos );
+ ((SwCompareData&)rData).rDoc.CopyWithFlyInFly( aRg, 0, aInsPos );
rDoc.SetModified();
aSavePos++;
@@ -1624,7 +1624,7 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn )
RedlineMode_t eOld = pDoc->GetRedlineMode();
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
- pSrcRedl->GetDoc()->Copy( *(SwPaM*)pSrcRedl, *pDestRedl->GetPoint() );
+ pSrcRedl->GetDoc()->Copy( *(SwPaM*)pSrcRedl, *pDestRedl->GetPoint(), false );
pDoc->SetRedlineMode_intern( eOld );
pDoc->DoUndo( bUndo );
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index c7c3e4e69031..8e45afd37247 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -183,7 +183,8 @@ void PaMCorrAbs( const SwNodeIndex &rOldNode,
lcl_PaMCorrAbs1( PCURCRSR, pOldNode, aNewPos, nOffset );
FOREACHPAM_END()
- SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ];
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]);
if( pUnoTblCrsr )
{
FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
@@ -245,7 +246,8 @@ void PaMCorrAbs( const SwNodeIndex &rStartNode,
bChange |= lcl_PaMCorrAbs2(PCURCRSR, aNewPos, nSttNode, nEndNode);
FOREACHPAM_END()
- SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*pUnoCursor;
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(pUnoCursor);
if( pUnoTblCrsr )
{
FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
@@ -303,7 +305,8 @@ void PaMCorrAbs( const SwPaM& rRange,
lcl_PaMCorrAbs3( PCURCRSR, aStart, aEnd, aNewPos );
FOREACHPAM_END()
- SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ];
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]);
if( pUnoTblCrsr )
{
FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
@@ -402,7 +405,8 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx );
FOREACHPAM_END()
- SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ];
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]);
if( pUnoTblCrsr )
{
FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx
index a7c042f51d88..f03ca5b5d352 100644
--- a/sw/source/core/doc/docdde.cxx
+++ b/sw/source/core/doc/docdde.cxx
@@ -62,7 +62,7 @@ using namespace ::com::sun::star;
namespace
{
- static ::sw::mark::DdeBookmark* const lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName)
+ static ::sw::mark::DdeBookmark* lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName)
{
//Iterating over all bookmarks, checking DdeBookmarks
const String sNameLc = GetAppCharClass().lower(rName);
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 8b4ebe172b6f..16ceedbeefc6 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -34,16 +34,12 @@
#include <string.h> // fuer strchr()
#include <hintids.hxx>
-#ifndef _SOUND_HXX //autogen
#include <vcl/sound.hxx>
-#endif
#include <svx/cscoitem.hxx>
#include <svx/brkitem.hxx>
#include <linguistic/lngprops.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HDL
#include <com/sun/star/i18n/WordType.hdl>
-#endif
#include <unotools/charclass.hxx>
#include <fmtanchr.hxx>
#include <fmtcntnt.hxx>
@@ -477,16 +473,19 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
SwNode* pNode = &aIdx.GetNode();
if( pNode->IsTxtNode() ) // Looking for text nodes...
{
- SwpHints *pHints = ((SwTxtNode*)pNode)->GetpSwpHints();
+ SwpHints *pHints =
+ static_cast<SwTxtNode*>(pNode)->GetpSwpHints();
if( pHints && pHints->HasFtn() ) //...with footnotes
{
bUpdateFtn = sal_True; // Heureka
USHORT nCount = pHints->Count();
for( USHORT i = 0; i < nCount; ++i )
{
- SwTxtAttr *pAttr = pHints->GetHt( i );
- if( pAttr->Which() == RES_TXTATR_FTN )
- rSaveArr.Insert( (SwTxtFtn*)pAttr );
+ SwTxtAttr *pAttr = pHints->GetTextHint( i );
+ if ( pAttr->Which() == RES_TXTATR_FTN )
+ {
+ rSaveArr.Insert( static_cast<SwTxtFtn*>(pAttr) );
+ }
}
}
}
@@ -1220,20 +1219,11 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
{
if( pTNd->CanJoinNext())
{
- SwTxtNode *pNextTNd = 0;
- if( !pTNd->Len() )
- {
- SwNodeIndex aTmpIdx( *pTNd, 1 );
- pNextTNd = aTmpIdx.GetNode().GetTxtNode();
- }
- if( pNextTNd )
- {
- if( !bNullCntnt )
- pSavePam->Move( fnMoveForward, fnGoCntnt );
- pNextTNd->JoinPrev();
- }
- else
- pTNd->JoinNext();
+ // --> OD 2009-08-20 #i100466#
+ // Always join next, because <pTNd> has to stay as it is.
+ // A join previous from its next would more or less delete <pTNd>
+ pTNd->JoinNext();
+ // <--
bRemove = false;
}
}
@@ -1475,7 +1465,12 @@ void lcl_GetJoinFlags( SwPaM& rPam, sal_Bool& rJoinTxt, sal_Bool& rJoinPrev )
bExchange = !bExchange;
if( bExchange )
rPam.Exchange();
- rJoinPrev = rJoinTxt && rPam.GetPoint() == pStt;
+ rJoinPrev = rPam.GetPoint() == pStt;
+ ASSERT( !pStt->nContent.GetIndex() &&
+ pEndNd->GetTxt().Len() != pEnd->nContent.GetIndex()
+ ? rPam.GetPoint()->nNode < rPam.GetMark()->nNode
+ : rPam.GetPoint()->nNode > rPam.GetMark()->nNode,
+ "lcl_GetJoinFlags");
}
}
}
@@ -1493,6 +1488,9 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
SwDoc* pDoc = rPam.GetDoc();
if( bJoinPrev )
{
+ // N.B.: we do not need to handle xmlids in this case, because
+ // it is only invoked if one paragraph is completely empty
+ // (see lcl_GetJoinFlags)
{
// falls PageBreaks geloescht / gesetzt werden, darf das
// nicht in die Undo-History aufgenommen werden !!
@@ -1595,12 +1593,26 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
}
pDoc->CorrRel( aIdx, *rPam.GetPoint(), 0, sal_True );
+ // --> OD 2009-08-20 #i100466#
+ // adjust given <rPam>, if it does not belong to the cursors
+ if ( pDelNd == rPam.GetBound( sal_True ).nContent.GetIdxReg() )
+ {
+ rPam.GetBound( sal_True ) = SwPosition( SwNodeIndex( *pTxtNd ), SwIndex( pTxtNd ) );
+ }
+ if( pDelNd == rPam.GetBound( sal_False ).nContent.GetIdxReg() )
+ {
+ rPam.GetBound( sal_False ) = SwPosition( SwNodeIndex( *pTxtNd ), SwIndex( pTxtNd ) );
+ }
+ // <--
pTxtNd->JoinNext();
}
}
}
-bool SwDoc::DeleteAndJoin( SwPaM & rPam )
+// OD 2009-08-20 #i100466#
+// Add handling of new optional parameter <bForceJoinNext>
+bool SwDoc::DeleteAndJoin( SwPaM & rPam,
+ const bool bForceJoinNext )
{
if( lcl_StrLenOverFlow( rPam ) )
return sal_False;
@@ -1649,7 +1661,12 @@ SetRedlineMode( eOld );
sal_Bool bJoinTxt, bJoinPrev;
lcl_GetJoinFlags( rPam, bJoinTxt, bJoinPrev );
-
+ // --> OD 2009-08-20 #i100466#
+ if ( bForceJoinNext )
+ {
+ bJoinPrev = sal_False;
+ }
+ // <--
{
// dann eine Kopie vom Cursor erzeugen um alle Pams aus den
// anderen Sichten aus dem Loeschbereich zu verschieben
@@ -1753,7 +1770,8 @@ bool SwDoc::Delete( SwPaM & rPam )
do { // middle checked loop!
if( pCNd )
{
- if( pCNd->GetTxtNode() )
+ SwTxtNode * pStartTxtNode( pCNd->GetTxtNode() );
+ if ( pStartTxtNode )
{
// verschiebe jetzt noch den Inhalt in den neuen Node
sal_Bool bOneNd = pStt->nNode == pEnd->nNode;
@@ -1763,7 +1781,15 @@ bool SwDoc::Delete( SwPaM & rPam )
// falls schon leer, dann nicht noch aufrufen
if( nLen )
- ((SwTxtNode*)pCNd)->Erase( pStt->nContent, nLen );
+ {
+ pStartTxtNode->Erase( pStt->nContent, nLen );
+
+ if( !pStartTxtNode->Len() )
+ {
+ // METADATA: remove reference if empty (consider node deleted)
+ pStartTxtNode->RemoveMetadataReference();
+ }
+ }
if( bOneNd ) // das wars schon
break;
@@ -1781,13 +1807,20 @@ bool SwDoc::Delete( SwPaM & rPam )
pCNd = pEnd->nNode.GetNode().GetCntntNode();
if( pCNd )
{
- if( pCNd->GetTxtNode() )
+ SwTxtNode * pEndTxtNode( pCNd->GetTxtNode() );
+ if( pEndTxtNode )
{
// falls schon leer, dann nicht noch aufrufen
if( pEnd->nContent.GetIndex() )
{
SwIndex aIdx( pCNd, 0 );
- ((SwTxtNode*)pCNd)->Erase( aIdx, pEnd->nContent.GetIndex() );
+ pEndTxtNode->Erase( aIdx, pEnd->nContent.GetIndex() );
+
+ if( !pEndTxtNode->Len() )
+ {
+ // METADATA: remove reference if empty (consider node deleted)
+ pEndTxtNode->RemoveMetadataReference();
+ }
}
}
else
@@ -2202,6 +2235,8 @@ sal_Bool lcl_GetTokenToParaBreak( String& rStr, String& rRet, sal_Bool bRegExpRp
return bRet;
}
+// N.B.: it is possible to call Replace with a PaM that spans 2 paragraphs:
+// search with regex for "$", then replace _all_
bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc )
{
if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark() )
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 26971a4b86ee..cd381f3163d8 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -2721,14 +2721,11 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld,
{
if (DoesUndo())
{
- SwPosition * pPos =
- pDstTxtFld->GetPosition();
+ SwPosition aPosition( pDstTxtFld->GetTxtNode() );
+ aPosition.nContent = *pDstTxtFld->GetStart();
- ASSERT(pPos, "SwTxtFld not in its SwTxtNode?");
-
- AppendUndo(new SwUndoFieldFromDoc(*pPos, *pDstFld, rSrcFld,
+ AppendUndo(new SwUndoFieldFromDoc(aPosition, *pDstFld, rSrcFld,
pMsgHnt, bUpdateFlds));
- delete pPos;
}
// Das gefundene Feld wird angepasst ...
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 2be5dc7cbca0..164be09fbcc7 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -68,6 +68,10 @@
#include <fmtcnct.hxx>
#include <dflyobj.hxx>
+// --> OD 2009-07-20 #i73249#
+#include <undoflystrattr.hxx>
+// <--
+
extern USHORT GetHtmlMode( const SwDocShell* );
@@ -392,13 +396,13 @@ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
if( !rSet.Count() )
return FALSE;
- _UndoFmtAttr* pSaveUndo = 0;
+ ::std::auto_ptr<SwUndoFmtAttrHelper> pSaveUndo;
const bool bDoesUndo = DoesUndo();
if( DoesUndo() )
{
ClearRedo();
- pSaveUndo = new _UndoFmtAttr( rFlyFmt );
+ pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) );
// --> FME 2004-10-13 #i32968#
// Inserting columns in the frame causes MakeFrmFmt to put two
// objects of type SwUndoFrmFmt on the undo stack. We don't want them.
@@ -452,15 +456,16 @@ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
if( MAKEFRMS == nMakeFrms )
rFlyFmt.MakeFrms();
- if( pSaveUndo )
+ if ( pSaveUndo.get() )
{
// --> FME 2004-10-13 #i32968#
DoUndo( bDoesUndo );
// <--
- if( pSaveUndo->pUndo )
- AppendUndo( pSaveUndo->pUndo );
- delete pSaveUndo;
+ if ( pSaveUndo->GetUndo() )
+ {
+ AppendUndo( pSaveUndo->ReleaseUndo() );
+ }
}
SetModified();
@@ -468,6 +473,61 @@ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
return aTmpSet.Count() || MAKEFRMS == nMakeFrms;
}
+// --> OD 2009-07-20 #i73249#
+void SwDoc::SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt,
+ const String& sNewTitle )
+{
+ if ( rFlyFrmFmt.GetObjTitle() == sNewTitle )
+ {
+ return;
+ }
+
+ const bool bFormerIsNoDrawUndoObj( IsNoDrawUndoObj() );
+ SetNoDrawUndoObj( true );
+
+ if ( DoesUndo() )
+ {
+ ClearRedo();
+ AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt,
+ UNDO_FLYFRMFMT_TITLE,
+ rFlyFrmFmt.GetObjTitle(),
+ sNewTitle ) );
+ }
+
+ rFlyFrmFmt.SetObjTitle( sNewTitle, true );
+
+ SetNoDrawUndoObj( bFormerIsNoDrawUndoObj );
+
+ SetModified();
+}
+
+void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt,
+ const String& sNewDescription )
+{
+ if ( rFlyFrmFmt.GetObjDescription() == sNewDescription )
+ {
+ return;
+ }
+
+ const bool bFormerIsNoDrawUndoObj( IsNoDrawUndoObj() );
+ SetNoDrawUndoObj( true );
+
+ if ( DoesUndo() )
+ {
+ ClearRedo();
+ AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt,
+ UNDO_FLYFRMFMT_DESCRIPTION,
+ rFlyFrmFmt.GetObjDescription(),
+ sNewDescription ) );
+ }
+
+ rFlyFrmFmt.SetObjDescription( sNewDescription, true );
+
+ SetNoDrawUndoObj( bFormerIsNoDrawUndoObj );
+
+ SetModified();
+}
+// <--
/***************************************************************************
* Methode : BOOL SwDoc::SetFrmFmtToFly( SwFlyFrm&, SwFrmFmt& )
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index caa4987c6f04..9db1c98685f3 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -40,9 +40,7 @@
#include <svtools/itemiter.hxx>
#include <sfx2/app.hxx>
#include <svtools/misccfg.hxx>
-#ifndef _SVX_TSTPITEM_HXX //autogen
#include <svx/tstpitem.hxx>
-#endif
#include <svx/eeitem.hxx>
#include <svx/langitem.hxx>
#include <svx/lrspitem.hxx>
@@ -53,9 +51,7 @@
#include <svtools/zforlist.hxx>
#endif
#include <comphelper/processfactory.hxx>
-#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HDL
#include <com/sun/star/i18n/WordType.hdl>
-#endif
#include <fmtpdsc.hxx>
#include <fmthdft.hxx>
#include <fmtcntnt.hxx>
@@ -367,8 +363,8 @@ void SwDoc::RstTxtAttrs(const SwPaM &rRg, BOOL bInclRefToxMark )
if( DoesUndo() )
{
ClearRedo();
- SwUndoRstAttr* pUndo = new SwUndoRstAttr( rRg, RES_CHRFMT );
- pHst = pUndo->GetHistory();
+ SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, RES_CHRFMT );
+ pHst = &pUndo->GetHistory();
AppendUndo( pUndo );
}
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
@@ -452,11 +448,13 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
if( DoesUndo() )
{
ClearRedo();
- SwUndoRstAttr* pUndo = new SwUndoRstAttr( rRg,
+ SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg,
static_cast<USHORT>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL ));
if( pAttrs && pAttrs->Count() )
+ {
pUndo->SetAttrs( *pAttrs );
- pHst = pUndo->GetHistory();
+ }
+ pHst = &pUndo->GetHistory();
AppendUndo( pUndo );
}
@@ -505,9 +503,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
{
if( IsInRange( aCharFmtSetRange, pItem->Which() ))
{
-
- if( !pTNd->pSwpHints )
- pTNd->pSwpHints = new SwpHints;
+ pTNd->GetOrCreateSwpHints();
aCharSet.Put( *pItem );
@@ -556,14 +552,13 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
{
SwTxtAttr* pTAttr = pTNd->MakeTxtAttr( *pItem, 0,
pTNd->GetTxt().Len() );
- if( !pTNd->pSwpHints )
- pTNd->pSwpHints = new SwpHints;
- pTNd->pSwpHints->SwpHintsArr::Insert( pTAttr );
+ SwpHints & rHints = pTNd->GetOrCreateSwpHints();
+ rHints.SwpHintsArray::Insert( pTAttr );
if( pHst )
{
SwRegHistory aRegH( pTNd, *pTNd, pHst );
pTNd->ResetAttr( pItem->Which() );
- pHst->Add( pTAttr, aTmpEnd.GetIndex(), TRUE );
+ pHst->Add( pTAttr, aTmpEnd.GetIndex(), true );
}
else
pTNd->ResetAttr( pItem->Which() );
@@ -619,22 +614,22 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
const SfxPoolItem* pItem = aIter.FirstItem();
const USHORT nWhich = pItem->Which();
- if ( (RES_CHRATR_BEGIN <= nWhich && nWhich < RES_CHRATR_END) ||
- RES_TXTATR_CHARFMT == nWhich ||
- RES_TXTATR_INETFMT == nWhich ||
- RES_TXTATR_AUTOFMT == nWhich ||
- (RES_UNKNOWNATR_BEGIN <= nWhich && nWhich < RES_UNKNOWNATR_END) )
+ if ( isCHRATR(nWhich) ||
+ (RES_TXTATR_CHARFMT == nWhich) ||
+ (RES_TXTATR_INETFMT == nWhich) ||
+ (RES_TXTATR_AUTOFMT == nWhich) ||
+ isUNKNOWNATR(nWhich) )
{
pCharSet = &rChgSet;
bCharAttr = true;
}
- if ( (RES_PARATR_BEGIN <= nWhich && nWhich < RES_PARATR_END) ||
+ if ( isPARATR(nWhich)
// --> OD 2008-02-25 #refactorlists#
- (RES_PARATR_LIST_BEGIN <= nWhich && nWhich < RES_PARATR_LIST_END) ||
+ || isPARATR_LIST(nWhich)
// <--
- (RES_FRMATR_BEGIN <= nWhich && nWhich < RES_FRMATR_END) ||
- (RES_GRFATR_BEGIN <= nWhich && nWhich < RES_GRFATR_END) )
+ || isFRMATR(nWhich)
+ || isGRFATR(nWhich) )
{
pOtherSet = &rChgSet;
bOtherAttr = true;
@@ -672,7 +667,7 @@ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
bDelete = true;
}
- SwHistory* pHistory = pUndo ? pUndo->GetHistory() : 0;
+ SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0;
BOOL bRet = FALSE;
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
SwCntntNode* pNode = pStt->nNode.GetNode().GetCntntNode();
@@ -1183,13 +1178,17 @@ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt )
if( DoesUndo() )
{
ClearRedo();
- _UndoFmtAttr aTmp( rFmt );
+ SwUndoFmtAttrHelper aTmp( rFmt );
rFmt.SetFmtAttr( rSet );
- if( aTmp.pUndo )
- AppendUndo( aTmp.pUndo );
+ if ( aTmp.GetUndo() )
+ {
+ AppendUndo( aTmp.ReleaseUndo() );
+ }
}
else
+ {
rFmt.SetFmtAttr( rSet );
+ }
SetModified();
}
@@ -1271,30 +1270,34 @@ void SwDoc::SetDefault( const SfxItemSet& rSet )
GetAttrPool().SetPoolDefaultItem( *pItem );
aNew.Put( GetAttrPool().GetDefaultItem( nWhich ) );
- if( RES_CHRATR_BEGIN <= nWhich && RES_TXTATR_END > nWhich )
+ if (isCHRATR(nWhich) || isTXTATR(nWhich))
{
aCallMod.Add( pDfltTxtFmtColl );
aCallMod.Add( pDfltCharFmt );
bCheckSdrDflt = 0 != pSdrPool;
}
- else if ( ( RES_PARATR_BEGIN <= nWhich && RES_PARATR_END > nWhich ) ||
+ else if ( isPARATR(nWhich) ||
// --> OD 2008-02-25 #refactorlists#
- ( RES_PARATR_LIST_BEGIN <= nWhich && nWhich < RES_PARATR_LIST_END ) )
+ isPARATR_LIST(nWhich) )
// <--
{
aCallMod.Add( pDfltTxtFmtColl );
bCheckSdrDflt = 0 != pSdrPool;
}
- else if( RES_GRFATR_BEGIN <= nWhich && RES_GRFATR_END > nWhich )
+ else if (isGRFATR(nWhich))
+ {
aCallMod.Add( pDfltGrfFmtColl );
- else if( RES_FRMATR_BEGIN <= nWhich && RES_FRMATR_END > nWhich )
+ }
+ else if (isFRMATR(nWhich))
{
aCallMod.Add( pDfltGrfFmtColl );
aCallMod.Add( pDfltTxtFmtColl );
aCallMod.Add( pDfltFrmFmt );
}
- else if( RES_BOXATR_BEGIN <= nWhich && RES_BOXATR_END > nWhich )
+ else if (isBOXATR(nWhich))
+ {
aCallMod.Add( pDfltFrmFmt );
+ }
// copy also the defaults
if( bCheckSdrDflt )
@@ -2136,7 +2139,7 @@ void SwDoc::_CopyPageDescHeaderFooter( BOOL bCpyHeader,
aTmpIdx = *pSttNd->EndOfSectionNode();
rSrcNds._Copy( aRg, aTmpIdx );
aTmpIdx = *pSttNd;
- rSrcFmt.GetDoc()->_CopyFlyInFly( aRg, aTmpIdx );
+ rSrcFmt.GetDoc()->_CopyFlyInFly( aRg, 0, aTmpIdx );
pNewFmt->SetFmtAttr( SwFmtCntnt( pSttNd ));
}
else
@@ -2332,7 +2335,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus )
ClearRedo();
SwUndoMoveLeftMargin* pUndo = new SwUndoMoveLeftMargin( rPam, bRight,
bModulus );
- pHistory = pUndo->GetHistory();
+ pHistory = &pUndo->GetHistory();
AppendUndo( pUndo );
}
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index d11d846f0856..d9e711bd5fcf 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -74,7 +74,7 @@ SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
aFmt = rInfo.aFmt;
nFtnOffset = rInfo.nFtnOffset;
- bEndNote = rInfo.bEndNote;
+ m_bEndNote = rInfo.m_bEndNote;
sPrefix = rInfo.sPrefix;
sSuffix = rInfo.sSuffix;
return *this;
@@ -92,7 +92,7 @@ BOOL SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
GetFtnTxtColl() == rInfo.GetFtnTxtColl() &&
aFmt.GetNumberingType() == rInfo.aFmt.GetNumberingType() &&
nFtnOffset == rInfo.nFtnOffset &&
- bEndNote == rInfo.bEndNote &&
+ m_bEndNote == rInfo.m_bEndNote &&
sPrefix == rInfo.sPrefix &&
sSuffix == rInfo.sSuffix;
}
@@ -105,7 +105,7 @@ SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
aAnchorCharFmtDep( this, 0 ),
sPrefix( rInfo.sPrefix ),
sSuffix( rInfo.sSuffix ),
- bEndNote( TRUE ),
+ m_bEndNote( true ),
aFmt( rInfo.aFmt ),
nFtnOffset( rInfo.nFtnOffset )
{
@@ -125,7 +125,7 @@ SwEndNoteInfo::SwEndNoteInfo(SwTxtFmtColl *pFmt) :
aPageDescDep( this, 0 ),
aCharFmtDep( this, 0 ),
aAnchorCharFmtDep( this, 0 ),
- bEndNote( TRUE ),
+ m_bEndNote( true ),
nFtnOffset( 0 )
{
aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
@@ -136,7 +136,7 @@ SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const
if ( !aPageDescDep.GetRegisteredIn() )
{
SwPageDesc *pDesc = rDoc.GetPageDescFromPool( static_cast<sal_uInt16>(
- bEndNote ? RES_POOLPAGE_ENDNOTE : RES_POOLPAGE_FOOTNOTE ) );
+ m_bEndNote ? RES_POOLPAGE_ENDNOTE : RES_POOLPAGE_FOOTNOTE ) );
pDesc->Add( &((SwClient&)aPageDescDep) );
}
return (SwPageDesc*)aPageDescDep.GetRegisteredIn();
@@ -157,7 +157,7 @@ SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const
if ( !aCharFmtDep.GetRegisteredIn() )
{
SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
- bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
+ m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
pFmt->Add( &((SwClient&)aCharFmtDep) );
}
return (SwCharFmt*)aCharFmtDep.GetRegisteredIn();
@@ -174,7 +174,7 @@ SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const
if( !aAnchorCharFmtDep.GetRegisteredIn() )
{
SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
- bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
+ m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
pFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
}
return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn();
@@ -203,8 +203,10 @@ void SwEndNoteInfo::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
{
SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
- if ( rFtn.IsEndNote() == bEndNote)
+ if ( rFtn.IsEndNote() == m_bEndNote )
+ {
pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
+ }
}
}
else
@@ -239,7 +241,7 @@ SwFtnInfo::SwFtnInfo(const SwFtnInfo& rInfo) :
ePos( rInfo.ePos ),
eNum( rInfo.eNum )
{
- bEndNote = FALSE;
+ m_bEndNote = false;
}
SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
@@ -248,7 +250,7 @@ SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
eNum( FTNNUM_DOC )
{
aFmt.SetNumberingType(SVX_NUM_ARABIC);
- bEndNote = FALSE;
+ m_bEndNote = false;
}
/*********************** SwDoc ***************************/
@@ -263,7 +265,7 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
if( DoesUndo() )
{
ClearRedo();
- AppendUndo( new SwUndoFtnInfo( rOld ) );
+ AppendUndo( new SwUndoFootNoteInfo( rOld ) );
}
BOOL bFtnPos = rInfo.ePos != rOld.ePos;
@@ -384,8 +386,8 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
}
-BOOL SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
- USHORT nNumber, BOOL bIsEndNote )
+bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
+ sal_uInt16 nNumber, bool bIsEndNote )
{
SwFtnIdxs& rFtnArr = GetFtnIdxs();
@@ -398,11 +400,11 @@ BOOL SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
USHORT nPos;
rFtnArr.SeekEntry( pStt->nNode, &nPos );
- SwUndoChgFtn* pUndo = 0;
+ SwUndoChangeFootNote* pUndo = 0;
if( DoesUndo() )
{
ClearRedo();
- pUndo = new SwUndoChgFtn( rPam, rNumStr, nNumber, bIsEndNote );
+ pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote );
}
SwTxtFtn* pTxtFtn;
@@ -423,8 +425,10 @@ BOOL SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
rFtn.IsEndNote() != bIsEndNote )
{
bChg = TRUE;
- if( pUndo )
- pUndo->GetHistory()->Add( *pTxtFtn );
+ if ( pUndo )
+ {
+ pUndo->GetHistory().Add( *pTxtFtn );
+ }
pTxtFtn->SetNumber( nNumber, &rNumStr );
if( rFtn.IsEndNote() != bIsEndNote )
@@ -453,8 +457,10 @@ BOOL SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
rFtn.IsEndNote() != bIsEndNote )
{
bChg = TRUE;
- if( pUndo )
- pUndo->GetHistory()->Add( *pTxtFtn );
+ if ( pUndo )
+ {
+ pUndo->GetHistory().Add( *pTxtFtn );
+ }
pTxtFtn->SetNumber( nNumber, &rNumStr );
if( rFtn.IsEndNote() != bIsEndNote )
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index a4bfb749174c..b340b1ce45fb 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -307,7 +307,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath,
pDoc->GetNodes().Delete( aIdx, 1 );
// alle Flys in dem Bereich
- _CopyFlyInFly( aRg, aIdx );
+ _CopyFlyInFly( aRg, 0, aIdx );
// und noch alle Bookmarks
@@ -653,7 +653,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel )
pDoc->GetNodes().Delete( aIdx, 1 );
// alle Flys in dem Bereich
- _CopyFlyInFly( aRg, aIdx );
+ _CopyFlyInFly( aRg, 0, aIdx );
// und noch alle Bookmarks
diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx
index 4dac390ece46..2f3f58e76f3b 100644
--- a/sw/source/core/doc/docglos.cxx
+++ b/sw/source/core/doc/docglos.cxx
@@ -183,7 +183,7 @@ BOOL SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry,
SwDontExpandItem aACD;
aACD.SaveDontExpandItems( rInsPos );
- pGDoc->Copy( aCpyPam, rInsPos );
+ pGDoc->Copy( aCpyPam, rInsPos, false );
aACD.RestoreDontExpandItems( rInsPos );
if( pShell )
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index ae4945b8137c..45ca5dd4350f 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -507,7 +507,7 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
// sorge dafuer das auch Fly's in Fly's kopiert werden
aIdx = *pSttNd->EndOfSectionNode();
- pSrcDoc->CopyWithFlyInFly( aRg, aIdx, sal_False, sal_True, sal_True );
+ pSrcDoc->CopyWithFlyInFly( aRg, 0, aIdx, sal_False, sal_True, sal_True );
}
else
{
@@ -885,7 +885,7 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht.
do {
if( pTmp->HasMark() &&
*pTmp->GetPoint() != *pTmp->GetMark() )
- Copy( *pTmp, aPos );
+ Copy( *pTmp, aPos, false );
} while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ) );
mbCopyIsMove = bOldFlag;
mbUndo = bOldUndo;
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 5491e761ca3f..a38cf8615753 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -32,6 +32,7 @@
#include "precompiled_sw.hxx"
#define ROLBCK_HISTORY_ONLY // Der Kampf gegen die CLOOK's
#include <doc.hxx>
+#include <dcontact.hxx>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
@@ -46,12 +47,9 @@
#include <sfx2/docfile.hxx>
#include <sfx2/frame.hxx>
-#ifndef _SFXMACITEM_HXX //autogen
- #include <svtools/macitem.hxx>
-#endif
-#ifndef _SVX_SVXIDS_HRC
+#include <svtools/macitem.hxx>
#include <svx/svxids.hrc>
-#endif
+#include <svx/svdogrp.hxx>
#include <svx/linkmgr.hxx>
#include <svx/forbiddencharacterstable.hxx>
#include <svtools/zforlist.hxx>
@@ -79,18 +77,12 @@
#include <frmfmt.hxx>
#include <rolbck.hxx> // Undo-Attr, SwHistory
#include <poolfmt.hxx> // fuer die Pool-Vorlage
-#ifndef _DBMGR_HXX
#include <dbmgr.hxx>
-#endif
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <acorrect.hxx> // fuer die autom. Aufnahme von Ausnahmen
#include <visiturl.hxx> // fuer die URL-Change Benachrichtigung
#include <docary.hxx>
-#ifndef _LINEINFO_HXX
#include <lineinfo.hxx>
-#endif
#include <drawdoc.hxx>
#include <linkenum.hxx>
#include <fldupde.hxx>
@@ -105,13 +97,11 @@
#include <istyleaccess.hxx>
#include <swstylemanager.hxx>
#include <IGrammarContact.hxx>
+#include <tblsel.hxx>
#include <MarkManager.hxx>
-
#include <unochart.hxx>
-#ifndef _CMDID_H
#include <cmdid.h> // fuer den dflt - Printer in SetJob
-#endif
// --> OD 2006-04-19 #b6375613#
@@ -119,7 +109,6 @@
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-using namespace ::com::sun::star;
// <--
// --> OD 2007-03-16 #i73788#
@@ -133,6 +122,10 @@ using namespace ::com::sun::star;
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <sfx2/Metadatable.hxx>
+
+
+using namespace ::com::sun::star;
using namespace ::com::sun::star::document;
const sal_Char __FAR_DATA sFrmFmtStr[] = "Frameformat";
@@ -271,6 +264,7 @@ SwDoc::SwDoc() :
// --> OD 2007-10-31 #i83479#
mpListItemsList( new tImplSortedNodeNumList() ),
// <--
+ m_pXmlIdRegistry(),
nUndoPos( 0 ),
nUndoSavePos( 0 ),
nUndoCnt( 0 ),
@@ -284,7 +278,6 @@ SwDoc::SwDoc() :
mIdleBlockCount(0),
nLockExpFld( 0 ),
mbReadlineChecked(false),
- mbWinEncryption(sal_False),
// --> OD 2005-02-11 #i38810#
mbLinksUpdated( sal_False ),
mbClipBoard( false ),
@@ -438,22 +431,7 @@ SwDoc::SwDoc() :
pNewDBMgr = new SwNewDBMgr;
// create TOXTypes
- ShellResource* pShellRes = ViewShell::GetShellRes();
-
- SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName );
- pTOXTypes->Insert( pNew, pTOXTypes->Count() );
- pNew = new SwTOXType(TOX_INDEX, pShellRes->aTOXIndexName );
- pTOXTypes->Insert( pNew, pTOXTypes->Count() );
- pNew = new SwTOXType(TOX_USER, pShellRes->aTOXUserName );
- pTOXTypes->Insert( pNew, pTOXTypes->Count() );
- pNew = new SwTOXType(TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName );
- pTOXTypes->Insert( pNew, pTOXTypes->Count() );
- pNew = new SwTOXType(TOX_OBJECTS, pShellRes->aTOXObjectsName );
- pTOXTypes->Insert( pNew, pTOXTypes->Count() );
- pNew = new SwTOXType(TOX_TABLES, pShellRes->aTOXTablesName );
- pTOXTypes->Insert( pNew, pTOXTypes->Count() );
- pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName );
- pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ InitTOXTypes();
// --> OD 2008-03-07 #refactorlists#
// pass empty item set containing the paragraph's list attributes
@@ -824,7 +802,7 @@ void SwDoc::ClearDoc()
// in den BookMarks sind Indizies auf den Content. Diese muessen vorm
// loesche der Nodes geloescht werden.
pMarkManager->clearAllMarks();
- pTOXTypes->DeleteAndDestroy( 0, pTOXTypes->Count() );
+ InitTOXTypes();
// create a dummy pagedesc for the layout
sal_uInt16 nDummyPgDsc = MakePageDesc( String::CreateFromAscii( "?DUMMY?" ));
@@ -1049,3 +1027,400 @@ void SwDoc::SetApplyWorkaroundForB6375613( bool p_bApplyWorkaroundForB6375613 )
}
}
// <--
+
+::sfx2::IXmlIdRegistry&
+SwDoc::GetXmlIdRegistry()
+{
+ // UGLY: this relies on SetClipBoard being called before GetXmlIdRegistry!
+ if (!m_pXmlIdRegistry.get())
+ {
+ m_pXmlIdRegistry.reset( ::sfx2::createXmlIdRegistry( IsClipBoard() ) );
+ }
+ return *m_pXmlIdRegistry;
+}
+
+void SwDoc::InitTOXTypes()
+{
+ ShellResource* pShellRes = ViewShell::GetShellRes();
+ SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_INDEX, pShellRes->aTOXIndexName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_USER, pShellRes->aTOXUserName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_OBJECTS, pShellRes->aTOXObjectsName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_TABLES, pShellRes->aTOXTablesName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+}
+
+/*-- 08.05.2009 10:07:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwDoc* SwDoc::CreateCopy() const
+{
+ SwDoc* pRet = new SwDoc;
+ //copy settings
+/*
+ //aNodes( this ),
+ //aUndoNodes( this ),
+ mpAttrPool(new SwAttrPool(this)),*/
+ USHORT __FAR_DATA aRangeOfDefaults[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ // --> OD 2008-02-25 #refactorlists##
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ // <--
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+ };
+
+ SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults );
+
+ USHORT nWhich;
+ USHORT nRange = 0;
+ while( aRangeOfDefaults[nRange] != 0)
+ {
+ for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich )
+ {
+ const SfxPoolItem& rSourceAttr = mpAttrPool->GetDefaultItem( nWhich );
+ if( rSourceAttr != pRet->mpAttrPool->GetDefaultItem( nWhich ) )
+ aNewDefaults.Put( rSourceAttr );
+ }
+ nRange += 2;
+ }
+ if( aNewDefaults.Count() )
+ pRet->SetDefault( aNewDefaults );
+
+ /*
+ pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
+ pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),
+ pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ),
+ pDfltCharFmt( new SwCharFmt( GetAttrPool(), sCharFmtStr, 0 ) ),
+ pDfltTxtFmtColl( new SwTxtFmtColl( GetAttrPool(), sTxtCollStr ) ),
+ pDfltGrfFmtColl( new SwGrfFmtColl( GetAttrPool(), sGrfCollStr ) ),
+ pFrmFmtTbl( new SwFrmFmts() ),
+ pCharFmtTbl( new SwCharFmts() ),
+ pSpzFrmFmtTbl( new SwSpzFrmFmts() ),
+ pSectionFmtTbl( new SwSectionFmts() ),
+ pTblFrmFmtTbl( new SwFrmFmts() ),
+ pTxtFmtCollTbl( new SwTxtFmtColls() ),
+ pGrfFmtCollTbl( new SwGrfFmtColls() ),
+ pBookmarkTbl( new SwBookmarks( 0, 16 ) ),
+ pTOXTypes( new SwTOXTypes() ),
+ pDefTOXBases( new SwDefTOXBase_Impl() ),
+ pLayout( 0 ), // Rootframe des spezifischen Layouts.
+ pDrawModel( 0 ),
+ pUndos( new SwUndos( 0, 20 ) ),
+ pUpdtFlds( new SwDocUpdtFld() ),
+ pFldTypes( new SwFldTypes() ),
+ pVirDev( 0 ),
+ pPrt( 0 ),
+ pPrtData( 0 ),
+ pGlossaryDoc( 0 ),
+ pOutlineRule( 0 ),
+ pFtnInfo( new SwFtnInfo ),
+ pEndNoteInfo( new SwEndNoteInfo ),
+ pLineNumberInfo( new SwLineNumberInfo ),
+ pFtnIdxs( new SwFtnIdxs ),
+ pDocStat( new SwDocStat ),
+ pDocShell( 0 ),
+ pDocShRef( 0 ),
+ pLinkMgr( new SvxLinkManager( 0 ) ),
+ pACEWord( 0 ),
+ pURLStateChgd( 0 ),
+ pNumberFormatter( 0 ),
+ pNumRuleTbl( new SwNumRuleTbl ),
+ // --> OD 2008-03-26 #refactorlists#
+ maLists(),
+ maListStyleLists(),
+ // <--
+ pRedlineTbl( new SwRedlineTbl ),
+ pAutoFmtRedlnComment( 0 ),
+ pUnoCrsrTbl( new SwUnoCrsrTbl( 0, 16 ) ),
+ pPgPViewPrtData( 0 ),
+ pExtInputRing( 0 ),
+ pLayouter( 0 ),
+ // --> OD 2008-03-07 #refactorlists#
+ pStyleAccess( 0 ),
+ // <--
+ pLayoutCache( 0 ),
+ pUnoCallBack(new SwUnoCallBack(0)),
+ mpGrammarContact( 0 ),
+ aChartDataProviderImplRef(),
+ pChartControllerHelper( 0 ),
+ // --> OD 2007-10-31 #i83479#
+ mpListItemsList( new tImplSortedNodeNumList() ),
+ // <--
+ nUndoPos( 0 ),
+ nUndoSavePos( 0 ),
+ nUndoCnt( 0 ),
+ nUndoSttEnd( 0 ),
+ nAutoFmtRedlnCommentNo( 0 ),
+ nLinkUpdMode( GLOBALSETTING ),
+ eFldUpdMode( AUTOUPD_GLOBALSETTING ),
+ eRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)),
+ eChrCmprType( CHARCOMPRESS_NONE ),
+ mReferenceCount(0),
+ mIdleBlockCount(0),
+ nLockExpFld( 0 ),
+ mbReadlineChecked(false),
+ mbWinEncryption(sal_False),
+ // --> OD 2005-02-11 #i38810#
+ mbLinksUpdated( sal_False ),
+ mbClipBoard( false ),
+ mbColumnSelection( false ),
+ // i#78591#
+ mbProtectForm(false),*/
+ pRet->n32DummyCompatabilityOptions1 = n32DummyCompatabilityOptions1;
+ pRet->n32DummyCompatabilityOptions2 = n32DummyCompatabilityOptions2;
+ /*
+ mbStartIdleTimer(sal_False)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" );
+
+ mbGlossDoc =
+ mbModified =
+ mbDtor =
+ mbUndo =
+ mbPageNums =
+ mbLoaded =
+ mbUpdateExpFld =
+ mbNewDoc =
+ mbCopyIsMove =
+ mbNoDrawUndoObj =
+ mbBrowseMode =
+ mbInReading =
+ mbInXMLImport =
+ mbUpdateTOX =
+ mbInLoadAsynchron =
+ mbHTMLMode =
+ mbInCallModified =
+ mbIsGlobalDoc =
+ mbGlblDocSaveLinks =
+ mbIsLabelDoc =
+ mbIsAutoFmtRedline =
+ mbOLEPrtNotifyPending =
+ mbAllOLENotify =
+ mbIsRedlineMove =
+ mbInsOnlyTxtGlssry =
+ mbContains_MSVBasic =
+ mbKernAsianPunctuation =
+#ifndef PRODUCT
+ mbXMLExport =
+#endif
+ // --> OD 2006-03-21 #b6375613#
+ mbApplyWorkaroundForB6375613 =
+ // <--
+ false;
+
+ mbGroupUndo =
+ mbNewFldLst =
+ mbVisibleLinks =
+ mbPurgeOLE =
+ true;
+
+ //
+ // COMPATIBILITY FLAGS START
+ //
+
+ // Note: Any non-hidden compatibility flag should obtain its default
+ // by asking SvtCompatibilityOptions, see below.
+ //
+ const SvtCompatibilityOptions aOptions;
+ */
+ pRet->mbParaSpaceMax = mbParaSpaceMax ;
+ pRet->mbParaSpaceMaxAtPages = mbParaSpaceMaxAtPages ;
+ pRet->mbTabCompat = mbTabCompat ;
+ pRet->mbUseVirtualDevice = mbUseVirtualDevice ;
+ pRet->mbAddExternalLeading = mbAddExternalLeading ;
+ pRet->mbOldLineSpacing = mbOldLineSpacing ;
+ pRet->mbAddParaSpacingToTableCells = mbAddParaSpacingToTableCells ;
+ pRet->mbUseFormerObjectPos = mbUseFormerObjectPos ;
+ pRet->mbUseFormerTextWrapping = mbUseFormerTextWrapping ;
+ pRet->mbConsiderWrapOnObjPos = mbConsiderWrapOnObjPos ;
+ pRet->mbAddFlyOffsets = mbAddFlyOffsets ;
+ pRet->mbOldNumbering = mbOldNumbering ;
+ pRet->mbUseHiResolutionVirtualDevice = mbUseHiResolutionVirtualDevice ;
+ pRet->mbIgnoreFirstLineIndentInNumbering = mbIgnoreFirstLineIndentInNumbering ;
+ pRet->mbDoNotJustifyLinesWithManualBreak = mbDoNotJustifyLinesWithManualBreak ;
+ pRet->mbDoNotResetParaAttrsForNumFont = mbDoNotResetParaAttrsForNumFont ;
+ pRet->mbOutlineLevelYieldsOutlineRule = mbOutlineLevelYieldsOutlineRule ;
+ pRet->mbTableRowKeep = mbTableRowKeep ;
+ pRet->mbIgnoreTabsAndBlanksForLineCalculation = mbIgnoreTabsAndBlanksForLineCalculation ;
+ pRet->mbDoNotCaptureDrawObjsOnPage = mbDoNotCaptureDrawObjsOnPage ;
+ pRet->mbClipAsCharacterAnchoredWriterFlyFrames= mbClipAsCharacterAnchoredWriterFlyFrames;
+ pRet->mbUnixForceZeroExtLeading = mbUnixForceZeroExtLeading ;
+ pRet->mbOldPrinterMetrics = mbOldPrinterMetrics ;
+ pRet->mbTabRelativeToIndent = mbTabRelativeToIndent ;
+ pRet->mbTabAtLeftIndentForParagraphsInList = mbTabAtLeftIndentForParagraphsInList ;
+
+ //
+ // COMPATIBILITY FLAGS END
+ //
+ /*
+ pMacroTable = new SvxMacroTableDtor;
+
+ mpGrammarContact = ::createGrammarContact();
+
+ // Formate
+ pFrmFmtTbl->Insert(pDfltFrmFmt, 0 );
+ pCharFmtTbl->Insert(pDfltCharFmt, 0 );
+
+ // FmtColls
+ // TXT
+ pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 );
+ // GRF
+ pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 );
+
+ // PageDesc, EmptyPageFmt und ColumnFmt anlegen
+ if ( !aPageDescs.Count() )
+ GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+
+ //Leere Seite Einstellen.
+ pEmptyPageFmt->SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE ) );
+ //BodyFmt fuer Spalten Einstellen.
+ pColumnContFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
+
+ _InitFieldTypes();
+
+ // lege (fuer die Filter) eine Default-OutlineNumRule an
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode(),
+ // <--
+ OUTLINE_RULE );
+ // <--
+ // #115901#
+ AddNumRule(pOutlineRule);
+ // --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
+ pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
+ // <--
+
+ new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl );
+ new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ),
+ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
+
+ // den eigenen IdleTimer setzen
+ aIdleTimer.SetTimeout( 600 );
+ aIdleTimer.SetTimeoutHdl( LINK(this, SwDoc, DoIdleJobs) );
+
+ aOLEModifiedTimer.SetTimeout( 1000 );
+ aOLEModifiedTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateModifiedOLE ));
+
+ // DBMgr anlegen
+ pNewDBMgr = new SwNewDBMgr;
+
+ // create TOXTypes
+ ShellResource* pShellRes = ViewShell::GetShellRes();
+
+ SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_INDEX, pShellRes->aTOXIndexName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_USER, pShellRes->aTOXUserName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_OBJECTS, pShellRes->aTOXObjectsName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_TABLES, pShellRes->aTOXTablesName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+
+ {
+ SfxItemSet aIgnorableParagraphItems( GetAttrPool(),
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ 0 );
+ pStyleAccess = createStyleManager( &aIgnorableParagraphItems );
+ }
+
+ ResetModified();
+
+*/
+ //copy content
+ pRet->Paste( *this );
+ return pRet;
+}
+/*-- 08.05.2009 10:52:40---------------------------------------------------
+ copy document content - code from SwFEShell::Paste( SwDoc* , BOOL )
+ -----------------------------------------------------------------------*/
+void SwDoc::Paste( const SwDoc& rSource )
+{
+// this has to be empty const USHORT nStartPageNumber = GetPhyPageNum();
+ // until the end of the NodesArray
+ SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 2 );
+ SwPaM aCpyPam( aSourceIdx ); //DocStart
+ SwNodeIndex aTargetIdx( GetNodes().GetEndOfExtras(), 2 );
+ SwPaM aInsertPam( aTargetIdx ); //replaces PCURCRSR from SwFEShell::Paste()
+
+
+ aCpyPam.SetMark();
+ aCpyPam.Move( fnMoveForward, fnGoDoc );
+
+ this->StartUndo( UNDO_INSGLOSSARY, NULL );
+ this->LockExpFlds();
+
+ {
+ SwPosition& rInsPos = *aInsertPam.GetPoint();
+ //find out if the clipboard document starts with a table
+ bool bStartWithTable = 0 != aCpyPam.Start()->nNode.GetNode().FindTableNode();
+ SwPosition aInsertPosition( rInsPos );
+
+ {
+ SwNodeIndex aIndexBefore(rInsPos.nNode);
+
+ aIndexBefore--;
+
+ rSource.Copy( aCpyPam, rInsPos, true );
+
+ {
+ aIndexBefore++;
+ SwPaM aPaM(SwPosition(aIndexBefore, 0),
+ SwPosition(rInsPos.nNode, 0));
+
+ MakeUniqueNumRules(aPaM);
+ }
+ }
+
+ //TODO: Is this necessary here? SaveTblBoxCntnt( &rInsPos );
+ if(/*bIncludingPageFrames && */bStartWithTable)
+ {
+ //remove the paragraph in front of the table
+ SwPaM aPara(aInsertPosition);
+ this->DelFullPara(aPara);
+ }
+ //additionally copy page bound frames
+ if( /*bIncludingPageFrames && */rSource.GetSpzFrmFmts()->Count() )
+ {
+ for ( USHORT i = 0; i < rSource.GetSpzFrmFmts()->Count(); ++i )
+ {
+ BOOL bInsWithFmt = TRUE;
+ const SwFrmFmt& rCpyFmt = *(*rSource.GetSpzFrmFmts())[i];
+ if( bInsWithFmt )
+ {
+ SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+ if( FLY_PAGE == aAnchor.GetAnchorId() )
+ {
+ aAnchor.SetPageNum( aAnchor.GetPageNum() + /*nStartPageNumber - */1 );
+ }
+ else
+ continue;
+ this->CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+ }
+ }
+ }
+ }
+
+ this->EndUndo( UNDO_INSGLOSSARY, NULL );
+
+ UnlockExpFlds();
+ UpdateFlds(NULL, false);
+}
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index cece34f7aa97..0d5fb13e7670 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1080,10 +1080,8 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
// <--
}
- // --> OD 2006-01-13 #i60395#
- // It's not allowed to apply the outline numbering rule as hard attribute
- // to document content - typically paragraphs.
- if ( bSetItem && pNew != GetOutlineNumRule() )
+ // --> OD 2009-08-18 #i103817#
+ if ( bSetItem )
// <--
{
Insert( rPam, SwNumRuleItem( pNew->GetName() ), 0 );
@@ -2094,6 +2092,10 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv )
}
else
{
+ //Impossible to move to negative index
+ if( ULONG(abs( nOffset )) > nStIdx)
+ return FALSE;
+
nInEndIdx = nStIdx - 1;
nStIdx += nOffset;
}
@@ -2273,7 +2275,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv )
}
}
- Copy( aPam, aInsPos );
+ Copy( aPam, aInsPos, false );
if( bDelLastPara )
{
// dann muss der letzte leere Node wieder entfernt werden
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 5f03da022d63..1d7d558b4d45 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -2678,7 +2678,8 @@ BOOL SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, USHORT* pInsPos )
{ // but our Mark was outside the table => Correction
do
{
- *pNew->GetPoint() = *pTab; // We want to be before the table
+ // We want to be before the table
+ *pNew->GetPoint() = SwPosition(*pTab);
pC = GoPreviousNds( &pNew->GetPoint()->nNode, FALSE ); // here we are.
if( pC )
pNew->GetPoint()->nContent.Assign( pC, 0 );
@@ -3418,7 +3419,7 @@ void SwRedline::CopyToSection()
SwNodeIndex aNdIdx( *pSttNd, 1 );
SwTxtNode* pTxtNd = aNdIdx.GetNode().GetTxtNode();
SwPosition aPos( aNdIdx, SwIndex( pTxtNd ));
- pDoc->Copy( *this, aPos );
+ pDoc->Copy( *this, aPos, false );
// JP 08.10.98: die Vorlage vom EndNode ggfs. mit uebernehmen
// - ist im Doc::Copy nicht erwuenscht
@@ -3443,13 +3444,13 @@ void SwRedline::CopyToSection()
if( pCEndNd )
{
SwPosition aPos( *pSttNd->EndOfSectionNode() );
- pDoc->Copy( *this, aPos );
+ pDoc->Copy( *this, aPos, false );
}
else
{
SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() );
SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 );
- pDoc->CopyWithFlyInFly( aRg, aInsPos );
+ pDoc->CopyWithFlyInFly( aRg, 0, aInsPos );
}
}
pCntntSect = new SwNodeIndex( *pSttNd );
@@ -3487,7 +3488,12 @@ void SwRedline::DelCopyOfSection()
}
if( pCSttNd && pCEndNd )
- pDoc->DeleteAndJoin( aPam );
+ {
+ // --> OD 2009-08-20 #i100466#
+ // force a <join next> on <delete and join> operation
+ pDoc->DeleteAndJoin( aPam, true );
+ // <--
+ }
else if( pCSttNd || pCEndNd )
{
if( pCSttNd && !pCEndNd )
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index ba65939c5a91..0d9607b290c6 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -195,12 +195,12 @@ void SwDoc::Delete( const SwTOXMark* pTOXMark )
{
// fuers Undo die Attribute sichern
ClearRedo();
- SwUndoRstAttr* pUndo = new SwUndoRstAttr( *this, SwPosition( rTxtNd,
- SwIndex( &rTxtNd, *pTxtTOXMark->GetStart() ) ),
- RES_TXTATR_TOXMARK );
+ SwUndoResetAttr* pUndo = new SwUndoResetAttr(
+ SwPosition( rTxtNd, SwIndex( &rTxtNd, *pTxtTOXMark->GetStart() ) ),
+ RES_TXTATR_TOXMARK );
AppendUndo( pUndo );
- SwRegHistory aRHst( rTxtNd, pUndo->GetHistory() );
+ SwRegHistory aRHst( rTxtNd, &pUndo->GetHistory() );
rTxtNd.GetpSwpHints()->Register( &aRHst );
rTxtNd.Delete( const_cast<SwTxtTOXMark*>( pTxtTOXMark ), TRUE );
if( rTxtNd.GetpSwpHints() )
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 889cb7beb298..301dd08fa560 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -281,7 +281,7 @@ void SwNoTxtFrm::Paint( const SwRect &rRect ) const
if ( pSh->GetWin() && !pSh->IsPreView() )
{
const SwNoTxtNode* pNd = GetNode()->GetNoTxtNode();
- String aTxt( pNd->GetAlternateText() );
+ String aTxt( pNd->GetTitle() );
if ( !aTxt.Len() && pNd->IsGrfNode() )
GetRealURL( *(SwGrfNode*)pNd, aTxt );
if( !aTxt.Len() )
@@ -788,7 +788,7 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
break;
default:
- if( !pNew || RES_GRFATR_BEGIN > nWhich || nWhich >= RES_GRFATR_END )
+ if ( !pNew || !isGRFATR(nWhich) )
return;
}
@@ -799,6 +799,34 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
}
}
+void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, OutputDevice* pOut )
+{
+ if(!pOut)
+ return;
+ Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() );
+ Rectangle aNewPxRect( aPxRect );
+ while( aNewPxRect.Left() < aPxRect.Left() )
+ {
+ rAlignedGrfArea.Left( rAlignedGrfArea.Left()+1 );
+ aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
+ }
+ while( aNewPxRect.Top() < aPxRect.Top() )
+ {
+ rAlignedGrfArea.Top( rAlignedGrfArea.Top()+1 );
+ aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
+ }
+ while( aNewPxRect.Bottom() > aPxRect.Bottom() )
+ {
+ rAlignedGrfArea.Bottom( rAlignedGrfArea.Bottom()-1 );
+ aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
+ }
+ while( aNewPxRect.Right() > aPxRect.Right() )
+ {
+ rAlignedGrfArea.Right( rAlignedGrfArea.Right()-1 );
+ aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
+ }
+}
+
// Ausgabe der Grafik. Hier wird entweder eine QuickDraw-Bmp oder
// eine Grafik vorausgesetzt. Ist nichts davon vorhanden, wird
// eine Ersatzdarstellung ausgegeben.
@@ -816,15 +844,30 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
const BOOL bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) ||
pOut->GetConnectMetaFile();
+ const bool bIsChart = pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() );
+
/// OD 25.09.2002 #99739# - calculate aligned rectangle from parameter <rGrfArea>.
/// Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
/// the following code.
SwRect aAlignedGrfArea = rGrfArea;
::SwAlignRect( aAlignedGrfArea, pShell );
- /// OD 25.09.2002 #99739#
- /// Because for drawing a graphic left-top-corner and size coordinations are
- /// used, these coordinations have to be determined on pixel level.
- ::SwAlignGrfRect( &aAlignedGrfArea, *pOut );
+
+ if( !bIsChart )
+ {
+ /// OD 25.09.2002 #99739#
+ /// Because for drawing a graphic left-top-corner and size coordinations are
+ /// used, these coordinations have to be determined on pixel level.
+ ::SwAlignGrfRect( &aAlignedGrfArea, *pOut );
+ }
+ else //if( bIsChart )
+ {
+ //#i78025# charts own borders are not completely visible
+ //the above pixel correction is not correct - at least not for charts
+ //so a different pixel correction is choosen here
+ //this might be a good idea for all other OLE objects also,
+ //but as I cannot oversee the consequences I fix it only for charts for now
+ lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut );
+ }
if( pGrfNd )
{
@@ -863,7 +906,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
pGrfNd->TriggerAsyncRetrieveInputStream();
// <--
}
- String aTxt( pGrfNd->GetAlternateText() );
+ String aTxt( pGrfNd->GetTitle() );
if ( !aTxt.Len() )
GetRealURL( *pGrfNd, aTxt );
::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, FALSE );
@@ -928,7 +971,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
((SwNoTxtFrm*)this)->nWeight = -1;
String aText;
if ( !nResId &&
- !(aText = pGrfNd->GetAlternateText()).Len() &&
+ !(aText = pGrfNd->GetTitle()).Len() &&
(!GetRealURL( *pGrfNd, aText ) || !aText.Len()))
{
nResId = STR_COMCORE_READERROR;
@@ -946,9 +989,8 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( bForceSwap )
pGrfNd->SwapOut();
}
- else if( pOLENd
+ else if( bIsChart
//charts must be painted resolution dependent!! #i82893#, #i75867#
- && ChartPrettyPainter::IsChart(pOLENd->GetOLEObj().GetObject())
&& ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( pOut )
&& svt::EmbeddedObjectRef::TryRunningState( pOLENd->GetOLEObj().GetOleRef() )
&& ChartPrettyPainter::DoPrettyPaintChart( uno::Reference< frame::XModel >(
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index 5df20bfa2a74..8e0469fe5d87 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -299,9 +299,12 @@ void SwServerObject::SetNoServer()
if(eType == BOOKMARK_SERVER && CNTNT_TYPE.pBkmk)
{
::sw::mark::DdeBookmark* const pDdeBookmark = dynamic_cast< ::sw::mark::DdeBookmark* >(CNTNT_TYPE.pBkmk);
- if(pDdeBookmark) pDdeBookmark->SetRefObject(NULL);
+ if(pDdeBookmark)
+ {
+ CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER;
+ pDdeBookmark->SetRefObject(NULL);
+ }
}
- CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER;
}
void SwServerObject::SetDdeBookmark( ::sw::mark::IMark& rBookmark)
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 741911c743b0..5eea4c33247c 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -567,7 +567,7 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
SwNodeIndex aSavePos( aInsIdx, -1 );
if( pRg.get() )
- pCpyDoc->CopyWithFlyInFly( *pRg, aInsIdx, FALSE );
+ pCpyDoc->CopyWithFlyInFly( *pRg, 0, aInsIdx, FALSE );
else
pDoc->GetNodes().MakeTxtNode( aInsIdx, (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
aSavePos++;
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index d8da6b6b7612..a8cf3f819444 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -360,11 +360,18 @@ BOOL lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara )
SwTableBoxFmt* pNewFmt = (SwTableBoxFmt*)pBox->ClaimFrmFmt();
// suche die selektierten Boxen in der Line:
- _FndLine* pCmpLine;
+ _FndLine* pCmpLine = NULL;
SwFmtFrmSize aFrmSz( pNewFmt->GetFrmSize() );
- if( pBox->GetTabLines().Count() &&
- ( pCmpLine = rpFndBox->GetLines()[ 0 ])->GetBoxes().Count()
- != pCmpLine->GetLine()->GetTabBoxes().Count() )
+
+ bool bDiffCount = false;
+ if( pBox->GetTabLines().Count() )
+ {
+ pCmpLine = rpFndBox->GetLines()[ 0 ];
+ if ( pCmpLine->GetBoxes().Count() != pCmpLine->GetLine()->GetTabBoxes().Count() )
+ bDiffCount = true;
+ }
+
+ if( bDiffCount )
{
// die erste Line sollte reichen
_FndBoxes& rFndBoxes = pCmpLine->GetBoxes();
@@ -2103,7 +2110,7 @@ BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara )
*rpFndBox->GetBox()->GetSttNd()->EndOfSectionNode() );
SwNodeIndex aInsIdx( *pBox->GetSttNd(), 1 );
- pFromDoc->CopyWithFlyInFly( aCpyRg, aInsIdx, FALSE );
+ pFromDoc->CopyWithFlyInFly( aCpyRg, 0, aInsIdx, FALSE );
// den initialen TextNode loeschen
pCpyPara->pDoc->GetNodes().Delete( aInsIdx, 1 );
}
diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx
index 2a909ac3c32f..d5d0832c0a20 100644
--- a/sw/source/core/doc/visiturl.cxx
+++ b/sw/source/core/doc/visiturl.cxx
@@ -41,9 +41,7 @@
#include <hints.hxx>
#include <ndtxt.hxx>
#include <editsh.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
SwURLStateChanged::SwURLStateChanged( const SwDoc* pD )
@@ -92,7 +90,7 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint )
bUnLockView = !pESh->IsViewLocked();
pESh->LockView( TRUE );
}
- ((SwTxtINetFmt*)pTxtAttr)->SetValidVis( FALSE );
+ const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false );
const SwTxtAttr* pAttr = pTxtAttr;
SwUpdateAttr aUpdateAttr( *pAttr->GetStart(),
*pAttr->GetEnd(),
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 08ecae818858..ef6b81e7444c 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -247,6 +247,9 @@ SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
SwTxtNode* pTxtNd = pDoc->GetNodes().MakeTxtNode( rIdx, pColl );
+ // METADATA: register copy
+ pTxtNd->RegisterAsCopyOf(*pCpyTxtNd);
+
// kopiere Attribute/Text
if( !pCpyAttrNd->HasSwAttrSet() )
// wurde ein AttrSet fuer die Numerierung angelegt, so loesche diesen!
@@ -670,7 +673,7 @@ void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange& rCpyRg )
// Kopieren eines Bereiches im oder in ein anderes Dokument !
-bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const
+bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
{
const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
@@ -709,13 +712,13 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const
BOOL bRet = FALSE;
if( pDoc != this )
- bRet = _Copy( rPam, rPos, TRUE, pRedlineRange ); // nur normales Kopieren
+ bRet = _Copy( rPam, rPos, TRUE, bCopyAll, pRedlineRange ); // nur normales Kopieren
// Copy in sich selbst (ueber mehrere Nodes wird hier gesondert
// behandelt; in einem TextNode wird normal behandelt)
else if( ! ( *pStt <= rPos && rPos < *pEnd &&
( pStt->nNode != pEnd->nNode ||
!pStt->nNode.GetNode().IsTxtNode() )) )
- bRet = _Copy( rPam, rPos, TRUE, pRedlineRange ); // nur normales Kopieren
+ bRet = _Copy( rPam, rPos, TRUE, bCopyAll, pRedlineRange ); // nur normales Kopieren
else
{
@@ -739,7 +742,7 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const
SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection(
SwNodeIndex( GetNodes().GetEndOfAutotext() ));
aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode();
- pDoc->_Copy( rPam, *aPam.GetPoint(), FALSE ); // kopieren ohne Frames
+ pDoc->_Copy( rPam, *aPam.GetPoint(), FALSE, bCopyAll, 0 ); // kopieren ohne Frames
aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext();
aPam.SetMark();
@@ -814,7 +817,7 @@ BOOL lcl_MarksWholeNode(const SwPaM & rPam)
}
BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
- BOOL bMakeNewFrms, SwPaM* pCpyRange ) const
+ BOOL bMakeNewFrms, bool bCopyAll, SwPaM* pCpyRange ) const
{
SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
@@ -1098,7 +1101,7 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
}
}
- if( aRg.aStart != aRg.aEnd )
+ if( bCopyAll || aRg.aStart != aRg.aEnd )
{
SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
if( pSttNd && bCopyCollFmt && pDestNd->HasSwAttrSet() )
@@ -1113,13 +1116,13 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
if( aInsPos == pEnd->nNode )
{
SwNodeIndex aSaveIdx( aInsPos, -1 );
- CopyWithFlyInFly( aRg, aInsPos, bMakeNewFrms, FALSE );
+ CopyWithFlyInFly( aRg, 0,aInsPos, bMakeNewFrms, FALSE );
aSaveIdx++;
pEnd->nNode = aSaveIdx;
pEnd->nContent.Assign( aSaveIdx.GetNode().GetTxtNode(), 0 );
}
else
- CopyWithFlyInFly( aRg, aInsPos, bMakeNewFrms, FALSE );
+ CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, FALSE );
bCopyBookmarks = FALSE;
@@ -1178,7 +1181,7 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
// ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------
-void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg,
+void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex,
const SwNodeIndex& rInsPos, BOOL bMakeNewFrms,
BOOL bDelRedlines, BOOL bCopyFlyAtFly ) const
{
@@ -1217,7 +1220,7 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg,
// Undo abschalten
BOOL bUndo = pDest->DoesUndo();
pDest->DoUndo( FALSE );
- _CopyFlyInFly( rRg, aSavePos, bCopyFlyAtFly );
+ _CopyFlyInFly( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly );
pDest->DoUndo( bUndo );
SwNodeRange aCpyRange( aSavePos, rInsPos );
@@ -1253,7 +1256,7 @@ void lcl_ChainFmts( SwFlyFrmFmt *pSrc, SwFlyFrmFmt *pDest )
}
}
-void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx,
+void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, const SwNodeIndex& rSttIdx,
BOOL bCopyFlyAtFly ) const
{
// Bug 22727: suche erst mal alle Flys zusammen, sortiere sie entsprechend
@@ -1270,7 +1273,8 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx,
const SwFrmFmt* pFmt = (*GetSpzFrmFmts())[n];
const SwFmtAnchor* pAnchor = &pFmt->GetAnchor();
const SwPosition* pAPos;
- if ( ( pAnchor->GetAnchorId() == FLY_AT_CNTNT ||
+ bool bAtCntnt = pAnchor->GetAnchorId() == FLY_AT_CNTNT;
+ if ( ( bAtCntnt ||
pAnchor->GetAnchorId() == FLY_AT_FLY ||
pAnchor->GetAnchorId() == FLY_AUTO_CNTNT ) &&
0 != ( pAPos = pAnchor->GetCntntAnchor()) &&
@@ -1279,9 +1283,53 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx,
: ( IsRedlineMove()
? rRg.aStart < pAPos->nNode
: rRg.aStart <= pAPos->nNode )) &&
- pAPos->nNode < rRg.aEnd )
+ pAPos->nNode <= rRg.aEnd )
{
- aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() ));
+ //frames at the last source node are not always copied:
+ //- if the node is empty and is the last node of the document or a table cell
+ // or a text frame then tey have to be copied
+ //- if the content index in this node is > 0 then paragph and frame bound objects are copied
+ //- to-character bound objects are copied if their index is <= nEndContentIndex
+ bool bAdd = false;
+ if( pAPos->nNode < rRg.aEnd )
+ bAdd = true;
+ if( !bAdd )
+ {
+ bool bEmptyNode = false;
+ bool bLastNode = false;
+ // is the node empty?
+ const SwNodes& rNodes = pAPos->nNode.GetNodes();
+ SwTxtNode* pTxtNode;
+ if( 0 != ( pTxtNode = pAPos->nNode.GetNode().GetTxtNode() ))
+ {
+ bEmptyNode = !pTxtNode->GetTxt().Len();
+ if( bEmptyNode )
+ {
+ //last node information is only necessary to know for the last TextNode
+ SwNodeIndex aTmp( pAPos->nNode );
+ ++aTmp;//goto next node
+ while( rNodes[aTmp ]->IsEndNode() )
+ {
+ if( aTmp == rNodes.GetEndOfContent().GetIndex() )
+ {
+ bLastNode = true;
+ break;
+ }
+ ++aTmp;
+ }
+ }
+ }
+ bAdd = bLastNode && bEmptyNode;
+ if( !bAdd )
+ {
+ if( bAtCntnt )
+ bAdd = nEndContentIndex > 0;
+ else
+ bAdd = pAPos->nContent <= nEndContentIndex;
+ }
+ }
+ if( bAdd )
+ aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() ));
}
}
diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx
index fe15b7fabbfa..817fa3c257aa 100644
--- a/sw/source/core/docnode/ndnotxt.cxx
+++ b/sw/source/core/docnode/ndnotxt.cxx
@@ -48,6 +48,10 @@
#include <istyleaccess.hxx>
#include <SwStyleNameMapper.hxx>
+// --> OD 2009-07-13 #i73249#
+#include <frmfmt.hxx>
+// <--
+
SwNoTxtNode::SwNoTxtNode( const SwNodeIndex & rWhere,
const BYTE nNdType,
SwGrfFmtColl *pGrfColl,
@@ -250,19 +254,57 @@ Graphic SwNoTxtNode::GetGraphic() const
return aRet;
}
+// --> OD 2009-07-14 #i73249#
+void SwNoTxtNode::SetTitle( const String& rTitle, bool bBroadcast )
+{
+ // Title attribute of <SdrObject> replaces own AlternateText attribute
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(GetFlyFmt());
+ ASSERT( pFlyFmt,
+ "<SwNoTxtNode::SetTitle(..)> - missing <SwFlyFrmFmt> instance" );
+ if ( !pFlyFmt )
+ {
+ return;
+ }
-void SwNoTxtNode::SetAlternateText( const String& rTxt, sal_Bool bBroadcast )
+ pFlyFmt->SetObjTitle( rTitle, bBroadcast );
+}
+
+const String SwNoTxtNode::GetTitle() const
{
- if( bBroadcast )
+ const SwFlyFrmFmt* pFlyFmt = dynamic_cast<const SwFlyFrmFmt*>(GetFlyFmt());
+ ASSERT( pFlyFmt,
+ "<SwNoTxtNode::GetTitle(..)> - missing <SwFlyFrmFmt> instance" );
+ if ( !pFlyFmt )
{
- SwStringMsgPoolItem aOld( RES_ALT_TEXT_CHANGED, aAlternateText );
- SwStringMsgPoolItem aNew( RES_ALT_TEXT_CHANGED, rTxt );
- aAlternateText = rTxt;
- Modify( &aOld, &aNew );
+ return aEmptyStr;
}
- else
+
+ return pFlyFmt->GetObjTitle();
+}
+
+void SwNoTxtNode::SetDescription( const String& rDescription, bool bBroadcast )
+{
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(GetFlyFmt());
+ ASSERT( pFlyFmt,
+ "<SwNoTxtNode::SetDescription(..)> - missing <SwFlyFrmFmt> instance" );
+ if ( !pFlyFmt )
{
- aAlternateText = rTxt;
+ return;
}
+
+ pFlyFmt->SetObjDescription( rDescription, bBroadcast );
}
+const String SwNoTxtNode::GetDescription() const
+{
+ const SwFlyFrmFmt* pFlyFmt = dynamic_cast<const SwFlyFrmFmt*>(GetFlyFmt());
+ ASSERT( pFlyFmt,
+ "<SwNoTxtNode::GetDescription(..)> - missing <SwFlyFrmFmt> instance" );
+ if ( !pFlyFmt )
+ {
+ return aEmptyStr;
+ }
+
+ return pFlyFmt->GetObjDescription();
+}
+// <--
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index f028862b4c05..da28c1292d8b 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -50,9 +50,7 @@
#include <fmtfordr.hxx>
#include <fmtpdsc.hxx>
#include <fmtanchr.hxx>
-#ifndef _FMTLSPLT_HXX
#include <fmtlsplt.hxx>
-#endif
#include <frmatr.hxx>
#include <charatr.hxx>
#include <cellfrm.hxx>
@@ -92,9 +90,7 @@
#ifndef _COMCORE_HRC
#include <comcore.hrc>
#endif
-#ifndef _DOCSH_HXX
#include "docsh.hxx"
-#endif
#ifdef LINUX
#include <tabcol.hxx>
#endif
@@ -1549,8 +1545,8 @@ BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara )
0 != ( pCurTxtNd = aDelRg.aStart.GetNode().GetTxtNode() ))
{
// Join the current text node with the last from the previous box if possible
- aDelRg.aStart--;
ULONG nNdIdx = aDelRg.aStart.GetIndex();
+ aDelRg.aStart--;
if( pDelPara->pLastNd == &aDelRg.aStart.GetNode() )
{
// Inserting the seperator
@@ -1562,7 +1558,7 @@ BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara )
SvULongs aBkmkArr( 4, 4 );
xub_StrLen nOldTxtLen = aCntIdx.GetIndex();
- _SaveCntntIdx( pDoc, nNdIdx + 1, pCurTxtNd->GetTxt().Len(),
+ _SaveCntntIdx( pDoc, nNdIdx, pCurTxtNd->GetTxt().Len(),
aBkmkArr );
pDelPara->pLastNd->JoinNext();
@@ -1575,7 +1571,6 @@ BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara )
else if( pDelPara->pUndo )
{
aDelRg.aStart++;
- nNdIdx = aDelRg.aStart.GetIndex();
pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex() );
}
}
@@ -2544,7 +2539,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
return ;
Point aPt;
- const SwShellCrsr *pShCrsr = *pCrsr;
+ const SwShellCrsr *pShCrsr = dynamic_cast<const SwShellCrsr*>(pCrsr);
if( pShCrsr )
aPt = pShCrsr->GetPtPos();
@@ -2769,7 +2764,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, BOOL bCurRowOnly,
return ;
Point aPt;
- const SwShellCrsr *pShCrsr = *pCrsr;
+ const SwShellCrsr *pShCrsr = dynamic_cast<const SwShellCrsr*>(pCrsr);
if( pShCrsr )
aPt = pShCrsr->GetPtPos();
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 1a107dbf3014..d6d04062b74f 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -117,7 +117,7 @@ void lcl_GetStartEndCell( const SwCursor& rCrsr,
"Tabselection nicht auf Cnt." );
Point aPtPos, aMkPos;
- const SwShellCrsr* pShCrsr = rCrsr;
+ const SwShellCrsr* pShCrsr = dynamic_cast<const SwShellCrsr*>(&rCrsr);
if( pShCrsr )
{
aPtPos = pShCrsr->GetPtPos();
@@ -138,7 +138,8 @@ void lcl_GetStartEndCell( const SwCursor& rCrsr,
BOOL lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
BOOL bAllCrsr = FALSE )
{
- const SwTableCursor* pTblCrsr = rCursor;
+ const SwTableCursor* pTblCrsr =
+ dynamic_cast<const SwTableCursor*>(&rCursor);
if( pTblCrsr )
::GetTblSelCrs( *pTblCrsr, rBoxes );
else
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 3ce045994b80..33cd325c669a 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1414,7 +1414,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
if( pSrcDoc != pDoc ||
pCpyPam->Start()->nNode > rInsPos ||
rInsPos >= pCpyPam->End()->nNode )
- pSrcDoc->Copy( *pCpyPam, *pPam->GetPoint() );
+ pSrcDoc->Copy( *pCpyPam, *pPam->GetPoint(), false );
delete pCpyPam;
}
if( pCpyRg && pSrcDoc == pDoc &&
@@ -1443,7 +1443,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
SwTblNumFmtMerge aTNFM( *pSrcDoc, *pDoc );
- pSrcDoc->CopyWithFlyInFly( *pCpyRg, rInsPos, bCreateFrm );
+ pSrcDoc->CopyWithFlyInFly( *pCpyRg, 0, rInsPos, bCreateFrm );
aSave++;
if( !bCreateFrm )
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index e75670aa9525..aa20281038da 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1653,7 +1653,12 @@ void SwDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
{
ASSERT( maAnchoredDrawObj.DrawObj(), "SwDrawContact::Modify: no draw object here?" );
if ( maAnchoredDrawObj.DrawObj() )
- maAnchoredDrawObj.DrawObj()->getShapePropertyChangeNotifier().notifyPropertyChange( ::svx::eTextShapeAnchorType );
+ {
+ // --> OD 2009-07-10 #i102752#
+ // assure that a ShapePropertyChangeNotifier exists
+ maAnchoredDrawObj.DrawObj()->notifyShapePropertyChange( ::svx::eTextShapeAnchorType );
+ // <--
+ }
}
}
}
@@ -2321,6 +2326,15 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence VOCOfDrawVirtObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
{
+#ifdef DBG_UTIL
+ // #i101734#
+ static bool bCheckOtherThanTranslate(false);
+ static double fShearX(0.0);
+ static double fRotation(0.0);
+ static double fScaleX(0.0);
+ static double fScaleY(0.0);
+#endif
+
const VCOfDrawVirtObj& rVC = static_cast< const VCOfDrawVirtObj& >(GetViewContact());
const SdrObject& rReferencedObject = rVC.GetSwDrawVirtObj().GetReferencedObj();
drawinglayer::primitive2d::Primitive2DSequence xRetval;
@@ -2331,8 +2345,20 @@ namespace sdr
if(aLocalOffset.X() || aLocalOffset.Y())
{
+#ifdef DBG_UTIL
+ // #i101734# added debug code to check more complex transformations
+ // than just a translation
+ if(bCheckOtherThanTranslate)
+ {
+ aOffsetMatrix.scale(fScaleX, fScaleY);
+ aOffsetMatrix.shearX(tan(fShearX * F_PI180));
+ aOffsetMatrix.rotate(fRotation * F_PI180);
+ }
+#endif
+
aOffsetMatrix.set(0, 2, aLocalOffset.X());
aOffsetMatrix.set(1, 2, aLocalOffset.Y());
+
}
if(rReferencedObject.ISA(SdrObjGroup))
@@ -2576,16 +2602,6 @@ void SwDrawVirtObj::RecalcBoundRect()
aOutRect = ReferencedObj().GetCurrentBoundRect() + aOffset;
}
-//////////////////////////////////////////////////////////////////////////////
-
-SdrObject* SwDrawVirtObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
-{
- Point aPnt(rPnt - GetOffset());
- BOOL bRet = rRefObj.CheckHit(aPnt, nTol, pVisiLayer) != NULL;
-
- return bRet ? (SdrObject*)this : NULL;
-}
-
basegfx::B2DPolyPolygon SwDrawVirtObj::TakeXorPoly() const
{
basegfx::B2DPolyPolygon aRetval(rRefObj.TakeXorPoly());
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 768cae90ce0a..15ca46ca2456 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -72,6 +72,9 @@ using namespace ::com::sun::star;
#include <svx/sdr/contact/viewcontactofvirtobj.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
using namespace ::com::sun::star;
@@ -189,10 +192,6 @@ UINT16 __EXPORT SwFlyDrawObj::GetObjVersion() const
//////////////////////////////////////////////////////////////////////////////////////
// AW: Need own primitive to get the FlyFrame paint working
-// Unique PrimitiveID. If more will be needed, create an own file in SW following
-// the example in SD
-#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SW| 0)
-
namespace drawinglayer
{
namespace primitive2d
@@ -201,15 +200,19 @@ namespace drawinglayer
{
private:
const SwVirtFlyDrawObj& mrSwVirtFlyDrawObj;
+ const basegfx::B2DRange maOuterRange;
protected:
// method which is to be used to implement the local decomposition of a 2D primitive
virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
public:
- SwVirtFlyDrawObjPrimitive(const SwVirtFlyDrawObj& rSwVirtFlyDrawObj)
+ SwVirtFlyDrawObjPrimitive(
+ const SwVirtFlyDrawObj& rSwVirtFlyDrawObj,
+ const basegfx::B2DRange &rOuterRange)
: BasePrimitive2D(),
- mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj)
+ mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj),
+ maOuterRange(rOuterRange)
{
}
@@ -219,6 +222,13 @@ namespace drawinglayer
// get range
virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+ // overloaded to allow callbacks to wrap_DoPaintObject
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ // data read access
+ const SwVirtFlyDrawObj& getSwVirtFlyDrawObj() const { return mrSwVirtFlyDrawObj; }
+ const basegfx::B2DRange& getOuterRange() const { return maOuterRange; }
+
// provide unique ID
DeclPrimitrive2DIDBlock()
};
@@ -229,13 +239,42 @@ namespace drawinglayer
{
namespace primitive2d
{
+ Primitive2DSequence SwVirtFlyDrawObjPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ if(!getOuterRange().isEmpty())
+ {
+ // currently this SW object has no primitive representation. As long as this is the case,
+ // create an invisible HitTestPrimitive to allow hitting the object. Use a filled primitive
+ // to get a HitTest which uses 'inside' as default object hit. The special cases from
+ // the old SwVirtFlyDrawObj::CheckHit implementation are handled now in SwDrawView::PickObj;
+ // this removed the 'hack' to get a view from inside model data or to react on noll-tolerance
+ // as it was done in the old implementation
+ const basegfx::B2DPolygon aOuterRangePolygon(basegfx::tools::createPolygonFromRect(getOuterRange()));
+ const basegfx::BColor aColor(0.0, 0.0, 0.0);
+ const Primitive2DReference aContentReference(
+ new PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aOuterRangePolygon),
+ aColor));
+ const Primitive2DReference aHitTestReference(
+ new HitTestPrimitive2D(
+ Primitive2DSequence(&aContentReference, 1)));
+
+ aRetval = Primitive2DSequence(&aHitTestReference, 1);
+ }
+
+ return aRetval;
+ }
+
bool SwVirtFlyDrawObjPrimitive::operator==(const BasePrimitive2D& rPrimitive) const
{
if(BasePrimitive2D::operator==(rPrimitive))
{
const SwVirtFlyDrawObjPrimitive& rCompare = (SwVirtFlyDrawObjPrimitive&)rPrimitive;
- return (&mrSwVirtFlyDrawObj == &rCompare.mrSwVirtFlyDrawObj);
+ return (&getSwVirtFlyDrawObj() == &rCompare.getSwVirtFlyDrawObj()
+ && getOuterRange() == rCompare.getOuterRange());
}
return false;
@@ -243,23 +282,20 @@ namespace drawinglayer
basegfx::B2DRange SwVirtFlyDrawObjPrimitive::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- // fallback on FlyFrame SnapRect
- const Rectangle& rSnapRect = mrSwVirtFlyDrawObj.GetSnapRect();
-
- return basegfx::B2DRange(rSnapRect.Left(), rSnapRect.Top(), rSnapRect.Right(), rSnapRect.Bottom());
+ return getOuterRange();
}
- Primitive2DSequence SwVirtFlyDrawObjPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DSequence SwVirtFlyDrawObjPrimitive::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
{
// This is the callback to keep the FlyFrame painting in SW alive as long as it
// is not changed to primitives. This is the method which will be called by the processors
// when they do not know this primitive (and they do not). Inside wrap_DoPaintObject
// there needs to be a test that paint is only done during SW repaints (see there).
// Using this mechanism guarantees the correct Z-Order of the VirtualObject-based FlyFrames.
- mrSwVirtFlyDrawObj.wrap_DoPaintObject();
+ getSwVirtFlyDrawObj().wrap_DoPaintObject();
// call parent
- return BasePrimitive2D::createLocalDecomposition(rViewInformation);
+ return BasePrimitive2D::get2DDecomposition(rViewInformation);
}
// provide unique ID
@@ -313,10 +349,19 @@ namespace sdr
if(rReferencedObject.ISA(SwFlyDrawObj))
{
- // create an own specialized primitive which is used as repaint callpoint (see primitive
- // implementation above)
- const drawinglayer::primitive2d::Primitive2DReference xPrimitive(new drawinglayer::primitive2d::SwVirtFlyDrawObjPrimitive(GetSwVirtFlyDrawObj()));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xPrimitive, 1);
+ // create an own specialized primitive which is used as repaint callpoint and HitTest
+ // for HitTest processor (see primitive implementation above)
+ const basegfx::B2DRange aOuterRange(GetSwVirtFlyDrawObj().getOuterBound());
+
+ if(!aOuterRange.isEmpty())
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xPrimitive(
+ new drawinglayer::primitive2d::SwVirtFlyDrawObjPrimitive(
+ GetSwVirtFlyDrawObj(),
+ aOuterRange));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xPrimitive, 1);
+ }
}
return xRetval;
@@ -330,6 +375,58 @@ namespace sdr
//////////////////////////////////////////////////////////////////////////////////////
+basegfx::B2DRange SwVirtFlyDrawObj::getOuterBound() const
+{
+ basegfx::B2DRange aOuterRange;
+ const SdrObject& rReferencedObject = GetReferencedObj();
+
+ if(rReferencedObject.ISA(SwFlyDrawObj))
+ {
+ const SwFlyFrm* pFlyFrame = GetFlyFrm();
+
+ if(pFlyFrame)
+ {
+ const Rectangle aOuterRectangle(pFlyFrame->Frm().Pos(), pFlyFrame->Frm().SSize());
+
+ if(!aOuterRectangle.IsEmpty()
+ && RECT_EMPTY != aOuterRectangle.Right()
+ && RECT_EMPTY != aOuterRectangle.Bottom())
+ {
+ aOuterRange.expand(basegfx::B2DTuple(aOuterRectangle.Left(), aOuterRectangle.Top()));
+ aOuterRange.expand(basegfx::B2DTuple(aOuterRectangle.Right(), aOuterRectangle.Bottom()));
+ }
+ }
+ }
+
+ return aOuterRange;
+}
+
+basegfx::B2DRange SwVirtFlyDrawObj::getInnerBound() const
+{
+ basegfx::B2DRange aInnerRange;
+ const SdrObject& rReferencedObject = GetReferencedObj();
+
+ if(rReferencedObject.ISA(SwFlyDrawObj))
+ {
+ const SwFlyFrm* pFlyFrame = GetFlyFrm();
+
+ if(pFlyFrame)
+ {
+ const Rectangle aInnerRectangle(pFlyFrame->Frm().Pos() + pFlyFrame->Prt().Pos(), pFlyFrame->Prt().SSize());
+
+ if(!aInnerRectangle.IsEmpty()
+ && RECT_EMPTY != aInnerRectangle.Right()
+ && RECT_EMPTY != aInnerRectangle.Bottom())
+ {
+ aInnerRange.expand(basegfx::B2DTuple(aInnerRectangle.Left(), aInnerRectangle.Top()));
+ aInnerRange.expand(basegfx::B2DTuple(aInnerRectangle.Right(), aInnerRectangle.Bottom()));
+ }
+ }
+ }
+
+ return aInnerRange;
+}
+
sdr::contact::ViewContact* SwVirtFlyDrawObj::CreateObjectSpecificViewContact()
{
// need an own ViewContact (VC) to allow creation of a specialized primitive
@@ -425,74 +522,6 @@ void SwVirtFlyDrawObj::wrap_DoPaintObject() const
/*************************************************************************
|*
-|* SwVirtFlyDrawObj::CheckHit()
-|* Beschreibung Das Teil ist genau dann getroffen wenn
-|* 1. der Point im Rand des Frm liegt.
-|* 2. der Point im heissen Bereich liegt.
-|* 3. der Point in der Flaeche liegt und es sich um
-|* einen Rahmen mit NoTxtFrm handelt und dieser
-|* keine URL traegt.
-|* 3a nicht aber wenn ueber dem Fly noch ein Fly liegt,
-|* und der Point in dessen Flaeche nicht steht.
-|* 4. der Point in der Flaeche liegt und der Rahmen
-|* selektiert ist.
-|* Ersterstellung MA 08. Dec. 94
-|* Letzte Aenderung JP 25.03.96
-|*
-*************************************************************************/
-
-SdrObject* __EXPORT SwVirtFlyDrawObj::CheckHit( const Point& rPnt, USHORT nTol,
- const SetOfByte* ) const
-{
- Rectangle aHitRect( pFlyFrm->Frm().Pos(), pFlyFrm->Frm().SSize() );
- if ( nTol )
- {
- Rectangle aExclude( aHitRect );
- aHitRect.Top() -= nTol;
- aHitRect.Bottom() += nTol;
- aHitRect.Left() -= nTol;
- aHitRect.Right() += nTol;
- if( aHitRect.IsInside( rPnt ) )
- {
- if ( pFlyFrm->Lower() && pFlyFrm->Lower()->IsNoTxtFrm() )
- {
- // #107513#
- // This test needs to be done outside, since also drawing layer HitTest
- // methods are called. Not all drawing objects are derived and the
- // CheckHit() overloaded. That's an conceptual error here.
- return (SdrObject*)this;
- }
- else
- {
- ViewShell *pShell = pFlyFrm->GetShell();
-
- //4. Getroffen wenn das Objekt selektiert ist.
- if ( pShell )
- {
- const SdrMarkList &rMrkList = pShell->
- Imp()->GetDrawView()->GetMarkedObjectList();
- for ( USHORT i = 0; i < rMrkList.GetMarkCount(); ++i )
- if ( long(this) == long(rMrkList.GetMark(i)->GetMarkedSdrObj()) )
- return (SdrObject*)this;
- }
-
- const Rectangle aPrtRect( pFlyFrm->Frm().Pos() + pFlyFrm->Prt().Pos(),
- pFlyFrm->Prt().SSize() );
- aExclude.Top() += Max( long(nTol), aPrtRect.Top() - aHitRect.Top() );
- aExclude.Bottom() -= Max( long(nTol), aHitRect.Bottom()- aPrtRect.Bottom());
- aExclude.Left() += Max( long(nTol), aPrtRect.Left() - aHitRect.Left() );
- aExclude.Right() -= Max( long(nTol), aHitRect.Right() - aPrtRect.Right() );
- return aExclude.IsInside( rPnt ) ? 0 : (SdrObject*)this;
- }
- }
- }
- else
- return aHitRect.IsInside( rPnt ) ? (SdrObject*)this : 0;
- return 0;
-}
-
-/*************************************************************************
-|*
|* SwVirtFlyDrawObj::TakeObjInfo()
|*
|* Ersterstellung MA 03. May. 95
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index de6e43799d88..a5d8ccd24e61 100644
--- a/sw/source/core/draw/dpage.cxx
+++ b/sw/source/core/draw/dpage.cxx
@@ -203,8 +203,8 @@ BOOL SwDPage::RequestHelp( Window* pWindow, SdrView* pView,
aPt -= pFly->Frm().Pos();
// ohne MapMode-Offset !!!!!
// ohne MapMode-Offset, ohne Offset, o ... !!!!!
- aPt = (Point&)(const Size&)pWindow->LogicToPixel(
- (const Size&)aPt, MapMode( MAP_TWIP ) );
+ aPt = pWindow->LogicToPixel(
+ aPt, MapMode( MAP_TWIP ) );
((( sTxt += '?' ) += String::CreateFromInt32( aPt.X() ))
+= ',' ) += String::CreateFromInt32( aPt.Y() );
}
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 51ef762c63df..9843f8f8c34e 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -153,6 +153,81 @@ sal_Bool SwDrawView::IsAntiAliasing() const
}
// <--
+//////////////////////////////////////////////////////////////////////////////
+
+SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, USHORT nTol, const SdrMarkList &rMrkList)
+{
+ if(!nTol)
+ {
+ // the old method forced back to outer bounds test when nTol == 0, so
+ // do not try to correct when nTol is not set (used from HelpContent)
+ }
+ else
+ {
+ // rebuild logic from former SwVirtFlyDrawObj::CheckSdrObjectHit. This is needed since
+ // the SdrObject-specific CheckHit implementations are now replaced with primitives and
+ // 'tricks' like in the old implementation (e.g. using a view from a model-data class to
+ // detect if object is selected) are no longer valid.
+ // The standard primitive hit-test for SwVirtFlyDrawObj now is the outer bound. The old
+ // implementation reduced this excluding the inner bound when the object was not selected.
+ SwVirtFlyDrawObj* pSwVirtFlyDrawObj = dynamic_cast< SwVirtFlyDrawObj* >(pRetval);
+
+ if(pSwVirtFlyDrawObj)
+ {
+ if(pSwVirtFlyDrawObj->GetFlyFrm()->Lower() && pSwVirtFlyDrawObj->GetFlyFrm()->Lower()->IsNoTxtFrm())
+ {
+ // the old method used IsNoTxtFrm (should be for SW's own OLE and
+ // graphic's) to accept hit only based on outer bounds; nothing to do
+ }
+ else
+ {
+ // check if the object is selected in this view
+ const sal_uInt32 nMarkCount(rMrkList.GetMarkCount());
+ bool bSelected(false);
+
+ for(sal_uInt32 a(0); !bSelected && a < nMarkCount; a++)
+ {
+ if(pSwVirtFlyDrawObj == rMrkList.GetMark(a)->GetMarkedSdrObj())
+ {
+ bSelected = true;
+ }
+ }
+
+ if(!bSelected)
+ {
+ // when not selected, the object is not hit when hit position is inside
+ // inner range. Get and shrink inner range
+ basegfx::B2DRange aInnerBound(pSwVirtFlyDrawObj->getInnerBound());
+
+ aInnerBound.grow(-1.0 * nTol);
+
+ if(aInnerBound.isInside(basegfx::B2DPoint(rPnt.X(), rPnt.Y())))
+ {
+ // exclude this hit
+ pRetval = 0;
+ }
+ }
+ }
+ }
+ }
+
+ return pRetval;
+}
+
+SdrObject* SwDrawView::CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const
+{
+ // call parent
+ SdrObject* pRetval = FmFormView::CheckSingleSdrObjectHit(rPnt, nTol, pObj, pPV, nOptions, pMVisLay);
+
+ if(pRetval)
+ {
+ // overloaded to allow extra handling when picking SwVirtFlyDrawObj's
+ pRetval = impLocalHitCorrection(pRetval, rPnt, nTol, GetMarkedObjectList());
+ }
+
+ return pRetval;
+}
+
/*************************************************************************
|*
|* SwDrawView::AddCustomHdl()
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index dfe258def74d..3867d0a4a891 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -374,7 +374,7 @@ BOOL SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPos,
SwDontExpandItem aExpItem;
aExpItem.SaveDontExpandItems( *aPam.GetPoint() );
- pAutoDoc->Copy( aCpyPam, *aPam.GetPoint() );
+ pAutoDoc->Copy( aCpyPam, *aPam.GetPoint(), false );
aExpItem.RestoreDontExpandItems( *aPam.GetPoint() );
@@ -491,7 +491,7 @@ void SwDontExpandItem::RestoreDontExpandItems( const SwPosition& rPos )
for( n = 0; n < nSize; ++n )
{
- SwTxtAttr* pHt = pTxtNd->GetpSwpHints()->GetHt( n );
+ SwTxtAttr* pHt = pTxtNd->GetpSwpHints()->GetTextHint( n );
nAttrStart = *pHt->GetStart();
if( nAttrStart > nStart ) // ueber den Bereich hinaus
break;
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index b3dc625db9c2..2bf30449f33b 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -172,11 +172,6 @@ BOOL SwEditShell::GetCurAttr( SfxItemSet& rSet,
if( aSet.Count() )
aSet.ClearItem();
-
-#ifdef JP_NEWCORE
- // vieleicht sollte man hier noch erfragen, ob schon alle Attribute
- // "DontCare" sind. Dann kann man abbrechen!
-#endif
}
pSet = &aSet;
}
@@ -251,9 +246,9 @@ BOOL SwEditShell::GetCurFtn( SwFmtFtn* pFillFtn )
}
-BOOL SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn )
+bool SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn )
{
- BOOL bChgd = FALSE;
+ bool bChgd = false;
StartAllAction();
SwPaM* pCrsr = GetCrsr(), *pFirst = pCrsr;
@@ -284,7 +279,7 @@ BOOL SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn )
} */
-BOOL SwEditShell::HasFtns( BOOL bEndNotes ) const
+bool SwEditShell::HasFtns( bool bEndNotes ) const
{
const SwFtnIdxs &rIdxs = pDoc->GetFtnIdxs();
for ( USHORT i = 0; i < rIdxs.Count(); ++i )
@@ -298,7 +293,7 @@ BOOL SwEditShell::HasFtns( BOOL bEndNotes ) const
// gebe Liste aller Fussnoten und deren Anfangstexte
-USHORT SwEditShell::GetSeqFtnList( SwSeqFldList& rList, BOOL bEndNotes )
+USHORT SwEditShell::GetSeqFtnList( SwSeqFldList& rList, bool bEndNotes )
{
if( rList.Count() )
rList.Remove( 0, rList.Count() );
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 7d8eeccb3159..384aa414895a 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -42,12 +42,8 @@
#include <IMark.hxx>
#include <docary.hxx>
#include <SwRewriter.hxx>
-#ifndef _UNOBJ_HXX
#include <undobj.hxx>
-#endif
-#ifndef _GLOBALS_HRC
#include <globals.hrc>
-#endif
#include <comcore.hrc>
#include <list>
@@ -253,10 +249,10 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
bFirstMove = FALSE;
}
- if( !GetDoc()->Copy( *PCURCRSR, *pPos ))
+ if( !GetDoc()->Copy( *PCURCRSR, *pPos, false ))
continue;
- SwPaM aInsertPaM(*pPos, aSttNdIdx);
+ SwPaM aInsertPaM(*pPos, SwPosition(aSttNdIdx));
pDestShell->GetDoc()->MakeUniqueNumRules(aInsertPaM);
bRet = TRUE;
@@ -321,24 +317,6 @@ BOOL SwEditShell::Replace( const String& rNewStr, BOOL bRegExpRplc )
GetDoc()->StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START(this)
-
-//JP 02.12.97: muss das noch sein??
- // sollten mehrere Node selektiert sein, dann loesche diese
- // erst, fuege ein Zeichen ein und ersetze dann dieses
- if( PCURCRSR->GetPoint()->nNode != PCURCRSR->GetMark()->nNode )
- {
- BOOL bForward = PCURCRSR->GetPoint()->nNode.GetIndex() >
- PCURCRSR->GetMark()->nNode.GetIndex();
- DeleteSel( *PCURCRSR );
- pDoc->Insert( *PCURCRSR, ' ' );
- PCURCRSR->SetMark();
- if( bForward )
- PCURCRSR->GetMark()->nContent--;
- else
- PCURCRSR->GetPoint()->nContent--;
- }
-//JP 02.12.97: muss das noch sein??
-
if( PCURCRSR->HasMark() && *PCURCRSR->GetMark() != *PCURCRSR->GetPoint() )
{
bRet = GetDoc()->Replace( *PCURCRSR, rNewStr, bRegExpRplc ) || bRet;
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index f1d781e4080b..b408a1c33c81 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -168,7 +168,7 @@ USHORT SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock,
aStt = pGDoc->GetNodes().GetEndOfExtras();
pCntntNd = pGDoc->GetNodes().GoNext( &aStt );
SwPosition aInsPos( aStt, SwIndex( pCntntNd ));
- pMyDoc->Copy( aCpyPam, aInsPos );
+ pMyDoc->Copy( aCpyPam, aInsPos, false );
nRet = rBlock.PutDoc();
}
@@ -250,13 +250,13 @@ BOOL SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
{
PCURCRSR->SetMark();
PCURCRSR->Move( fnMoveForward, fnGoCntnt );
- bRet = GetDoc()->Copy( *PCURCRSR, aPos ) || bRet;
+ bRet = GetDoc()->Copy( *PCURCRSR, aPos, false ) || bRet;
PCURCRSR->Exchange();
PCURCRSR->DeleteMark();
}
}
else
- bRet = GetDoc()->Copy( *PCURCRSR, aPos ) || bRet;
+ bRet = GetDoc()->Copy( *PCURCRSR, aPos, false ) || bRet;
FOREACHPAM_END()
}
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 4c6c66d5fec0..0bbe5c3bbecd 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -68,9 +68,12 @@
#include <unochart.hxx>
#include <numrule.hxx>
#include <SwNodeNum.hxx>
+#include <unocrsr.hxx>
+
using namespace com::sun::star;
+
SV_IMPL_PTRARR(SwGetINetAttrs, SwGetINetAttr*)
/******************************************************************************
@@ -123,7 +126,7 @@ void SwEditShell::Insert(const String &rStr)
// calculate cursor bidi level
SwCursor* pTmpCrsr = _GetCrsr();
const BOOL bDoNotSetBidiLevel = ! pTmpCrsr ||
- ( 0 != (SwUnoCrsr*)*pTmpCrsr );
+ ( 0 != dynamic_cast<SwUnoCrsr*>(pTmpCrsr) );
if ( ! bDoNotSetBidiLevel )
{
@@ -380,27 +383,27 @@ void SwEditShell::GetGrfNms( String* pGrfName, String* pFltName,
// alternativen Text abfragen/setzen
-const String& SwEditShell::GetAlternateText() const
-{
- SwPaM* pCrsr = GetCrsr();
- const SwNoTxtNode* pNd;
- if( !pCrsr->HasMark() && 0 != ( pNd = pCrsr->GetNode()->GetNoTxtNode()) )
- return pNd->GetAlternateText();
-
- return aEmptyStr;
-}
-
-
-void SwEditShell::SetAlternateText( const String& rTxt )
-{
- SwPaM* pCrsr = GetCrsr();
- SwNoTxtNode* pNd;
- if( !pCrsr->HasMark() && 0 != ( pNd = pCrsr->GetNode()->GetNoTxtNode()) )
- {
- pNd->SetAlternateText( rTxt, sal_True );
- GetDoc()->SetModified();
- }
-}
+//const String& SwEditShell::GetAlternateText() const
+//{
+// SwPaM* pCrsr = GetCrsr();
+// const SwNoTxtNode* pNd;
+// if( !pCrsr->HasMark() && 0 != ( pNd = pCrsr->GetNode()->GetNoTxtNode()) )
+// return pNd->GetAlternateText();
+
+// return aEmptyStr;
+//}
+
+
+//void SwEditShell::SetAlternateText( const String& rTxt )
+//{
+// SwPaM* pCrsr = GetCrsr();
+// SwNoTxtNode* pNd;
+// if( !pCrsr->HasMark() && 0 != ( pNd = pCrsr->GetNode()->GetNoTxtNode()) )
+// {
+// pNd->SetAlternateText( rTxt, sal_True );
+// GetDoc()->SetModified();
+// }
+//}
const PolyPolygon *SwEditShell::GetGraphicPolygon() const
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 5cc2277c5ccc..bf6565d352fd 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -72,8 +72,10 @@ const SwSection* SwEditShell::InsertSection( const SwSection& rNew,
BOOL SwEditShell::IsInsRegionAvailable() const
{
- SwPaM* pCrsr;
- if( IsTableMode() || ( pCrsr = GetCrsr() )->GetNext() != pCrsr )
+ if( IsTableMode() )
+ return FALSE;
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr )
return FALSE;
if( pCrsr->HasMark() )
return 0 != GetDoc()->IsInsRegionAvailable( *pCrsr );
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 0d51c62602d0..00fe089b91e9 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -189,13 +189,21 @@ sal_uInt16 SwEditShell::GetCntType() const
sal_Bool SwEditShell::HasOtherCnt() const
{
+ if ( GetDoc()->GetSpzFrmFmts()->Count() )
+ return sal_True;
+
const SwNodes &rNds = GetDoc()->GetNodes();
const SwNode *pNd;
- return GetDoc()->GetSpzFrmFmts()->Count() ||
- 1 != (( pNd = &rNds.GetEndOfInserts() )->GetIndex() -
- pNd->StartOfSectionIndex() ) ||
- 1 != (( pNd = &rNds.GetEndOfAutotext() )->GetIndex() -
- pNd->StartOfSectionIndex() );
+
+ pNd = &rNds.GetEndOfInserts();
+ if ( 1 != (pNd->GetIndex() - pNd->StartOfSectionIndex()) )
+ return sal_True;
+
+ pNd = &rNds.GetEndOfAutotext();
+ if ( 1 != (pNd->GetIndex() - pNd->StartOfSectionIndex()) )
+ return sal_True;
+
+ return sal_False;
}
/******************************************************************************
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 150bb8fc2a9c..5b6bda70ed4e 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -288,8 +288,9 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByIdentifier(
/* -----------------------------21.12.99 13:20--------------------------------
---------------------------------------------------------------------------*/
-void SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
+bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
{
+ bool bChanged = false;
for( USHORT j = 0; j < m_pDataArr->Count(); ++j )
{
SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
@@ -299,9 +300,11 @@ void SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
for(USHORT i = 0; i < AUTH_FIELD_END; i++)
pTemp->SetAuthorField((ToxAuthorityField) i,
pNewEntry->GetAuthorField((ToxAuthorityField)i));
+ bChanged = true;
break;
}
}
+ return bChanged;
}
/*-- 11.10.99 08:49:22---------------------------------------------------
Description: appends a new entry (if new) and returns the array position
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 50962cb36bb4..029759a6c056 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -371,6 +371,7 @@ void SwTableFormula::_MakeFormel( const SwTable& rTbl, String& rNewStr,
rNewStr += ')';
}
else if( pSttBox && !pLastBox ) // nur die StartBox ?
+ {
//JP 12.01.99: und keine EndBox in der Formel!
// Berechne den Wert der Box
if ( pSttBox->getRowSpan() >= 1 )
@@ -378,6 +379,7 @@ void SwTableFormula::_MakeFormel( const SwTable& rTbl, String& rNewStr,
rNewStr += pCalcPara->rCalc.GetStrResult(
pSttBox->GetValue( *pCalcPara ), FALSE );
}
+ }
else
pCalcPara->rCalc.SetCalcError( CALC_SYNTAX ); // Fehler setzen
rNewStr += ' ';
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 186174d28c9a..07c8a0911080 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -840,7 +840,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames )
{
SwNodeIndex aIndexBefore(rInsPos.nNode);
aIndexBefore--;
- pClpDoc->Copy( rCopy, rInsPos );
+ pClpDoc->Copy( rCopy, rInsPos, false );
{
aIndexBefore++;
SwPaM aPaM(SwPosition(aIndexBefore, 0),
@@ -1069,7 +1069,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames )
aIndexBefore--;
- pClpDoc->Copy( aCpyPam, rInsPos );
+ pClpDoc->Copy( aCpyPam, rInsPos, false );
{
aIndexBefore++;
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 56c1790fa4b2..61d72a45aafe 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -804,7 +804,9 @@ void SwFEShell::Insert( const String& rGrfName, const String& rFltName,
SwFlyFrmFmt* pFmt = 0;
SET_CURR_SHELL( this );
StartAllAction();
- FOREACHCURSOR_START( this )
+ SwShellCrsr *pStartCursor = dynamic_cast<SwShellCrsr*>(this->GetSwCrsr());
+ SwShellCrsr *pCursor = pStartCursor;
+ do {
// Anker noch nicht oder unvollstaendig gesetzt ?
if( pFlyAttrSet )
@@ -820,18 +822,22 @@ void SwFEShell::Insert( const String& rGrfName, const String& rFltName,
case FLY_AUTO_CNTNT: // LAYER_IMPL
case FLY_IN_CNTNT:
if( !pAnchor->GetCntntAnchor() )
- pAnchor->SetAnchor( PCURCRSR->GetPoint() );
+ {
+ pAnchor->SetAnchor( pCursor->GetPoint() );
+ }
break;
case FLY_AT_FLY:
if( !pAnchor->GetCntntAnchor() )
- lcl_SetNewFlyPos( *PCURCRSR->GetNode(),
- *pAnchor, GetCrsrDocPos() );
+ {
+ lcl_SetNewFlyPos( *pCursor->GetNode(),
+ *pAnchor, GetCrsrDocPos() );
+ }
break;
case FLY_PAGE:
if( !pAnchor->GetPageNum() )
{
- pAnchor->SetPageNum( PCURCRSR->GetPageNum(
- sal_True, &PCURCRSR->GetPtPos() ) );
+ pAnchor->SetPageNum( pCursor->GetPageNum(
+ sal_True, &pCursor->GetPtPos() ) );
}
break;
default :
@@ -839,13 +845,15 @@ void SwFEShell::Insert( const String& rGrfName, const String& rFltName,
}
}
}
- pFmt = GetDoc()->Insert(*PCURCRSR, rGrfName,
+ pFmt = GetDoc()->Insert(*pCursor, rGrfName,
rFltName, pGraphic,
pFlyAttrSet,
pGrfAttrSet, pFrmFmt );
ASSERT( pFmt, "Doc->Insert(notxt) failed." );
- FOREACHCURSOR_END()
+ } while( (pCursor = dynamic_cast<SwShellCrsr*>(pCursor->GetNext()))
+ != pStartCursor );
+
EndAllAction();
if( pFmt )
@@ -1603,7 +1611,7 @@ const SwFrmFmt* SwFEShell::IsURLGrfAtPos( const Point& rPt, String* pURL,
sal_uInt16 nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 2 );
- if( pDView->PickObj( rPt, pObj, pPV,SDRSEARCH_PICKMACRO ) &&
+ if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV,SDRSEARCH_PICKMACRO ) &&
pObj->ISA(SwVirtFlyDrawObj) )
{
SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
@@ -1643,8 +1651,8 @@ const SwFrmFmt* SwFEShell::IsURLGrfAtPos( const Point& rPt, String* pURL,
Point aPt( rPt );
aPt -= pFly->Frm().Pos();
// ohne MapMode-Offset, ohne Offset, o ... !!!!!
- aPt = (Point&)(const Size&)GetOut()->LogicToPixel(
- (const Size&)aPt, MapMode( MAP_TWIP ) );
+ aPt = GetOut()->LogicToPixel(
+ aPt, MapMode( MAP_TWIP ) );
((( *pURL += '?' ) += String::CreateFromInt32( aPt.X() ))
+= ',' ) += String::CreateFromInt32(aPt.Y() );
}
@@ -1671,7 +1679,7 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt,
SdrPageView* pPV;
SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
- if( pDView->PickObj( rPt, pObj, pPV ) && pObj->ISA(SwVirtFlyDrawObj) )
+ if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV ) && pObj->ISA(SwVirtFlyDrawObj) )
{
SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
@@ -1715,7 +1723,7 @@ const SwFrmFmt* SwFEShell::GetFmtFromObj( const Point& rPt, SwRect** pRectToFill
// Tattergrenze fuer Drawing-SS
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
- if( pDView->PickObj( rPt, pObj, pPView, SDRSEARCH_PICKMARKABLE ) )
+ if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SDRSEARCH_PICKMARKABLE ) )
{
// dann teste mal was es ist:
if ( pObj->ISA(SwVirtFlyDrawObj) )
@@ -1847,7 +1855,7 @@ ObjCntType SwFEShell::GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const
// Tattergrenze fuer Drawing-SS
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
- if( pDView->PickObj( rPt, pObj, pPView, SDRSEARCH_PICKMARKABLE ) )
+ if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SDRSEARCH_PICKMARKABLE ) )
eType = GetObjCntType( *(rpObj = pObj) );
pDView->SetHitTolerancePixel( nOld );
@@ -2060,3 +2068,99 @@ void SwFEShell::GetConnectableFrmFmts(SwFrmFmt & rFmt,
EndAction();
}
+
+// --> OD 2009-07-13 #i73249#
+const String SwFEShell::GetObjTitle() const
+{
+ String aTitle;
+
+ if ( Imp()->HasDrawView() )
+ {
+ const SdrMarkList *pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
+ if ( pMrkList->GetMarkCount() == 1 )
+ {
+ const SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
+ const SwFrmFmt* pFmt = FindFrmFmt( pObj );
+ if ( pFmt->Which() == RES_FLYFRMFMT )
+ {
+ aTitle = dynamic_cast<const SwFlyFrmFmt*>(pFmt)->GetObjTitle();
+ }
+ else
+ {
+ aTitle = pObj->GetTitle();
+ }
+ }
+ }
+
+ return aTitle;
+}
+
+void SwFEShell::SetObjTitle( const String& rTitle )
+{
+ if ( Imp()->HasDrawView() )
+ {
+ const SdrMarkList *pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
+ if ( pMrkList->GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
+ SwFrmFmt* pFmt = FindFrmFmt( pObj );
+ if ( pFmt->Which() == RES_FLYFRMFMT )
+ {
+ GetDoc()->SetFlyFrmTitle( *(dynamic_cast<SwFlyFrmFmt*>(pFmt)),
+ rTitle );
+ }
+ else
+ {
+ pObj->SetTitle( rTitle );
+ }
+ }
+ }
+}
+
+const String SwFEShell::GetObjDescription() const
+{
+ String aDescription;
+
+ if ( Imp()->HasDrawView() )
+ {
+ const SdrMarkList *pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
+ if ( pMrkList->GetMarkCount() == 1 )
+ {
+ const SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
+ const SwFrmFmt* pFmt = FindFrmFmt( pObj );
+ if ( pFmt->Which() == RES_FLYFRMFMT )
+ {
+ aDescription = dynamic_cast<const SwFlyFrmFmt*>(pFmt)->GetObjDescription();
+ }
+ else
+ {
+ aDescription = pObj->GetDescription();
+ }
+ }
+ }
+
+ return aDescription;
+}
+
+void SwFEShell::SetObjDescription( const String& rDescription )
+{
+ if ( Imp()->HasDrawView() )
+ {
+ const SdrMarkList *pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
+ if ( pMrkList->GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
+ SwFrmFmt* pFmt = FindFrmFmt( pObj );
+ if ( pFmt->Which() == RES_FLYFRMFMT )
+ {
+ GetDoc()->SetFlyFrmDescription( *(dynamic_cast<SwFlyFrmFmt*>(pFmt)),
+ rDescription );
+ }
+ else
+ {
+ pObj->SetDescription( rDescription );
+ }
+ }
+ }
+}
+// <--
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index f6539c26d16c..6d7059b3cf0e 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1178,7 +1178,7 @@ bool SwFEShell::IsObjSelectable( const Point& rPt )
USHORT nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
- bRet = 0 != pDView->PickObj( rPt, pObj, pPV, SDRSEARCH_PICKMARKABLE );
+ bRet = 0 != pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMARKABLE );
pDView->SetHitTolerancePixel( nOld );
}
return bRet;
@@ -1202,7 +1202,7 @@ sal_Bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
sal_uInt16 nOld(pDrawView->GetHitTolerancePixel());
pDrawView->SetHitTolerancePixel(pDrawView->GetMarkHdlSizePixel()/2);
- bRet = pDrawView->PickObj(rPt, pObj, pPV, SDRSEARCH_PICKMARKABLE);
+ bRet = pDrawView->PickObj(rPt, pDrawView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMARKABLE);
pDrawView->SetHitTolerancePixel(nOld);
if(bRet && pObj)
@@ -2724,7 +2724,7 @@ int SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource,
SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
const USHORT nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 0 );
- if( pDView->PickObj( rPt, pObj, pPView, SDRSEARCH_PICKMARKABLE ) &&
+ if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SDRSEARCH_PICKMARKABLE ) &&
pObj->ISA(SwVirtFlyDrawObj) )
{
SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
@@ -2759,7 +2759,7 @@ int SwFEShell::Chain( SwFrmFmt &rSource, const Point &rPt )
SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
const USHORT nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 0 );
- pDView->PickObj( rPt, pObj, pPView, SDRSEARCH_PICKMARKABLE );
+ pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SDRSEARCH_PICKMARKABLE );
pDView->SetHitTolerancePixel( nOld );
SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 5375078a48e3..ec3ac828d528 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -34,12 +34,8 @@
#include <hintids.hxx>
-#ifndef __RSC //autogen
#include <tools/errinf.hxx>
-#endif
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
#include <basegfx/vector/b2dvector.hxx>
#ifndef _SVX_SVXIDS_HRC
#include <svx/svxids.hrc>
@@ -120,13 +116,6 @@ TblWait::TblWait( USHORT nCnt, SwFrm *pFrm, SwDocShell &rDocShell, USHORT nCnt2)
pWait = new SwWait( rDocShell, TRUE );
}
-inline const SwCursor& GetShellCursor( const SwCrsrShell& rShell )
-{
- const SwShellCrsr *pCrsr = rShell.GetTableCrsr();
- if( !pCrsr )
- pCrsr = (SwShellCrsr*)*rShell.GetSwCrsr( FALSE );
- return *pCrsr;
-}
void SwFEShell::ParkCursorInTab()
{
@@ -803,13 +792,13 @@ void SwFEShell::SetRowSplit( const SwFmtRowSplit& rNew )
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetRowSplit( GetShellCursor( *this ), rNew );
+ GetDoc()->SetRowSplit( *getShellCrsr( false ), rNew );
EndAllActionAndCall();
}
void SwFEShell::GetRowSplit( SwFmtRowSplit*& rpSz ) const
{
- GetDoc()->GetRowSplit( GetShellCursor( *this ), rpSz );
+ GetDoc()->GetRowSplit( *getShellCrsr( false ), rpSz );
}
@@ -824,7 +813,7 @@ void SwFEShell::SetRowHeight( const SwFmtFrmSize &rNew )
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetRowHeight( GetShellCursor( *this ), rNew );
+ GetDoc()->SetRowHeight( *getShellCrsr( false ), rNew );
EndAllActionAndCall();
}
@@ -833,7 +822,7 @@ void SwFEShell::SetRowHeight( const SwFmtFrmSize &rNew )
******************************************************************************/
void SwFEShell::GetRowHeight( SwFmtFrmSize *& rpSz ) const
{
- GetDoc()->GetRowHeight( GetShellCursor( *this ), rpSz );
+ GetDoc()->GetRowHeight( *getShellCrsr( false ), rpSz );
}
BOOL SwFEShell::BalanceRowHeight( BOOL bTstOnly )
@@ -841,7 +830,7 @@ BOOL SwFEShell::BalanceRowHeight( BOOL bTstOnly )
SET_CURR_SHELL( this );
if( !bTstOnly )
StartAllAction();
- BOOL bRet = GetDoc()->BalanceRowHeight( GetShellCursor( *this ), bTstOnly );
+ BOOL bRet = GetDoc()->BalanceRowHeight( *getShellCrsr( false ), bTstOnly );
if( !bTstOnly )
EndAllActionAndCall();
return bRet;
@@ -854,7 +843,7 @@ void SwFEShell::SetRowBackground( const SvxBrushItem &rNew )
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetRowBackground( GetShellCursor( *this ), rNew );
+ GetDoc()->SetRowBackground( *getShellCrsr( false ), rNew );
EndAllActionAndCall();
}
@@ -863,7 +852,7 @@ void SwFEShell::SetRowBackground( const SvxBrushItem &rNew )
******************************************************************************/
BOOL SwFEShell::GetRowBackground( SvxBrushItem &rToFill ) const
{
- return GetDoc()->GetRowBackground( GetShellCursor( *this ), rToFill );
+ return GetDoc()->GetRowBackground( *getShellCrsr( false ), rToFill );
}
/***********************************************************************
@@ -877,7 +866,7 @@ void SwFEShell::SetTabBorders( const SfxItemSet& rSet )
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetTabBorders( GetShellCursor( *this ), rSet );
+ GetDoc()->SetTabBorders( *getShellCrsr( false ), rSet );
EndAllActionAndCall();
}
@@ -886,14 +875,14 @@ void SwFEShell::SetTabLineStyle( const Color* pColor, BOOL bSetLine,
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetTabLineStyle( GetShellCursor( *this ),
+ GetDoc()->SetTabLineStyle( *getShellCrsr( false ),
pColor, bSetLine, pBorderLine );
EndAllActionAndCall();
}
void SwFEShell::GetTabBorders( SfxItemSet& rSet ) const
{
- GetDoc()->GetTabBorders( GetShellCursor( *this ), rSet );
+ GetDoc()->GetTabBorders( *getShellCrsr( false ), rSet );
}
@@ -907,13 +896,13 @@ void SwFEShell::SetBoxBackground( const SvxBrushItem &rNew )
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetBoxAttr( GetShellCursor( *this ), rNew );
+ GetDoc()->SetBoxAttr( *getShellCrsr( false ), rNew );
EndAllActionAndCall();
}
BOOL SwFEShell::GetBoxBackground( SvxBrushItem &rToFill ) const
{
- return GetDoc()->GetBoxAttr( GetShellCursor( *this ), rToFill );
+ return GetDoc()->GetBoxAttr( *getShellCrsr( false ), rToFill );
}
/***********************************************************************
@@ -926,13 +915,13 @@ void SwFEShell::SetBoxDirection( const SvxFrameDirectionItem& rNew )
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetBoxAttr( GetShellCursor( *this ), rNew );
+ GetDoc()->SetBoxAttr( *getShellCrsr( false ), rNew );
EndAllActionAndCall();
}
BOOL SwFEShell::GetBoxDirection( SvxFrameDirectionItem& rToFill ) const
{
- return GetDoc()->GetBoxAttr( GetShellCursor( *this ), rToFill );
+ return GetDoc()->GetBoxAttr( *getShellCrsr( false ), rToFill );
}
/***********************************************************************
@@ -945,13 +934,13 @@ void SwFEShell::SetBoxAlign( USHORT nAlign )
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetBoxAlign( GetShellCursor( *this ), nAlign );
+ GetDoc()->SetBoxAlign( *getShellCrsr( false ), nAlign );
EndAllActionAndCall();
}
USHORT SwFEShell::GetBoxAlign() const
{
- return GetDoc()->GetBoxAlign( GetShellCursor( *this ) );
+ return GetDoc()->GetBoxAlign( *getShellCrsr( false ) );
}
/***********************************************************************
@@ -1063,7 +1052,7 @@ void SwFEShell::ProtectCells()
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetBoxAttr( GetShellCursor( *this ), aProt );
+ GetDoc()->SetBoxAttr( *getShellCrsr( false ), aProt );
if( !IsCrsrReadonly() )
{
@@ -1280,7 +1269,7 @@ void SwFEShell::AdjustCellWidth( BOOL bBalance )
//ermitteln laesst wieviel Inhalt betroffen ist.
TblWait aWait( USHRT_MAX, 0, *GetDoc()->GetDocShell() );
- GetDoc()->AdjustCellWidth( GetShellCursor( *this ), bBalance );
+ GetDoc()->AdjustCellWidth( *getShellCrsr( false ), bBalance );
EndAllActionAndCall();
}
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index f621e60fbc74..ba550304e04a 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -210,11 +210,7 @@ void GetTblSel( const SwCrsrShell& rShell, SwSelBoxes& rBoxes,
if ( !rShell.IsTableMode() )
rShell.GetCrsr();
- const SwShellCrsr *pCrsr = rShell.GetTableCrsr();
- if( !pCrsr )
- pCrsr = (SwShellCrsr*)*rShell.GetSwCrsr( FALSE );
-
- GetTblSel( *pCrsr, rBoxes, eSearchType );
+ GetTblSel( *rShell.getShellCrsr(false), rBoxes, eSearchType );
}
void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes,
@@ -287,7 +283,7 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes,
else
{
Point aPtPos, aMkPos;
- const SwShellCrsr* pShCrsr = rCrsr;
+ const SwShellCrsr* pShCrsr = dynamic_cast<const SwShellCrsr*>(&rCrsr);
if( pShCrsr )
{
aPtPos = pShCrsr->GetPtPos();
@@ -2066,11 +2062,7 @@ BOOL CheckSplitCells( const SwCrsrShell& rShell, USHORT nDiv,
if( !rShell.IsTableMode() )
rShell.GetCrsr();
- const SwShellCrsr *pCrsr = rShell.GetTableCrsr();
- if( !pCrsr )
- pCrsr = (SwShellCrsr*)*rShell.GetSwCrsr( FALSE );
-
- return CheckSplitCells( *pCrsr, nDiv, eSearchType );
+ return CheckSplitCells( *rShell.getShellCrsr(false), nDiv, eSearchType );
}
BOOL CheckSplitCells( const SwCursor& rCrsr, USHORT nDiv,
@@ -2083,7 +2075,7 @@ BOOL CheckSplitCells( const SwCursor& rCrsr, USHORT nDiv,
//Start- und Endzelle besorgen und den naechsten fragen.
Point aPtPos, aMkPos;
- const SwShellCrsr* pShCrsr = rCrsr;
+ const SwShellCrsr* pShCrsr = dynamic_cast<const SwShellCrsr*>(&rCrsr);
if( pShCrsr )
{
aPtPos = pShCrsr->GetPtPos();
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 47c9af2d5028..55fbb54bd718 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -956,7 +956,8 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
SwGrfNode* pGrfNd = pDoc->GetNodes().MakeGrfNode( rIdx, sFile, sFilter,
&aTmpGrf, pColl,
(SwAttrSet*)GetpSwAttrSet() );
- pGrfNd->SetAlternateText( GetAlternateText() );
+ pGrfNd->SetTitle( GetTitle() );
+ pGrfNd->SetDescription( GetDescription() );
pGrfNd->SetContour( HasContour(), HasAutomaticContour() );
return pGrfNd;
}
diff --git a/sw/source/core/inc/crossrefbookmark.hxx b/sw/source/core/inc/crossrefbookmark.hxx
index 3712950fbb23..84ebaf1eb9e6 100644
--- a/sw/source/core/inc/crossrefbookmark.hxx
+++ b/sw/source/core/inc/crossrefbookmark.hxx
@@ -70,8 +70,6 @@ namespace sw { namespace mark
"<SwCrossRefBookmark::ClearOtherMarkPos(..)>"
" - misusage of CrossRefBookmark: other bookmark position isn't allowed to be set or cleared." );
}
-
- static bool IsLegalName(const ::rtl::OUString& rName);
};
class CrossRefHeadingBookmark
diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx
index 3a3be7a60412..292be49df7b4 100644
--- a/sw/source/core/inc/dflyobj.hxx
+++ b/sw/source/core/inc/dflyobj.hxx
@@ -85,6 +85,10 @@ public:
// for paints triggered form ExecutePrimitive
void wrap_DoPaintObject() const;
+ // for simple access to inner and outer bounds
+ basegfx::B2DRange getOuterBound() const;
+ basegfx::B2DRange getInnerBound() const;
+
public:
TYPEINFO();
@@ -92,7 +96,6 @@ public:
~SwVirtFlyDrawObj();
//Ueberladene Methoden der Basisklasse SdrVirtObj
- virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const;
virtual void TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const;
//Wir nehemen die Groessenbehandlung vollstaendig selbst in die Hand.
diff --git a/sw/source/core/inc/dview.hxx b/sw/source/core/inc/dview.hxx
index 8d1988903aa8..f5cb6cc40261 100644
--- a/sw/source/core/inc/dview.hxx
+++ b/sw/source/core/inc/dview.hxx
@@ -90,6 +90,10 @@ protected:
// add custom handles (used by other apps, e.g. AnchorPos)
virtual void AddCustomHdl();
+ // overloaded to allow extra handling when picking SwVirtFlyDrawObj's
+ using FmFormView::CheckSingleSdrObjectHit;
+ virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const;
+
public:
SwDrawView( SwViewImp &rI, SdrModel *pMd, OutputDevice* pOutDev=NULL );
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index e992fb0fdf28..09c19c7d69fd 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -275,7 +275,7 @@ public:
void SetFtnPage( BOOL b ) { bFtnPage = b; }
void SetEndNotePage( BOOL b ) { bEndNotePage = b; }
- inline USHORT GetPhyPageNum() const { return nPhyPageNum;}
+ inline USHORT GetPhyPageNum() const { return nPhyPageNum;}
inline void SetPhyPageNum( USHORT nNum ) { nPhyPageNum = nNum;}
inline void DecrPhyPageNum() { --nPhyPageNum; }
inline void IncrPhyPageNum() { ++nPhyPageNum; }
diff --git a/sw/source/ui/inc/itemdef.hxx b/sw/source/core/inc/undoflystrattr.hxx
index c73a429e0fee..86bffc64bdb1 100644
--- a/sw/source/ui/inc/itemdef.hxx
+++ b/sw/source/core/inc/undoflystrattr.hxx
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: itemdef.hxx,v $
- * $Revision: 1.3 $
+ * $RCSfile: SwUndoPageDesc.hxx,v $
+ * $Revision: 1.7 $
*
* This file is part of OpenOffice.org.
*
@@ -27,14 +27,34 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef ITEMDEF_HXX
-#define ITEMDEF_HXX
+#ifndef _UNDO_FLY_STR_ATTR_HXX
+#define _UNDO_FLY_STR_ATTR_HXX
+#include <undobj.hxx>
+#include <swundo.hxx>
-#include <sfx2/msg.hxx>
+class SwFlyFrmFmt;
+class String;
-SFX_DECL_TYPE(10); //SwElemItem
-SFX_DECL_TYPE(13); //SwAddPrinterItem
-SFX_DECL_TYPE(16); //SwDocDisplayItem
+class SwUndoFlyStrAttr : public SwUndo
+{
+ public:
+ SwUndoFlyStrAttr( SwFlyFrmFmt& rFlyFrmFmt,
+ const SwUndoId eUndoId,
+ const String& sOldStr,
+ const String& sNewStr );
+ virtual ~SwUndoFlyStrAttr();
-#endif
+ virtual void Undo( SwUndoIter & rIt );
+ virtual void Redo( SwUndoIter & rIt );
+ virtual void Repeat( SwUndoIter & rIt );
+
+ virtual SwRewriter GetRewriter() const;
+
+ private:
+ SwFlyFrmFmt& mrFlyFrmFmt;
+ const String msOldStr;
+ const String msNewStr;
+};
+
+#endif // _UNDO_FLY_STR_ATTR_HXX
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index d51d42f04339..eba323bd52a2 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -254,7 +254,7 @@ public:
BOOL IsPaintInScroll() const { return bPaintInScroll; }
// neues Interface fuer StarView Drawing
- inline BOOL HasDrawView() const { return 0 != pDrawView; }
+ inline BOOL HasDrawView() const { return 0 != pDrawView; }
SwDrawView* GetDrawView() { return pDrawView; }
const SwDrawView* GetDrawView() const { return pDrawView; }
SdrPageView*GetPageView() { return pSdrPageView; }
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index de2bbdf6ef43..9dd592175a4d 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2880,6 +2880,80 @@ sal_Bool SwFlyFrmFmt::GetInfo( SfxPoolItem& rInfo ) const
return sal_True;
}
+// --> OD 2009-07-14 #i73249#
+void SwFlyFrmFmt::SetObjTitle( const String& rTitle, bool bBroadcast )
+{
+ SdrObject* pMasterObject = FindSdrObject();
+ ASSERT( pMasterObject,
+ "<SwNoTxtNode::SetObjTitle(..)> - missing <SdrObject> instance" );
+ if ( !pMasterObject )
+ {
+ return;
+ }
+
+ if( bBroadcast )
+ {
+ SwStringMsgPoolItem aOld( RES_TITLE_CHANGED, pMasterObject->GetTitle() );
+ SwStringMsgPoolItem aNew( RES_TITLE_CHANGED, rTitle );
+ pMasterObject->SetTitle( rTitle );
+ Modify( &aOld, &aNew );
+ }
+ else
+ {
+ pMasterObject->SetTitle( rTitle );
+ }
+}
+
+const String SwFlyFrmFmt::GetObjTitle() const
+{
+ const SdrObject* pMasterObject = FindSdrObject();
+ ASSERT( pMasterObject,
+ "<SwFlyFrmFmt::GetObjTitle(..)> - missing <SdrObject> instance" );
+ if ( !pMasterObject )
+ {
+ return aEmptyStr;
+ }
+
+ return pMasterObject->GetTitle();
+}
+
+void SwFlyFrmFmt::SetObjDescription( const String& rDescription, bool bBroadcast )
+{
+ SdrObject* pMasterObject = FindSdrObject();
+ ASSERT( pMasterObject,
+ "<SwFlyFrmFmt::SetDescription(..)> - missing <SdrObject> instance" );
+ if ( !pMasterObject )
+ {
+ return;
+ }
+
+ if( bBroadcast )
+ {
+ SwStringMsgPoolItem aOld( RES_DESCRIPTION_CHANGED, pMasterObject->GetDescription() );
+ SwStringMsgPoolItem aNew( RES_DESCRIPTION_CHANGED, rDescription );
+ pMasterObject->SetDescription( rDescription );
+ Modify( &aOld, &aNew );
+ }
+ else
+ {
+ pMasterObject->SetDescription( rDescription );
+ }
+}
+
+const String SwFlyFrmFmt::GetObjDescription() const
+{
+ const SdrObject* pMasterObject = FindSdrObject();
+ ASSERT( pMasterObject,
+ "<SwNoTxtNode::GetDescription(..)> - missing <SdrObject> instance" );
+ if ( !pMasterObject )
+ {
+ return aEmptyStr;
+ }
+
+ return pMasterObject->GetDescription();
+}
+// <--
+
/** SwFlyFrmFmt::IsBackgroundTransparent - for #99657#
OD 22.08.2002 - overloading virtual method and its default implementation,
diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx
index 291affe8e9f8..03df27c86c0c 100644
--- a/sw/source/core/layout/colfrm.cxx
+++ b/sw/source/core/layout/colfrm.cxx
@@ -213,6 +213,15 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew,
{
if ( rOld.GetNumCols() <= 1 && rNew.GetNumCols() <= 1 && !bChgFtn )
return;
+ // --> OD 2009-08-12 #i97379#
+ // If current lower is a no text frame, then columns are not allowed
+ if ( Lower() && Lower()->IsNoTxtFrm() &&
+ rNew.GetNumCols() > 1 )
+ {
+ return;
+ }
+ // <--
+
USHORT nNewNum, nOldNum = 1;
if( Lower() && Lower()->IsColumnFrm() )
{
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 76e877555fe9..b829d201ce03 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2160,7 +2160,7 @@ BOOL SwFlowFrm::MoveBwd( BOOL &rbReformat )
// --> FME 2004-11-15 #i37084# FindLastCntnt does not necessarily
// have to have a result != 0
SwFrm* pRef = 0;
- const BOOL bEndnote = pFtn->GetAttr()->GetFtn().IsEndNote();
+ const bool bEndnote = pFtn->GetAttr()->GetFtn().IsEndNote();
if( bEndnote && pFtn->IsInSct() )
{
SwSectionFrm* pSect = pFtn->FindSctFrm();
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 808a5e4257e4..9ce3bc237db4 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -250,6 +250,18 @@ void SwFlyFrm::InsertCnt()
// OD 2004-02-12 #110582#-2
void SwFlyFrm::InsertColumns()
{
+ // --> OD 2009-08-12 #i97379#
+ // Check, if column are allowed.
+ // Columns are not allowed for fly frames, which represent graphics or embedded objects.
+ const SwFmtCntnt& rCntnt = GetFmt()->GetCntnt();
+ ASSERT( rCntnt.GetCntntIdx(), "<SwFlyFrm::InsertColumns()> - no content prepared." );
+ SwNodeIndex aFirstCntnt( *(rCntnt.GetCntntIdx()), 1 );
+ if ( aFirstCntnt.GetNode().IsNoTxtNode() )
+ {
+ return;
+ }
+ // <--
+
const SwFmtCol &rCol = GetFmt()->GetCol();
if ( rCol.GetNumCols() > 1 )
{
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 69b468bf3d68..f73457ae5565 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -852,7 +852,7 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn )
if ( !pRet )
{
- BOOL bEndn = pFtn->GetAttr()->GetFtn().IsEndNote();
+ bool bEndn = pFtn->GetAttr()->GetFtn().IsEndNote();
SwFrm* pTmpRef = NULL;
if( bEndn && pFtn->IsInSct() )
{
@@ -1442,7 +1442,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
if( IsInSct() )
{
SwSectionFrm* pMySect = ImplFindSctFrm();
- BOOL bEndnt = pNew->GetAttr()->GetFtn().IsEndNote();
+ bool bEndnt = pNew->GetAttr()->GetFtn().IsEndNote();
if( bEndnt )
{
const SwSectionFmt* pEndFmt = pMySect->GetEndSectFmt();
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 798ec6a05f89..b63854e15908 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2062,6 +2062,10 @@ void lcl_MoveAllLowerObjs( SwFrm* pFrm, const Point& rOffset )
pAnchoredDrawObj->DrawObj()->SetAnchorPos( aNewAnchorPos );
pAnchoredDrawObj->SetLastObjRect( pAnchoredDrawObj->GetObjRect().SVRect() );
}
+ // --> OD 2009-08-20 #i92511#
+ // cache for object rectangle inclusive spaces has to be invalidated.
+ pAnchoredObj->InvalidateObjRectWithSpaces();
+ // <--
}
}
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 65bfff2ae4b1..ea73a56cd8ca 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -296,10 +296,11 @@ void SwPageDesc::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
const USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
SwModify::Modify( pOld, pNew );
- if( RES_ATTRSET_CHG == nWhich || RES_FMT_CHG == nWhich ||
- ( nWhich >= RES_CHRATR_BEGIN && nWhich < RES_CHRATR_END ) ||
- nWhich == RES_PARATR_LINESPACING )
+ if ( (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich)
+ || isCHRATR(nWhich) || (RES_PARATR_LINESPACING == nWhich) )
+ {
RegisterChange();
+ }
}
static const SwFrm* lcl_GetFrmOfNode( const SwNode& rNd )
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 7e19c5e2f458..fa5f577fb700 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -112,6 +112,9 @@
#include <EnhancedPDFExportHelper.hxx>
// <--
+#include <ndole.hxx>
+#include <svtools/chartprettypainter.hxx>
+
#include <PostItMgr.hxx>
#include <tools/color.hxx>
#define COL_NOTES_SIDEPANE RGB_COLORDATA(230,230,230)
@@ -3512,6 +3515,19 @@ void SwFlyFrm::Paint( const SwRect& rRect ) const
const SwNoTxtFrm *pNoTxt = Lower() && Lower()->IsNoTxtFrm()
? (SwNoTxtFrm*)Lower() : 0;
+ bool bIsChart = false; //#i102950# don't paint additional borders for charts
+ //check whether we have a chart
+ if(pNoTxt)
+ {
+ const SwNoTxtNode* pNoTNd = dynamic_cast<const SwNoTxtNode*>(pNoTxt->GetNode());
+ if( pNoTNd )
+ {
+ SwOLENode* pOLENd = const_cast<SwOLENode*>(pNoTNd->GetOLENode());
+ if( pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() ) )
+ bIsChart = true;
+ }
+ }
+
{
bool bContour = GetFmt()->GetSurround().IsContour();
PolyPolygon aPoly;
@@ -3641,7 +3657,8 @@ void SwFlyFrm::Paint( const SwRect& rRect ) const
// OD 19.12.2002 #106318# - fly frame will paint it's subsidiary lines and
// the subsidiary lines of its lowers on its own, due to overlapping with
// other fly frames or other objects.
- if( pGlobalShell->GetWin() )
+ if( pGlobalShell->GetWin()
+ && !bIsChart ) //#i102950# don't paint additional borders for charts
{
bool bSubsLineRectsCreated;
if ( pSubsLines )
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index a983911edb63..542bc64196c5 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -129,6 +129,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab ):
else
delete pNew;
}
+ ASSERT( Lower() && Lower()->IsRowFrm(), "SwTabFrm::SwTabFrm: No rows." );
}
SwTabFrm::SwTabFrm( SwTabFrm &rTab ) :
@@ -2102,6 +2103,11 @@ void SwTabFrm::MakeAll()
{
bMovedFwd = TRUE;
bCalcLowers = TRUE;
+ // --> OD 2009-08-12 #i99267#
+ // reset <bSplit> after forward move to assure that follows
+ // can be joined, if further space is available.
+ bSplit = FALSE;
+ // <--
}
Point aOldPos( (Frm().*fnRect->fnGetPos)() );
@@ -2145,7 +2151,9 @@ void SwTabFrm::MakeAll()
if ( !bValidSize || !bValidPrtArea )
{
- const BOOL bOptLower = (Frm().*fnRect->fnGetHeight)() == 0;
+ // HB #i101593# no optimization as it leeds to not layouting certain nested tables
+ // const BOOL bOptLower = (Frm().*fnRect->fnGetHeight)() == 0;
+ const BOOL bOptLower = FALSE;
const long nOldPrtWidth = (Prt().*fnRect->fnGetWidth)();
const long nOldFrmWidth = (Frm().*fnRect->fnGetWidth)();
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 40af29efd18d..73f2b4d7fc42 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -961,7 +961,7 @@ USHORT SwRootFrm::SetCurrPage( SwCursor* pToSet, USHORT nPageNum )
pCNd->MakeStartIndex( (SwIndex*)&pToSet->GetPoint()->nContent );
pToSet->GetPoint()->nContent = ((SwTxtFrm*)pCntnt)->GetOfst();
- SwShellCrsr* pSCrsr = (SwShellCrsr*)*pToSet;
+ SwShellCrsr* pSCrsr = dynamic_cast<SwShellCrsr*>(pToSet);
if( pSCrsr )
{
Point &rPt = pSCrsr->GetPtPos();
@@ -1868,9 +1868,7 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr )
Point aPtPt, aMkPt;
{
- SwShellCrsr* pShCrsr = rTblCrsr.operator SwShellCrsr*();
- // Aufgrund eines CompilerBugs von Linux muss
- // der Zeigeroperator explizit gerufen werden
+ SwShellCrsr* pShCrsr = dynamic_cast<SwShellCrsr*>(&rTblCrsr);
if( pShCrsr )
{
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index c6afe50b5826..50abb4e9c7c7 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -467,7 +467,8 @@ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
(SwAttrSet*)GetpSwAttrSet() );
pOLENd->SetChartTblName( GetChartTblName() );
- pOLENd->SetAlternateText( GetAlternateText() );
+ pOLENd->SetTitle( GetTitle() );
+ pOLENd->SetDescription( GetDescription() );
pOLENd->SetContour( HasContour(), HasAutomaticContour() );
pOLENd->SetAspect( GetAspect() ); // the replacement image must be already copied
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index fcaf02e4b75a..f5a5690bbfd0 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <doc.hxx>
#ifndef _DOCSH_HXX
#include <docsh.hxx>
@@ -81,6 +82,21 @@ ULONG SwXMLTextBlocks::GetDoc( USHORT nIdx )
ReadXML->SetBlockMode( sal_True );
aReader.Read( *ReadXML );
ReadXML->SetBlockMode( sal_False );
+ // Ole objects fails to display when inserted into document
+ // because the ObjectReplacement folder ( and contents are missing )
+ rtl::OUString sObjReplacements( RTL_CONSTASCII_USTRINGPARAM( "ObjectReplacements" ) );
+ if ( xRoot->hasByName( sObjReplacements ) )
+ {
+ uno::Reference< document::XStorageBasedDocument > xDocStor( pDoc->GetDocShell()->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< embed::XStorage > xStr( xDocStor->getDocumentStorage() );
+ if ( xStr.is() )
+ {
+ xRoot->copyElementTo( sObjReplacements, xStr, sObjReplacements );
+ uno::Reference< embed::XTransactedObject > xTrans( xStr, uno::UNO_QUERY );
+ if ( xTrans.is() )
+ xTrans->commit();
+ }
+ }
}
catch( uno::Exception& )
{
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 3fd60b03efeb..7959b6de3cb4 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -698,7 +698,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
const SwNoTxtFrm* pNoTxtFrm = static_cast<const SwNoTxtFrm*>(pFly->Lower());
const SwNoTxtNode* pNoTxtNode = static_cast<const SwNoTxtNode*>(pNoTxtFrm->GetNode());
- const String aAlternateTxt( pNoTxtNode->GetAlternateText() );
+ const String aAlternateTxt( pNoTxtNode->GetTitle() );
mpPDFExtOutDevData->SetAlternateText( aAlternateTxt );
}
}
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index eb4148264931..bd9a0b1418d3 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -35,9 +35,7 @@
#include <errhdl.hxx> // ASSERT
#include <atrhndl.hxx>
#include <svtools/itemiter.hxx>
-#ifndef _OUTDEV_HXX //autogen
#include <vcl/outdev.hxx>
-#endif
#include <svx/cmapitem.hxx>
#include <svx/colritem.hxx>
#include <svx/cntritem.hxx>
@@ -56,9 +54,7 @@
#include <svx/akrnitem.hxx>
#include <svx/blnkitem.hxx>
#include <svx/charrotateitem.hxx>
-#ifndef _SVX_EMPHITEM_HXX
#include <svx/emphitem.hxx>
-#endif
#include <svx/charscaleitem.hxx>
#include <svx/twolinesitem.hxx>
#include <svx/charhiddenitem.hxx>
@@ -250,12 +246,14 @@ bool lcl_ChgHyperLinkColor( const SwTxtAttr& rAttr,
if ( pColor )
{
// take color from character format 'unvisited link'
- ((SwTxtINetFmt&)rAttr).SetVisited( FALSE );
+ SwTxtINetFmt& rInetAttr( const_cast<SwTxtINetFmt&>(
+ static_cast<const SwTxtINetFmt&>(rAttr)) );
+ rInetAttr.SetVisited( false );
const SwCharFmt* pTmpFmt = ((SwTxtINetFmt&)rAttr).GetCharFmt();
const SfxPoolItem* pItem;
pTmpFmt->GetItemState( RES_CHRATR_COLOR, TRUE, &pItem );
*pColor = ((SvxColorItem*)pItem)->GetValue();
- ((SwTxtINetFmt&)rAttr).SetVisited( TRUE );
+ rInetAttr.SetVisited( true );
}
return true;
}
@@ -446,7 +444,7 @@ void SwAttrHandler::Init( const SfxPoolItem** pPoolItem, const SwAttrSet* pAS,
while( TRUE )
{
nWhich = pItem->Which();
- if( RES_CHRATR_BEGIN <= nWhich && RES_CHRATR_END > nWhich )
+ if (isCHRATR(nWhich))
{
pDefaultArray[ StackPos[ nWhich ] ] = pItem;
FontChg( *pItem, rFnt, sal_True );
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 676171a343b2..f86a767dcec2 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -644,7 +644,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm()
{
SwFtnBossFrm *pFtnBoss = 0;
SwFtnBossFrm *pEndBoss = 0;
- for( MSHORT i = 0; i < pHints->Count(); ++i )
+ for ( USHORT i = 0; i < pHints->Count(); ++i )
{
const SwTxtAttr *pHt = (*pHints)[i];
if( RES_TXTATR_FTN==pHt->Which() && *pHt->GetStart()>=nStart )
@@ -744,7 +744,7 @@ SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos )
{
SwFtnBossFrm *pFtnBoss = 0;
SwFtnBossFrm *pEndBoss = 0;
- for( MSHORT i = 0; i < pHints->Count(); ++i )
+ for ( USHORT i = 0; i < pHints->Count(); ++i )
{
const SwTxtAttr *pHt = (*pHints)[i];
if( RES_TXTATR_FTN==pHt->Which() && *pHt->GetStart()>=nTxtPos )
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index c07ff50d57ea..82d88875090d 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -65,9 +65,7 @@
#include <itrtxt.hxx>
#include <breakit.hxx>
#include <com/sun/star/i18n/WordType.hpp>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
using namespace ::com::sun::star::i18n;
using namespace ::com::sun::star;
@@ -128,11 +126,11 @@ SwAttrIter::~SwAttrIter()
SwTxtAttr *SwAttrIter::GetAttr( const xub_StrLen nPosition ) const
{
- if( pHints )
+ if ( pHints )
{
- for( MSHORT i = 0; i < pHints->Count(); ++i )
+ for ( USHORT i = 0; i < pHints->Count(); ++i )
{
- SwTxtAttr *pPos = pHints->GetHt(i);
+ SwTxtAttr *pPos = pHints->GetTextHint(i);
xub_StrLen nStart = *pPos->GetStart();
if( nPosition < nStart )
return 0;
@@ -669,7 +667,7 @@ void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax,
SwAttrIter aIter( *(SwTxtNode*)this, aScriptInfo );
xub_StrLen nIdx = 0;
aIter.SeekAndChgAttrIter( nIdx, pOut );
- xub_StrLen nLen = aText.Len();
+ xub_StrLen nLen = m_Text.Len();
long nAktWidth = 0;
MSHORT nAdd = 0;
SwMinMaxArgs aArg( pOut, pSh, rMin, rMax, rAbsMin );
@@ -683,7 +681,7 @@ void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax,
xub_Unicode cChar = CH_BLANK;
nStop = nIdx;
while( nStop < nLen && nStop < nNextChg &&
- CH_TAB != ( cChar = aText.GetChar( nStop ) ) &&
+ CH_TAB != ( cChar = m_Text.GetChar( nStop ) ) &&
CH_BREAK != cChar && CHAR_HARDBLANK != cChar &&
CHAR_HARDHYPHEN != cChar && CHAR_SOFTHYPHEN != cChar &&
!pHint )
@@ -692,8 +690,10 @@ void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax,
|| ( 0 == ( pHint = aIter.GetAttr( nStop ) ) ) )
++nStop;
}
- if( lcl_MinMaxString( aArg, aIter.GetFnt(), aText, nIdx, nStop ) )
+ if ( lcl_MinMaxString( aArg, aIter.GetFnt(), m_Text, nIdx, nStop ) )
+ {
nAdd = 20;
+ }
nIdx = nStop;
aIter.SeekAndChgAttrIter( nIdx, pOut );
switch( cChar )
@@ -933,7 +933,7 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd )
// stop at special characters in [ nIdx, nNextChg ]
while( nStop < nEnd && nStop < nNextChg )
{
- cChar = aText.GetChar( nStop );
+ cChar = m_Text.GetChar( nStop );
if( CH_TAB == cChar || CH_BREAK == cChar ||
CHAR_HARDBLANK == cChar || CHAR_HARDHYPHEN == cChar ||
CHAR_SOFTHYPHEN == cChar ||
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 00440427eaf8..2f01085b89f9 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1973,6 +1973,7 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
nReformat -= 2;
#ifndef QUARTZ
+#ifndef ENABLE_GRAPHITE
// --> FME 2004-09-27 #i28795#, #i34607#, #i38388#
// step back six(!) more characters for complex scripts
// this is required e.g., for Khmer (thank you, Javier!)
@@ -1981,6 +1982,10 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
if( ::i18n::ScriptType::COMPLEX == rSI.ScriptType( nReformat ) )
nMaxContext = 6;
#else
+ // Some Graphite fonts need context for scripts not marked as complex
+ static const xub_StrLen nMaxContext = 10;
+#endif
+#else
// some fonts like Quartz's Zapfino need more context
// TODO: query FontInfo for maximum unicode context
static const xub_StrLen nMaxContext = 8;
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 9b14d52256e7..dc789beb9235 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -450,7 +450,7 @@ void SwTxtIter::TruncLines( sal_Bool bNoteFollow )
// examine hints in range nEnd - (nEnd + nRangeChar)
for( USHORT i = 0; i < pTmpHints->Count(); i++ )
{
- const SwTxtAttr* pHt = pTmpHints->GetHt( i );
+ const SwTxtAttr* pHt = pTmpHints->GetTextHint( i );
if( RES_TXTATR_FLYCNT == pHt->Which() )
{
// check, if hint is in our range
diff --git a/sw/source/core/text/makefile.mk b/sw/source/core/text/makefile.mk
index 745f66eaf08a..d710c9797997 100644
--- a/sw/source/core/text/makefile.mk
+++ b/sw/source/core/text/makefile.mk
@@ -45,6 +45,9 @@ AUTOSEG=true
CDEFS+=-Dmydebug
.ENDIF
+.IF "$(ENABLE_GRAPHITE)" == "TRUE"
+CFLAGS+=-DENABLE_GRAPHITE
+.ENDIF
# --- Files --------------------------------------------------------
SLOFILES = \
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 59788c6395ef..55c905b7e679 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -212,9 +212,9 @@ xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch )
if( !pHints )
return STRING_LEN;
SwTxtAttr* pFound = NULL;
- for( MSHORT i = 0; i < pHints->Count(); i++)
+ for ( USHORT i = 0; i < pHints->Count(); i++)
{
- SwTxtAttr *pHt = pHints->GetHt( i );
+ SwTxtAttr *pHt = pHints->GetTextHint( i );
if( RES_TXTATR_FLYCNT == pHt->Which() )
{
SwFrmFmt* pFrmFmt = pHt->GetFlyCnt().GetFrmFmt();
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 4a69f12097dd..1a8a1a210d01 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: porlay.cxx,v $
- * $Revision: 1.67.190.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -45,15 +42,10 @@
#include <porrst.hxx> // SwHangingPortion
#include <pormulti.hxx> // SwMultiPortion
#include <breakit.hxx>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
+#include <unicode/uchar.h>
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
-#ifndef _COM_SUN_STAR_I18N_CTLSCRIPTTYPE_HDL_
#include <com/sun/star/i18n/CTLScriptType.hdl>
-#endif
-#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HDL
#include <com/sun/star/i18n/WordType.hdl>
-#endif
#include <paratr.hxx>
#include <svx/adjitem.hxx>
#include <svx/scripttypeitem.hxx>
@@ -1036,7 +1028,26 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
}
// <--
- aScriptChg.Insert( nChg, nCnt );
+ // special case for dotted circle since it can be used with complex
+ // before a mark, so we want it associated with the mark's script
+ if (nChg < rTxt.Len() && nChg > 0 && (i18n::ScriptType::WEAK ==
+ pBreakIt->xBreak->getScriptType(rTxt,nChg - 1)))
+ {
+ int8_t nType = u_charType(rTxt.GetChar(nChg) );
+ if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK ||
+ nType == U_COMBINING_SPACING_MARK )
+ {
+ aScriptChg.Insert( nChg - 1, nCnt );
+ }
+ else
+ {
+ aScriptChg.Insert( nChg, nCnt );
+ }
+ }
+ else
+ {
+ aScriptChg.Insert( nChg, nCnt );
+ }
aScriptType.Insert( nScript, nCnt++ );
// if current script is asian, we search for compressable characters
@@ -1113,7 +1124,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// we search for connecting opportunities (kashida)
else if ( bAdjustBlock && i18n::ScriptType::COMPLEX == nScript )
{
- SwScanner aScanner( rNode, rNode.aText, 0, 0,
+ SwScanner aScanner( rNode, rNode.GetTxt(), 0, 0,
i18n::WordType::DICTIONARY_WORD,
nLastKashida, nChg );
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 70d094e53597..c6b100f1b746 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -155,7 +155,7 @@ sal_Bool SwTxtSizeInfo::_HasHint( const SwTxtNode* pTxtNode, xub_StrLen nPos )
const SwpHints *pHints = pTxtNode->GetpSwpHints();
if( !pHints )
return sal_False;
- for( MSHORT i = 0; i < pHints->Count(); ++i )
+ for ( USHORT i = 0; i < pHints->Count(); ++i )
{
const SwTxtAttr *pPos = (*pHints)[i];
xub_StrLen nStart = *pPos->GetStart();
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 2fe945ef58b4..0e50f7d269e4 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -500,18 +500,4 @@ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const
}
return pRet;
}
-/* -----------------26.06.2003 13:54-----------------
- --------------------------------------------------*/
-void SwTxtFld::NotifyContentChange(SwFmtFld& rFmtFld)
-{
- //if not in undo section notify the change
- if(pMyTxtNd && pMyTxtNd->GetNodes().IsDocNodes())
- pMyTxtNd->Modify(0, &rFmtFld);
-}
-
-// #111840#
-SwPosition * SwTxtFld::GetPosition() const
-{
- return GetTxtNode().GetPosition(this);
-}
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index e7f0fcd88fb1..f447e380aff9 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -451,9 +451,9 @@ void SwTxtFrm::HideFootnotes( xub_StrLen nStart, xub_StrLen nEnd )
const SwpHints *pHints = GetTxtNode()->GetpSwpHints();
if( pHints )
{
- const MSHORT nSize = pHints->Count();
+ const USHORT nSize = pHints->Count();
SwPageFrm *pPage = 0;
- for( MSHORT i = 0; i < nSize; ++i )
+ for ( USHORT i = 0; i < nSize; ++i )
{
const SwTxtAttr *pHt = (*pHints)[i];
if ( pHt->Which() == RES_TXTATR_FTN )
@@ -505,9 +505,9 @@ bool lcl_HideObj( const SwTxtFrm& _rFrm,
const SwTxtAttr* pHint( 0 );
if( pHints )
{
- for( MSHORT i = 0; i < pHints->Count(); ++i )
+ for ( USHORT i = 0; i < pHints->Count(); ++i )
{
- SwTxtAttr* pPos = pHints->GetHt(i);
+ SwTxtAttr* pPos = pHints->GetTextHint(i);
xub_StrLen nStart = *pPos->GetStart();
if ( _nObjAnchorPos < nStart )
break;
@@ -1040,7 +1040,7 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
_InvalidateRange( SwCharRange( nPos, nLen) );
MSHORT nTmp = ((SwUpdateAttr*)pNew)->nWhichAttr;
- if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_AUTOFMT ||
+ if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_AUTOFMT == nTmp ||
RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp )
{
SET_WRONG( nPos, nPos + nLen, false )
@@ -1654,10 +1654,10 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
SwpHints *pHints = GetTxtNode()->GetpSwpHints();
if( pHints )
{
- const MSHORT nSize = pHints->Count();
+ const USHORT nSize = pHints->Count();
const xub_StrLen nEnd = GetFollow() ?
GetFollow()->GetOfst() : STRING_LEN;
- for( MSHORT i = 0; i < nSize; ++i )
+ for ( USHORT i = 0; i < nSize; ++i )
{
const SwTxtAttr *pHt = (*pHints)[i];
const xub_StrLen nStart = *pHt->GetStart();
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index b2d443083f4a..61c4110a6761 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -118,7 +118,7 @@ void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm
if( !pHints )
return;
- const MSHORT nSize = pHints->Count();
+ const USHORT nSize = pHints->Count();
#ifndef DBG_UTIL
const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN;
@@ -127,7 +127,7 @@ void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm
: GetFollow() ? GetFollow()->GetOfst() : STRING_LEN;
#endif
- for( MSHORT i = 0; i < nSize; ++i )
+ for ( USHORT i = 0; i < nSize; ++i )
{
const SwTxtAttr *pHt = (*pHints)[i];
if ( pHt->Which() == RES_TXTATR_FTN )
@@ -452,7 +452,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen )
return;
sal_Bool bRollBack = nLen != STRING_LEN;
- MSHORT nSize = pHints->Count();
+ USHORT nSize = pHints->Count();
xub_StrLen nEnd;
SwTxtFrm* pSource;
if( bRollBack )
@@ -476,9 +476,9 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen )
SwFtnBossFrm *pEndBoss = 0;
sal_Bool bFtnEndDoc
= FTNPOS_CHAPTER == GetNode()->GetDoc()->GetFtnInfo().ePos;
- for( MSHORT i = nSize; i; )
+ for ( USHORT i = nSize; i; )
{
- SwTxtAttr *pHt = pHints->GetHt(--i);
+ SwTxtAttr *pHt = pHints->GetTextHint(--i);
if ( RES_TXTATR_FTN != pHt->Which() )
continue;
diff --git a/sw/source/core/text/txtio.cxx b/sw/source/core/text/txtio.cxx
index e75944bc85a1..1d77783bfdc6 100644
--- a/sw/source/core/text/txtio.cxx
+++ b/sw/source/core/text/txtio.cxx
@@ -276,49 +276,8 @@ void LayOutPut( const SwFrm* pFrm )
SvStream &operator<<( SvStream &rOs, const SwpHints & ) //$ ostream
{
rOs << " {HINTS:";
-#ifdef JP_NEWCORE
- for( MSHORT i = 0; i < rHints.GetSize(); ++i)
- {
- SwTxtHint *pHint = (SwTxtHint*) rHints[i];
-
- if(0 != GetCharWidth(pHint))
- rOs << "CHARWIDTH" << ' '; // << GetCharWidth(pHint)->frCPI;
- else if(0 != GetColor(pHint))
- rOs << "COLOR" << ' ' ; // << GetColor(pHint)->aColor;
- else if(0 != GetCrossedOut(pHint))
- rOs << "CROSSEDOUT" << ' ' << (MSHORT)(GetCrossedOut(pHint)->nState);
- else if(0 != GetAttrFont(pHint))
- rOs << "ATTRFONT" << ' ' <<
- (const char *)(GetAttrFont(pHint)->sFamilyName) << ',' <<
- ((MSHORT) GetAttrFont(pHint)->eFamily);
- else if(0 != GetPosture(pHint))
- rOs << "POSTURE" << ' ' << GetPosture(pHint)->nPosture;
- else if(0 != GetFontSize(pHint))
- rOs << "FONTSIZE" << ' ' << GetFontSize(pHint)->nSize;
- else if(0 != GetUnderline(pHint))
- rOs << "UNDERLINE" << ' ' << (MSHORT)(GetUnderline(pHint)->nState);
- else if(0 != GetOverline(pHint))
- rOs << "OVERLINE" << ' ' << (MSHORT)(GetOverline(pHint)->nState);
- else if(0 != GetWeight(pHint))
- rOs << "WEIGHT" << ' ' << GetWeight(pHint)->nWeight;
- else if(0 != GetContour(pHint))
- rOs << "CONTOUR" << ' ' << GetContour(pHint)->nState;
- else if(0 != GetShadowed(pHint))
- rOs << "SHADOWED" << ' ' << GetShadowed(pHint)->nState;
- else if(0 != GetAutoKern(pHint))
- rOs << "AUTOKERN" << ' ' << GetAutoKern(pHint)->nState;
- else if(0 != GetWordLineMode(pHint))
- rOs << "WORDLINEMODE" << ' ' << GetWordLineMode(pHint)->nState;
- else
- rOs << pHint->Which();
- rOs << ',' << pHint->GetStart()->GetIndex()
- << '-'
- << (pHint->GetEnd() ? pHint->GetEnd()->GetIndex() : STRING_LEN)
- << "\n";
- }
-#endif
- // JP_NEWCORE
+// REMOVED
rOs << '}';
return rOs;
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index aac39d5b2643..434239c12b30 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -254,8 +254,14 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto )
// <--
( ( bRTL && nCurrentAbsPos > nTabLeft - nForced ) ||
( !bRTL && nCurrentAbsPos < nTabLeft + nForced ) ) &&
- nNextPos > nForced )
- // <--
+ // --> OD 2009-07-21 #i103685#
+ // adjust condition:
+ // - back to pre OOo 3.0 condition, if tab stops are relative to indent
+ // - further checks needed, if tab stops are not relative to indent
+ ( nNextPos > 0 &&
+ ( bTabsRelativeToIndent ||
+ ( !pTabStop || nNextPos > nForced ) ) ) )
+ // <--
{
eAdj = SVX_TAB_ADJUST_DEFAULT;
cFill = 0;
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 4a934d395d27..f83b862f9902 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -718,40 +718,49 @@ String SwTOXPara::GetURL() const
{
const SwTxtNode * pTxtNd = static_cast<const SwTxtNode *>(pNd);
- //if( MAXLEVEL >= pTxtNd->GetTxtColl()->GetOutlineLevel()) //#outline level,zhaojianwei
- if ( pTxtNd->GetAttrOutlineLevel() > 0) //<-end,zhaojianwei
- {
- aTxt = '#';
- const SwNumRule * pRule = pTxtNd->GetNumRule();
- if( pRule )
- {
- // dann noch die rel. Nummer davor setzen
- const USHORT nCurrLevel = static_cast<USHORT>(pTxtNd->GetActualListLevel());
- if(nCurrLevel <= MAXLEVEL)
- {
- // --> OD 2005-11-02 #i51089 - TUNING#
- if ( pTxtNd->GetNum() )
- {
- SwNumberTree::tNumberVector aNumVector =
- pTxtNd->GetNumberVector();
-
- for( USHORT n = 0; n <= nCurrLevel; ++n )
- {
- int nNum = aNumVector[ n ];
- nNum -= ( pRule->Get( n ).GetStart() - 1 );
- ( aTxt += String::CreateFromInt32( nNum )) += '.';
- }
- }
- else
- {
- ASSERT( false,
- "<SwTOXPara::GetURL()> - text node with numbering rule, but without number. This is a serious defect -> inform OD" );
- }
- }
- }
- aTxt += pTxtNd->GetExpandTxt();
- ( aTxt += cMarkSeperator ).AppendAscii( pMarkToOutline );
- }
+ // --> OD 2009-08-05 #i103265#
+// //if( MAXLEVEL >= pTxtNd->GetTxtColl()->GetOutlineLevel()) //#outline level,zhaojianwei
+// if ( pTxtNd->GetAttrOutlineLevel() > 0) //<-end,zhaojianwei
+// {
+// aTxt = '#';
+// const SwNumRule * pRule = pTxtNd->GetNumRule();
+// if( pRule )
+// {
+// // dann noch die rel. Nummer davor setzen
+// const USHORT nCurrLevel = static_cast<USHORT>(pTxtNd->GetActualListLevel());
+// if(nCurrLevel <= MAXLEVEL)
+// {
+// // --> OD 2005-11-02 #i51089 - TUNING#
+// if ( pTxtNd->GetNum() )
+// {
+// SwNumberTree::tNumberVector aNumVector =
+// pTxtNd->GetNumberVector();
+
+// for( USHORT n = 0; n <= nCurrLevel; ++n )
+// {
+// int nNum = aNumVector[ n ];
+// nNum -= ( pRule->Get( n ).GetStart() - 1 );
+// ( aTxt += String::CreateFromInt32( nNum )) += '.';
+// }
+// }
+// else
+// {
+// ASSERT( false,
+// "<SwTOXPara::GetURL()> - text node with numbering rule, but without number. This is a serious defect -> inform OD" );
+// }
+// }
+// }
+// aTxt += pTxtNd->GetExpandTxt();
+// ( aTxt += cMarkSeperator ).AppendAscii( pMarkToOutline );
+// }
+ SwDoc* pDoc = const_cast<SwDoc*>( pTxtNd->GetDoc() );
+ ::sw::mark::IMark const * const pMark = pDoc->getIDocumentMarkAccess()->getMarkForTxtNode(
+ *(pTxtNd),
+ IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK);
+ aTxt = '#';
+ const String aMarkName( pMark->GetName() );
+ aTxt += aMarkName;
+ // <--
}
break;
@@ -943,4 +952,3 @@ BOOL SwTOXAuthority::operator<( const SwTOXSortTabBase& rBase)
}
return bRet;
}
-
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 14ac562f64d9..2bf117afb251 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -255,12 +255,12 @@ BOOL SwFmtFld::IsProtect() const
|*
*************************************************************************/
-SwTxtFld::SwTxtFld( const SwFmtFld& rAttr, xub_StrLen nStartPos )
- : SwTxtAttr( rAttr, nStartPos ),
- aExpand( rAttr.GetFld()->Expand() ),
- pMyTxtNd( 0 )
+SwTxtFld::SwTxtFld( SwFmtFld& rAttr, xub_StrLen nStartPos )
+ : SwTxtAttr( rAttr, nStartPos )
+ , m_aExpand( rAttr.GetFld()->Expand() )
+ , m_pTxtNode( 0 )
{
- ((SwFmtFld&)rAttr).pTxtAttr = this;
+ rAttr.pTxtAttr = this;
}
SwTxtFld::~SwTxtFld( )
@@ -280,12 +280,12 @@ SwTxtFld::~SwTxtFld( )
void SwTxtFld::Expand() const
{
// Wenn das expandierte Feld sich nicht veraendert hat, wird returnt
- ASSERT( pMyTxtNd, "wo ist denn mein Node?" );
+ ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" );
const SwField* pFld = GetFld().GetFld();
XubString aNewExpand( pFld->Expand() );
- if( aNewExpand == aExpand )
+ if( aNewExpand == m_aExpand )
{
// Bei Seitennummernfeldern
const USHORT nWhich = pFld->GetTyp()->Which();
@@ -301,16 +301,18 @@ void SwTxtFld::Expand() const
// BP: das muesste man noch optimieren!
//JP 12.06.97: stimmt, man sollte auf jedenfall eine Status-
// aenderung an die Frames posten
- if( pMyTxtNd->CalcHiddenParaField() )
- pMyTxtNd->Modify( 0, 0 );
+ if( m_pTxtNode->CalcHiddenParaField() )
+ {
+ m_pTxtNode->Modify( 0, 0 );
+ }
return;
}
}
- aExpand = aNewExpand;
+ m_aExpand = aNewExpand;
- // 0, this fuer Formatieren
- pMyTxtNd->Modify( 0, (SfxPoolItem*)&GetFld() );
+ // 0, this for formatting
+ m_pTxtNode->Modify( 0, const_cast<SwFmtFld*>( &GetFld() ) );
}
/*************************************************************************
@@ -319,11 +321,11 @@ void SwTxtFld::Expand() const
void SwTxtFld::CopyFld( SwTxtFld *pDest ) const
{
- ASSERT( pMyTxtNd, "wo ist denn mein Node?" );
- ASSERT( pDest->pMyTxtNd, "wo ist denn mein Node?" );
+ ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" );
+ ASSERT( pDest->m_pTxtNode, "SwTxtFld: where is pDest's TxtNode?" );
- IDocumentFieldsAccess* pIDFA = pMyTxtNd->getIDocumentFieldsAccess();
- IDocumentFieldsAccess* pDestIDFA = pDest->pMyTxtNd->getIDocumentFieldsAccess();
+ IDocumentFieldsAccess* pIDFA = m_pTxtNode->getIDocumentFieldsAccess();
+ IDocumentFieldsAccess* pDestIDFA = pDest->m_pTxtNode->getIDocumentFieldsAccess();
SwFmtFld& rFmtFld = (SwFmtFld&)pDest->GetFld();
const USHORT nFldWhich = rFmtFld.GetFld()->GetTyp()->Which();
@@ -366,10 +368,22 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest ) const
((SwTblField*)rFmtFld.GetFld())->IsIntrnlName() )
{
// erzeuge aus der internen (fuer CORE) die externe (fuer UI) Formel
- const SwTableNode* pTblNd = pMyTxtNd->FindTableNode();
+ const SwTableNode* pTblNd = m_pTxtNode->FindTableNode();
if( pTblNd ) // steht in einer Tabelle
((SwTblField*)rFmtFld.GetFld())->PtrToBoxNm( &pTblNd->GetTable() );
}
}
+/* -----------------26.06.2003 13:54-----------------
+
+ --------------------------------------------------*/
+void SwTxtFld::NotifyContentChange(SwFmtFld& rFmtFld)
+{
+ //if not in undo section notify the change
+ if (m_pTxtNode && m_pTxtNode->GetNodes().IsDocNodes())
+ {
+ m_pTxtNode->Modify(0, &rFmtFld);
+ }
+}
+
diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx
index b33b90ffa9a8..d738497507a8 100644
--- a/sw/source/core/txtnode/atrflyin.cxx
+++ b/sw/source/core/txtnode/atrflyin.cxx
@@ -70,10 +70,10 @@ SfxPoolItem* __EXPORT SwFmtFlyCnt::Clone( SfxItemPool* ) const
return new SwFmtFlyCnt( pFmt );
}
-SwTxtFlyCnt::SwTxtFlyCnt( const SwFmtFlyCnt& rAttr, xub_StrLen nStartPos )
+SwTxtFlyCnt::SwTxtFlyCnt( SwFmtFlyCnt& rAttr, xub_StrLen nStartPos )
: SwTxtAttr( rAttr, nStartPos )
{
- ((SwFmtFlyCnt&)rAttr).pTxtAttr = this;
+ rAttr.pTxtAttr = this;
}
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index 96a4f4d90761..4b51e94e3404 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -62,11 +62,11 @@
*************************************************************************/
-SwFmtFtn::SwFmtFtn( BOOL bEN )
+SwFmtFtn::SwFmtFtn( bool bEndNote )
: SfxPoolItem( RES_TXTATR_FTN ),
pTxtAttr( 0 ),
nNumber( 0 ),
- bEndNote( bEN )
+ m_bEndNote( bEndNote )
{
}
@@ -76,7 +76,7 @@ int SwFmtFtn::operator==( const SfxPoolItem& rAttr ) const
ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
return nNumber == ((SwFmtFtn&)rAttr).nNumber &&
aNumber == ((SwFmtFtn&)rAttr).aNumber &&
- bEndNote == ((SwFmtFtn&)rAttr).bEndNote;
+ m_bEndNote == ((SwFmtFtn&)rAttr).m_bEndNote;
}
@@ -85,17 +85,19 @@ SfxPoolItem* SwFmtFtn::Clone( SfxItemPool* ) const
SwFmtFtn* pNew = new SwFmtFtn;
pNew->aNumber = aNumber;
pNew->nNumber = nNumber;
- pNew->bEndNote = bEndNote;
+ pNew->m_bEndNote = m_bEndNote;
return pNew;
}
-void SwFmtFtn::SetEndNote( BOOL b )
+void SwFmtFtn::SetEndNote( bool b )
{
- if ( b != bEndNote )
+ if ( b != m_bEndNote )
{
if ( GetTxtFtn() )
+ {
GetTxtFtn()->DelFrms();
- bEndNote = b;
+ }
+ m_bEndNote = b;
}
}
@@ -173,13 +175,13 @@ XubString SwFmtFtn::GetViewNumStr( const SwDoc& rDoc, BOOL bInclStrings ) const
* class SwTxt/FmtFnt
*************************************************************************/
-SwTxtFtn::SwTxtFtn( const SwFmtFtn& rAttr, xub_StrLen nStartPos )
- : SwTxtAttr( rAttr, nStartPos ),
- pStartNode( 0 ),
- pMyTxtNd( 0 ),
- nSeqNo( USHRT_MAX )
+SwTxtFtn::SwTxtFtn( SwFmtFtn& rAttr, xub_StrLen nStartPos )
+ : SwTxtAttr( rAttr, nStartPos )
+ , m_pStartNode( 0 )
+ , m_pTxtNode( 0 )
+ , m_nSeqNo( USHRT_MAX )
{
- ((SwFmtFtn&)rAttr).pTxtAttr = this;
+ rAttr.pTxtAttr = this;
}
@@ -194,19 +196,25 @@ void SwTxtFtn::SetStartNode( const SwNodeIndex *pNewNode, BOOL bDelNode )
{
if( pNewNode )
{
- if( !pStartNode )
- pStartNode = new SwNodeIndex( *pNewNode );
+ if ( !m_pStartNode )
+ {
+ m_pStartNode = new SwNodeIndex( *pNewNode );
+ }
else
- *pStartNode = *pNewNode;
+ {
+ *m_pStartNode = *pNewNode;
+ }
}
- else if( pStartNode )
+ else if ( m_pStartNode )
{
// Zwei Dinge muessen erledigt werden:
// 1) Die Fussnoten muessen bei ihren Seiten abgemeldet werden
// 2) Die Fussnoten-Sektion in den Inserts muss geloescht werden.
SwDoc* pDoc;
- if( pMyTxtNd )
- pDoc = pMyTxtNd->GetDoc();
+ if ( m_pTxtNode )
+ {
+ pDoc = m_pTxtNode->GetDoc();
+ }
else
{
//JP 27.01.97: der sw3-Reader setzt einen StartNode aber das
@@ -214,7 +222,7 @@ void SwTxtFtn::SetStartNode( const SwNodeIndex *pNewNode, BOOL bDelNode )
// Wird es geloescht (z.B. bei Datei einfuegen mit
// Ftn in einen Rahmen), muss auch der Inhalt
// geloescht werden
- pDoc = pStartNode->GetNodes().GetDoc();
+ pDoc = m_pStartNode->GetNodes().GetDoc();
}
// Wir duerfen die Fussnotennodes nicht loeschen
@@ -226,7 +234,7 @@ void SwTxtFtn::SetStartNode( const SwNodeIndex *pNewNode, BOOL bDelNode )
{
// 1) Die Section fuer die Fussnote wird beseitigt
// Es kann sein, dass die Inserts schon geloescht wurden.
- pDoc->DeleteSection( &pStartNode->GetNode() );
+ pDoc->DeleteSection( &m_pStartNode->GetNode() );
}
else
// Werden die Nodes nicht geloescht mussen sie bei den Seiten
@@ -234,7 +242,7 @@ void SwTxtFtn::SetStartNode( const SwNodeIndex *pNewNode, BOOL bDelNode )
// stehen (Undo loescht sie nicht!)
DelFrms();
}
- DELETEZ( pStartNode );
+ DELETEZ( m_pStartNode );
// loesche die Fussnote noch aus dem Array am Dokument
for( USHORT n = 0; n < pDoc->GetFtnIdxs().Count(); ++n )
@@ -264,16 +272,15 @@ void SwTxtFtn::SetNumber( const USHORT nNewNum, const XubString* pStr )
rFtn.aNumber = aEmptyStr;
}
- ASSERT( pMyTxtNd, "wo ist mein TextNode?" );
- SwNodes &rNodes = pMyTxtNd->GetDoc()->GetNodes();
- pMyTxtNd->Modify( 0, &rFtn );
- if( pStartNode )
+ ASSERT( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" );
+ SwNodes &rNodes = m_pTxtNode->GetDoc()->GetNodes();
+ m_pTxtNode->Modify( 0, &rFtn );
+ if ( m_pStartNode )
{
- // Wir muessen ueber alle TxtNodes iterieren, wegen der
- // Fussnoten, die auf anderen Seiten stehen.
+ // must iterate over all TxtNodes because of footnotes on other pages
SwNode* pNd;
- ULONG nSttIdx = pStartNode->GetIndex() + 1,
- nEndIdx = pStartNode->GetNode().EndOfSectionIndex();
+ ULONG nSttIdx = m_pStartNode->GetIndex() + 1;
+ ULONG nEndIdx = m_pStartNode->GetNode().EndOfSectionIndex();
for( ; nSttIdx < nEndIdx; ++nSttIdx )
{
// Es koennen ja auch Grafiken in der Fussnote stehen ...
@@ -286,15 +293,15 @@ void SwTxtFtn::SetNumber( const USHORT nNewNum, const XubString* pStr )
// Die Fussnoten duplizieren
void SwTxtFtn::CopyFtn( SwTxtFtn *pDest )
{
- if( pStartNode && pDest->GetStartNode() )
+ if ( m_pStartNode && pDest->GetStartNode() )
{
// die Fussnoten koennen in unterschiedlichen Dokumenten stehen !!
- SwDoc* pDstDoc = pDest->pMyTxtNd->GetDoc();
+ SwDoc* pDstDoc = pDest->m_pTxtNode->GetDoc();
SwNodes &rDstNodes = pDstDoc->GetNodes();
// Wir kopieren nur den Inhalt der Sektion
- SwNodeRange aRg( *pStartNode, 1,
- *pStartNode->GetNode().EndOfSectionNode() );
+ SwNodeRange aRg( *m_pStartNode, 1,
+ *m_pStartNode->GetNode().EndOfSectionNode() );
// Wir fuegen auf dem Ende von pDest ein, d.h. die Nodes
// werden angehaengt. nDestLen haelt die Anzahl der CntNodes
@@ -303,7 +310,7 @@ void SwTxtFtn::CopyFtn( SwTxtFtn *pDest )
SwNodeIndex aEnd( *aStart.GetNode().EndOfSectionNode() );
ULONG nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1;
- pMyTxtNd->GetDoc()->CopyWithFlyInFly( aRg, aEnd, TRUE );
+ m_pTxtNode->GetDoc()->CopyWithFlyInFly( aRg, 0, aEnd, TRUE );
// Wenn die Dest-Sektion nicht leer war, so muessen die alten
// Nodes geloescht werden:
@@ -323,7 +330,7 @@ void SwTxtFtn::CopyFtn( SwTxtFtn *pDest )
// lege eine neue leere TextSection fuer diese Fussnote an
void SwTxtFtn::MakeNewTextSection( SwNodes& rNodes )
{
- if( pStartNode )
+ if ( m_pStartNode )
return;
// Nun verpassen wir dem TxtNode noch die Fussnotenvorlage.
@@ -347,20 +354,20 @@ void SwTxtFtn::MakeNewTextSection( SwNodes& rNodes )
SwStartNode* pSttNd = rNodes.MakeTextSection( SwNodeIndex( rNodes.GetEndOfInserts() ),
SwFootnoteStartNode, pFmtColl );
- pStartNode = new SwNodeIndex( *pSttNd );
+ m_pStartNode = new SwNodeIndex( *pSttNd );
}
void SwTxtFtn::DelFrms()
{
- // loesche die Ftn-Frames aus den Seiten
- ASSERT( pMyTxtNd, "wo ist mein TextNode?" );
- if( !pMyTxtNd )
- return ;
+ // delete the FtnFrames from the pages
+ ASSERT( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" );
+ if ( !m_pTxtNode )
+ return;
BOOL bFrmFnd = FALSE;
{
- SwClientIter aIter( *pMyTxtNd );
+ SwClientIter aIter( *m_pTxtNode );
for( SwCntntFrm* pFnd = (SwCntntFrm*)aIter.First( TYPE( SwCntntFrm ));
pFnd; pFnd = (SwCntntFrm*)aIter.Next() )
{
@@ -374,10 +381,10 @@ void SwTxtFtn::DelFrms()
}
//JP 13.05.97: falls das Layout vorm loeschen der Fussnoten entfernt
// wird, sollte man das ueber die Fussnote selbst tun
- if( !bFrmFnd && pStartNode )
+ if ( !bFrmFnd && m_pStartNode )
{
- SwNodeIndex aIdx( *pStartNode );
- SwCntntNode* pCNd = pMyTxtNd->GetNodes().GoNext( &aIdx );
+ SwNodeIndex aIdx( *m_pStartNode );
+ SwCntntNode* pCNd = m_pTxtNode->GetNodes().GoNext( &aIdx );
if( pCNd )
{
SwClientIter aIter( *pCNd );
@@ -415,10 +422,10 @@ void SwTxtFtn::DelFrms()
USHORT SwTxtFtn::SetSeqRefNo()
{
- if( !pMyTxtNd )
+ if( !m_pTxtNode )
return USHRT_MAX;
- SwDoc* pDoc = pMyTxtNd->GetDoc();
+ SwDoc* pDoc = m_pTxtNode->GetDoc();
if( pDoc->IsInReading() )
return USHRT_MAX;
@@ -431,20 +438,33 @@ USHORT SwTxtFtn::SetSeqRefNo()
// bestimmt werden muss.
SwTxtFtn* pTxtFtn;
for( n = 0; n < nFtnCnt; ++n )
- if( (pTxtFtn = pDoc->GetFtnIdxs()[ n ]) != this )
- aArr.Insert( pTxtFtn->nSeqNo );
+ {
+ pTxtFtn = pDoc->GetFtnIdxs()[ n ];
+ if ( pTxtFtn != this )
+ {
+ aArr.Insert( pTxtFtn->m_nSeqNo );
+ }
+ }
- // teste erstmal ob die Nummer schon vorhanden ist:
- if( USHRT_MAX != nSeqNo )
+ // test if number is already in use
+ if ( USHRT_MAX != m_nSeqNo )
{
for( n = 0; n < aArr.Count(); ++n )
- if( aArr[ n ] > nSeqNo )
- return nSeqNo; // nicht vorhanden -> also benutzen
- else if( aArr[ n ] == nSeqNo )
- break; // schon vorhanden -> neue erzeugen
+ {
+ if ( aArr[ n ] > m_nSeqNo )
+ {
+ return m_nSeqNo; // free -> use
+ }
+ else if ( aArr[ n ] == m_nSeqNo )
+ {
+ break; // used -> create new one
+ }
+ }
- if( n == aArr.Count() )
- return nSeqNo; // nicht vorhanden -> also benutzen
+ if ( n == aArr.Count() )
+ {
+ return m_nSeqNo; // free -> use
+ }
}
// alle Nummern entsprechend geflag, also bestimme die richtige Nummer
@@ -452,7 +472,7 @@ USHORT SwTxtFtn::SetSeqRefNo()
if( n != aArr[ n ] )
break;
- return nSeqNo = n;
+ return m_nSeqNo = n;
}
void SwTxtFtn::SetUniqueSeqRefNo( SwDoc& rDoc )
@@ -465,29 +485,45 @@ void SwTxtFtn::SetUniqueSeqRefNo( SwDoc& rDoc )
// dann alle Nummern zusammensammeln die schon existieren
SwTxtFtn* pTxtFtn;
for( n = 0; n < nFtnCnt; ++n )
- if( USHRT_MAX != (pTxtFtn = rDoc.GetFtnIdxs()[ n ])->nSeqNo )
- aArr.Insert( pTxtFtn->nSeqNo );
+ {
+ pTxtFtn = rDoc.GetFtnIdxs()[ n ];
+ if ( USHRT_MAX != pTxtFtn->m_nSeqNo )
+ {
+ aArr.Insert( pTxtFtn->m_nSeqNo );
+ }
+ }
for( n = 0; n < nFtnCnt; ++n )
- if( USHRT_MAX == (pTxtFtn = rDoc.GetFtnIdxs()[ n ])->nSeqNo )
+ {
+ pTxtFtn = rDoc.GetFtnIdxs()[ n ];
+ if ( USHRT_MAX == pTxtFtn->m_nSeqNo )
{
for( ; nStt < aArr.Count(); ++nStt )
- if( nStt != aArr[ nStt ] )
+ {
+ if ( nStt != aArr[ nStt ] )
{
-
- pTxtFtn->nSeqNo = nStt;
+ pTxtFtn->m_nSeqNo = nStt;
break;
}
+ }
- if( USHRT_MAX == pTxtFtn->nSeqNo )
- break; // nichts mehr gefunden
+ if ( USHRT_MAX == pTxtFtn->m_nSeqNo )
+ {
+ break; // found nothing
+ }
}
+ }
// alle Nummern schon vergeben, also mit nStt++ weitermachen
for( ; n < nFtnCnt; ++n )
- if( USHRT_MAX == (pTxtFtn = rDoc.GetFtnIdxs()[ n ])->nSeqNo )
- pTxtFtn->nSeqNo = nStt++;
+ {
+ pTxtFtn = rDoc.GetFtnIdxs()[ n ];
+ if ( USHRT_MAX == pTxtFtn->m_nSeqNo )
+ {
+ pTxtFtn->m_nSeqNo = nStt++;
+ }
+ }
}
void SwTxtFtn::CheckCondColl()
diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx
index 210cd1ab2889..ea427f8e8877 100644
--- a/sw/source/core/txtnode/atrref.cxx
+++ b/sw/source/core/txtnode/atrref.cxx
@@ -79,25 +79,25 @@ SfxPoolItem* SwFmtRefMark::Clone( SfxItemPool* ) const
// Attribut fuer Inhalts-/Positions-Referenzen im Text
-SwTxtRefMark::SwTxtRefMark( const SwFmtRefMark& rAttr,
- xub_StrLen nStartPos, xub_StrLen* pEnde )
- : SwTxtAttrEnd( rAttr, nStartPos, nStartPos ),
- pMyTxtNd( 0 ),
- pEnd( 0 )
+SwTxtRefMark::SwTxtRefMark( SwFmtRefMark& rAttr,
+ xub_StrLen nStartPos, xub_StrLen* pEnd )
+ : SwTxtAttrEnd( rAttr, nStartPos, nStartPos )
+ , m_pTxtNode( 0 )
+ , m_pEnd( 0 )
{
- ((SwFmtRefMark&)rAttr).pTxtAttr = this;
- if( pEnde )
+ rAttr.pTxtAttr = this;
+ if ( pEnd )
{
- nEnd = *pEnde;
- pEnd = &nEnd;
+ m_nEnd = *pEnd;
+ m_pEnd = & m_nEnd;
}
- SetDontMergeAttr( TRUE );
- SetDontMoveAttr( TRUE );
- SetOverlapAllowedAttr( TRUE );
+ SetDontMergeAttr( true );
+ SetDontMoveAttr( true );
+ SetOverlapAllowedAttr( true );
}
xub_StrLen* SwTxtRefMark::GetEnd()
{
- return pEnd;
+ return m_pEnd;
}
diff --git a/sw/source/core/txtnode/atrtox.cxx b/sw/source/core/txtnode/atrtox.cxx
index 5581d891b79a..5cc9388dcbcd 100644
--- a/sw/source/core/txtnode/atrtox.cxx
+++ b/sw/source/core/txtnode/atrtox.cxx
@@ -38,21 +38,21 @@
#include <tox.hxx>
#include <ndtxt.hxx>
-SwTxtTOXMark::SwTxtTOXMark( const SwTOXMark& rAttr,
- xub_StrLen nStartPos, xub_StrLen* pEnde )
- : SwTxtAttrEnd( rAttr, nStartPos, nStartPos ),
- pEnd( 0 ),
- pMyTxtNd( 0 )
+SwTxtTOXMark::SwTxtTOXMark( SwTOXMark& rAttr,
+ xub_StrLen nStartPos, xub_StrLen* pEnd )
+ : SwTxtAttrEnd( rAttr, nStartPos, nStartPos )
+ , m_pTxtNode( 0 )
+ , m_pEnd( 0 )
{
- ((SwTOXMark&)rAttr).pTxtAttr = this;
- if( !rAttr.GetAlternativeText().Len() )
+ rAttr.pTxtAttr = this;
+ if ( !rAttr.GetAlternativeText().Len() )
{
- nEnd = *pEnde;
- pEnd = &nEnd;
+ m_nEnd = *pEnd;
+ m_pEnd = & m_nEnd;
}
- SetDontMergeAttr( TRUE );
- SetDontMoveAttr( TRUE );
- SetOverlapAllowedAttr( TRUE );
+ SetDontMergeAttr( true );
+ SetDontMoveAttr( true );
+ SetOverlapAllowedAttr( true );
}
SwTxtTOXMark::~SwTxtTOXMark()
@@ -61,7 +61,7 @@ SwTxtTOXMark::~SwTxtTOXMark()
xub_StrLen* SwTxtTOXMark::GetEnd()
{
- return pEnd;
+ return m_pEnd;
}
void SwTxtTOXMark::CopyTOXMark( SwDoc* pDoc )
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 63e87c962b7b..9eb06844972c 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -152,6 +152,7 @@ SwFntObj::SwFntObj( const SwSubFont &rFont, const void *pOwn, ViewShell *pSh ) :
|| UNDERLINE_NONE != aFont.GetOverline()
|| STRIKEOUT_NONE != aFont.GetStrikeout() )
&& !aFont.IsWordLineMode();
+ aFont.SetLanguage(rFont.GetLanguage());
}
SwFntObj::~SwFntObj()
@@ -912,10 +913,10 @@ static void lcl_DrawLineForWrongListData(
if (rInf.GetOut().GetConnectMetaFile())
rInf.GetOut().Push();
- const Color aCol( rInf.GetOut().GetTextLineColor() );
+ const Color aCol( rInf.GetOut().GetLineColor() );
const BOOL bColSave = aCol != aLineColor;
if (bColSave)
- rInf.GetOut().SetTextLineColor( aLineColor );
+ rInf.GetOut().SetLineColor( aLineColor );
// iterate over all ranges stored in the respective SwWrongList
do
@@ -986,7 +987,7 @@ static void lcl_DrawLineForWrongListData(
while (nWrLen && pWList->Check( nStart, nWrLen ));
if (bColSave)
- rInf.GetOut().SetTextLineColor( aCol );
+ rInf.GetOut().SetLineColor( aCol );
if (rInf.GetOut().GetConnectMetaFile())
rInf.GetOut().Pop();
@@ -1906,10 +1907,10 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
WRONG_SHOW_MEDIUM < nHght ? WAVE_NORMAL :
( WRONG_SHOW_SMALL < nHght ? WAVE_SMALL :
WAVE_FLAT );
- Color aCol( rInf.GetOut().GetTextLineColor() );
+ Color aCol( rInf.GetOut().GetLineColor() );
BOOL bColSave = aCol != *pWaveCol;
if ( bColSave )
- rInf.GetOut().SetTextLineColor( *pWaveCol );
+ rInf.GetOut().SetLineColor( *pWaveCol );
Point aEnd;
long nKernVal = pKernArray[ USHORT( rInf.GetLen() - 1 ) ];
@@ -1956,7 +1957,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
rInf.GetOut().DrawWaveLine( aCurrPos, aEnd, nWave );
if ( bColSave )
- rInf.GetOut().SetTextLineColor( aCol );
+ rInf.GetOut().SetLineColor( aCol );
if ( rInf.GetOut().GetConnectMetaFile() )
rInf.GetOut().Pop();
@@ -2797,7 +2798,7 @@ sal_Bool SwDrawTextInfo::ApplyAutoColor( Font* pFont )
if ( COL_BLACK != rFnt.GetColor().GetColor() )
bChgFntColor = sal_True;
- if ( (COL_BLACK != GetOut().GetTextLineColor().GetColor()) ||
+ if ( (COL_BLACK != GetOut().GetLineColor().GetColor()) ||
(COL_BLACK != GetOut().GetOverlineColor().GetColor()) )
bChgLineColor = sal_True;
}
@@ -2894,8 +2895,8 @@ sal_Bool SwDrawTextInfo::ApplyAutoColor( Font* pFont )
{
// get current font color or color set at output device
aNewColor = pFont ? pFont->GetColor() : GetOut().GetFont().GetColor();
- if ( aNewColor != GetOut().GetTextLineColor() )
- GetOut().SetTextLineColor( aNewColor );
+ if ( aNewColor != GetOut().GetLineColor() )
+ GetOut().SetLineColor( aNewColor );
if ( aNewColor != GetOut().GetOverlineColor() )
GetOut().SetOverlineColor( aNewColor );
}
diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index 339b7c905158..3f5438d293e3 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -2,6 +2,7 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -237,39 +238,41 @@ BOOL SwpHtEnd::Seek_Entry( const SwTxtAttr *pElement, USHORT *pPos ) const
* class SwpHintsArr
*************************************************************************/
-void SwpHintsArr::Insert( const SwTxtAttr *pHt )
+void SwpHintsArray::Insert( const SwTxtAttr *pHt )
{
Resort();
#ifdef DBG_UTIL
USHORT nPos;
- ASSERT(!SwpHtStart::Seek_Entry( pHt, &nPos ), "Insert: hint already in HtStart");
- ASSERT(!aHtEnd.Seek_Entry( pHt, &nPos ), "Insert: hint already in HtEnd");
+ ASSERT(!m_HintStarts.Seek_Entry( pHt, &nPos ),
+ "Insert: hint already in HtStart");
+ ASSERT(!m_HintEnds.Seek_Entry( pHt, &nPos ),
+ "Insert: hint already in HtEnd");
#endif
- SwpHtStart::Insert( pHt );
- aHtEnd.Insert( pHt );
+ m_HintStarts.Insert( pHt );
+ m_HintEnds.Insert( pHt );
#ifdef DBG_UTIL
#ifdef NIE
- (aDbstream << "Insert: " ).WriteNumber( long( pHt ) )<< endl;
- DumpHints( *this, aHtEnd );
+ (aDbstream << "Insert: " ).WriteNumber( long( pHt ) ) << endl;
+ DumpHints( m_HintStarts, m_HintEnds );
#endif
#endif
}
-void SwpHintsArr::DeleteAtPos( const USHORT nPos )
+void SwpHintsArray::DeleteAtPos( const USHORT nPos )
{
- // Optimierung: nPos bezieht sich auf die Position im StartArray, also:
- const SwTxtAttr *pHt = SwpHtStart::operator[]( nPos );
- SwpHtStart::Remove( nPos );
+ // optimization: nPos is the position in the Starts array
+ const SwTxtAttr *pHt = m_HintStarts[ nPos ];
+ m_HintStarts.Remove( nPos );
Resort();
USHORT nEndPos;
- aHtEnd.Seek_Entry( pHt, &nEndPos );
- aHtEnd.Remove( nEndPos );
+ m_HintEnds.Seek_Entry( pHt, &nEndPos );
+ m_HintEnds.Remove( nEndPos );
#ifdef DBG_UTIL
#ifdef NIE
- (aDbstream << "DeleteAtPos: " ).WriteNumber( long( pHt ) )<< endl;
- DumpHints( *this, aHtEnd );
+ (aDbstream << "DeleteAtPos: " ).WriteNumber( long( pHt ) ) << endl;
+ DumpHints( m_HintStarts, m_HintEnds );
#endif
#endif
}
@@ -277,7 +280,7 @@ void SwpHintsArr::DeleteAtPos( const USHORT nPos )
#ifdef DBG_UTIL
/*************************************************************************
- * SwpHintsArr::Check()
+ * SwpHintsArray::Check()
*************************************************************************/
@@ -285,14 +288,15 @@ void SwpHintsArr::DeleteAtPos( const USHORT nPos )
if(!(cond)) \
{ \
ASSERT(!this, text); \
- DumpHints(*(SwpHtStart*)this,aHtEnd); \
- return !((SwpHintsArr*)this)->Resort(); \
+ DumpHints(m_HintStarts, m_HintEnds); \
+ return !(const_cast<SwpHintsArray*>(this))->Resort(); \
}
-BOOL SwpHintsArr::Check() const
+bool SwpHintsArray::Check() const
{
// 1) gleiche Anzahl in beiden Arrays
- CHECK_ERR( Count() == aHtEnd.Count(), "HintsCheck: wrong sizes" );
+ CHECK_ERR( m_HintStarts.Count() == m_HintEnds.Count(),
+ "HintsCheck: wrong sizes" );
xub_StrLen nLastStart = 0;
xub_StrLen nLastEnd = 0;
@@ -304,7 +308,7 @@ BOOL SwpHintsArr::Check() const
// --- Start-Kontrolle ---
// 2a) gueltiger Pointer? vgl. DELETEFF
- const SwTxtAttr *pHt = (*this)[i];
+ const SwTxtAttr *pHt = m_HintStarts[i];
CHECK_ERR( 0xFF != *(unsigned char*)pHt, "HintsCheck: start ptr was deleted" );
// 3a) Stimmt die Start-Sortierung?
@@ -321,7 +325,7 @@ BOOL SwpHintsArr::Check() const
// --- End-Kontrolle ---
// 2b) gueltiger Pointer? vgl. DELETEFF
- const SwTxtAttr *pHtEnd = aHtEnd[i];
+ const SwTxtAttr *pHtEnd = m_HintEnds[i];
CHECK_ERR( 0xFF != *(unsigned char*)pHtEnd, "HintsCheck: end ptr was deleted" );
// 3b) Stimmt die End-Sortierung?
@@ -339,47 +343,48 @@ BOOL SwpHintsArr::Check() const
// --- Ueberkreuzungen ---
// 5) gleiche Pointer in beiden Arrays
- if( !Seek_Entry( pHt, &nIdx ) )
+ if( !m_HintStarts.Seek_Entry( pHt, &nIdx ) )
nIdx = STRING_LEN;
CHECK_ERR( STRING_LEN != nIdx, "HintsCheck: no GetStartOf" );
// 6) gleiche Pointer in beiden Arrays
- if( !aHtEnd.Seek_Entry( pHt, &nIdx ) )
+ if( !m_HintEnds.Seek_Entry( pHt, &nIdx ) )
nIdx = STRING_LEN;
CHECK_ERR( STRING_LEN != nIdx, "HintsCheck: no GetEndOf" );
// 7a) character attributes in array?
USHORT nWhich = pHt->Which();
- CHECK_ERR( nWhich < RES_CHRATR_BEGIN || nWhich >= RES_CHRATR_END,
- "HintsCheck: Character attribute in start array" )
+ CHECK_ERR( !isCHRATR(nWhich),
+ "HintsCheck: Character attribute in start array" );
// 7b) character attributes in array?
nWhich = pHtEnd->Which();
- CHECK_ERR( nWhich < RES_CHRATR_BEGIN || nWhich >= RES_CHRATR_END,
- "HintsCheck: Character attribute in end array" )
+ CHECK_ERR( !isCHRATR(nWhich),
+ "HintsCheck: Character attribute in end array" );
// 8) portion check
#if OSL_DEBUG_LEVEL > 1
- const SwTxtAttr* pHtThis = (*this)[i];
- const SwTxtAttr* pHtLast = i > 0 ? (*this)[i-1] : 0;
+ const SwTxtAttr* pHtThis = m_HintStarts[i];
+ const SwTxtAttr* pHtLast = i > 0 ? m_HintStarts[i-1] : 0;
CHECK_ERR( 0 == i ||
( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) ||
( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) ||
( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) ||
( *pHtThis->GetStart() == *pHtLast->GetStart() && *pHtThis->GetEnd() == *pHtLast->GetEnd() ) ||
( *pHtThis->GetStart() == *pHtThis->GetEnd() ),
- "HintsCheck: Portion inconsistency. This can be temporarily ok during undo operations" )
+ "HintsCheck: Portion inconsistency. "
+ "This can be temporarily ok during undo operations" );
#endif
}
- return TRUE;
+ return true;
}
#endif /* PRODUCT */
/*************************************************************************
- * SwpHintsArr::Resort()
+ * SwpHintsArray::Resort()
*************************************************************************/
// Resort() wird vor jedem Insert und Delete gerufen.
@@ -387,61 +392,61 @@ BOOL SwpHintsArr::Check() const
// ndtxt.cxx angepasst. Leider erfolgt noch keine Neusortierung
// auf gleichen Positionen.
-BOOL SwpHintsArr::Resort()
+bool SwpHintsArray::Resort()
{
- BOOL bResort = FALSE;
+ bool bResort = false;
const SwTxtAttr *pLast = 0;
USHORT i;
- for( i = 0; i < SwpHtStart::Count(); ++i )
+ for ( i = 0; i < m_HintStarts.Count(); ++i )
{
- const SwTxtAttr *pHt = (*this)[i];
+ const SwTxtAttr *pHt = m_HintStarts[i];
if( pLast && !lcl_IsLessStart( *pLast, *pHt ) )
{
#ifdef NIE
#ifdef DBG_UTIL
// ASSERT( bResort, "!Resort/Start: correcting hints-array" );
aDbstream << "Resort: Starts" << endl;
- DumpHints( *this, aHtEnd );
+ DumpHints( m_HintStarts, m_HintEnds );
#endif
#endif
- SwpHtStart::Remove( i );
- SwpHtStart::Insert( pHt );
- pHt = (*this)[i];
+ m_HintStarts.Remove( i );
+ m_HintStarts.Insert( pHt );
+ pHt = m_HintStarts[i];
if ( pHt != pLast )
--i;
- bResort = TRUE;
+ bResort = true;
}
pLast = pHt;
}
pLast = 0;
- for( i = 0; i < aHtEnd.Count(); ++i )
+ for ( i = 0; i < m_HintEnds.Count(); ++i )
{
- const SwTxtAttr *pHt = aHtEnd[i];
+ const SwTxtAttr *pHt = m_HintEnds[i];
if( pLast && !lcl_IsLessEnd( *pLast, *pHt ) )
{
#ifdef NIE
#ifdef DBG_UTIL
aDbstream << "Resort: Ends" << endl;
- DumpHints( *this, aHtEnd );
+ DumpHints( m_HintStarts, m_HintEnds );
#endif
#endif
- aHtEnd.Remove( i );
- aHtEnd.Insert( pHt );
- pHt = aHtEnd[i]; // normalerweise == pLast
+ m_HintEnds.Remove( i );
+ m_HintEnds.Insert( pHt );
+ pHt = m_HintEnds[i]; // normalerweise == pLast
// Wenn die Unordnung etwas groesser ist (24200),
// muessen wir Position i erneut vergleichen.
if ( pLast != pHt )
--i;
- bResort = TRUE;
+ bResort = true;
}
pLast = pHt;
}
#ifdef DBG_UTIL
#ifdef NIE
aDbstream << "Resorted:" << endl;
- DumpHints( *this, aHtEnd );
+ DumpHints( m_HintStarts, m_HintEnds );
#endif
#endif
return bResort;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index ad35bdeb53a2..f4de9de36675 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -33,9 +33,6 @@
#include <hintids.hxx>
#include <hints.hxx>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
-#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
#include <svx/fontitem.hxx>
#include <svx/brkitem.hxx>
#include <svx/escpitem.hxx>
@@ -95,9 +92,7 @@
#include <numrule.hxx>
//--> #outlinelevel added by zhaojianwei
-#ifndef _SFXINTITEM_HXX
#include <svtools/intitem.hxx>
-#endif
//<--end
#include <swtable.hxx>
#include <docsh.hxx>
@@ -235,10 +230,10 @@ SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere,
SwTxtFmtColl *pTxtColl,
const SfxItemSet* pAutoAttr )
: SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ),
- pSwpHints( 0 ),
+ m_pSwpHints( 0 ),
mpNodeNum( 0 ),
- bNotifiable( false ),
- bLastOutlineState( FALSE ),
+ m_bLastOutlineState( false ),
+ m_bNotifiable( false ),
//nOutlineLevel( pTxtColl->GetOutlineLevel() )//#outline level, removed by zhaojianwei.
// --> OD 2008-11-19 #i70748#
mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ),
@@ -263,26 +258,26 @@ SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere,
// <--
GetNodes().UpdateOutlineNode(*this);
- bNotifiable = true;
+ m_bNotifiable = true;
- bContainsHiddenChars = bHiddenCharsHidePara = FALSE;
- bRecalcHiddenCharFlags = TRUE;
+ m_bContainsHiddenChars = m_bHiddenCharsHidePara = false;
+ m_bRecalcHiddenCharFlags = true;
}
SwTxtNode::~SwTxtNode()
{
// delete loescht nur die Pointer, nicht die Arrayelemente!
- if( pSwpHints )
+ if ( m_pSwpHints )
{
// damit Attribute die ihren Inhalt entfernen nicht doppelt
// geloescht werden.
- SwpHints* pTmpHints = pSwpHints;
- pSwpHints = 0;
+ SwpHints* pTmpHints = m_pSwpHints;
+ m_pSwpHints = 0;
for( USHORT j = pTmpHints->Count(); j; )
// erst muss das Attribut aus dem Array entfernt werden,
// denn sonst wuerde es sich selbst loeschen (Felder) !!!!
- DestroyAttr( pTmpHints->GetHt( --j ) );
+ DestroyAttr( pTmpHints->GetTextHint( --j ) );
delete pTmpHints;
}
@@ -308,7 +303,7 @@ SwCntntFrm *SwTxtNode::MakeFrm()
xub_StrLen SwTxtNode::Len() const
{
- return aText.Len();
+ return m_Text.Len();
}
/*---------------------------------------------------------------------------
@@ -330,7 +325,8 @@ void lcl_ChangeFtnRef( SwTxtNode &rNode )
SwFtnFrm* pFirstFtnOfNode = 0;
for( USHORT j = pSwpHints->Count(); j; )
{
- if( RES_TXTATR_FTN == (pHt = pSwpHints->GetHt(--j))->Which() )
+ pHt = pSwpHints->GetTextHint(--j);
+ if (RES_TXTATR_FTN == pHt->Which())
{
if( !pFrm )
{
@@ -395,9 +391,21 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
{
// lege den Node "vor" mir an
xub_StrLen nSplitPos = rPos.nContent.GetIndex();
- xub_StrLen nTxtLen = aText.Len();
+ xub_StrLen nTxtLen = m_Text.Len();
SwTxtNode* pNode = _MakeNewTxtNode( rPos.nNode, FALSE, nSplitPos==nTxtLen );
+ // the first paragraph gets the XmlId,
+ // _except_ if it is empty and the second is not empty
+ if (nSplitPos != 0) {
+ pNode->RegisterAsCopyOf(*this, true);
+ if (nSplitPos == nTxtLen)
+ {
+ this->RemoveMetadataReference();
+ // NB: SwUndoSplitNode will call pNode->JoinNext,
+ // which is sufficient even in this case!
+ }
+ }
+
// --> OD 2008-03-27 #refactorlists#
// // --> OD 2007-07-09 #i77372#
// // reset numbering attribute at current node, only if it is numbered.
@@ -417,7 +425,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
}
// <--
- if( GetDepends() && aText.Len() && (nTxtLen / 2) < nSplitPos )
+ if ( GetDepends() && m_Text.Len() && (nTxtLen / 2) < nSplitPos )
{
// JP 25.04.95: Optimierung fuer SplitNode:
// Wird am Ende vom Node gesplittet, dann verschiebe die
@@ -428,11 +436,9 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
// werden FlyFrames mit verschoben, so muessen diese nicht ihre
// Frames zerstoeren. Im SwTxtFly::SetAnchor wird es abgefragt!
- if( pSwpHints )
+ if ( HasHints() )
{
- if( !pNode->pSwpHints )
- pNode->pSwpHints = new SwpHints;
- pNode->pSwpHints->bInSplitNode = TRUE;
+ pNode->GetOrCreateSwpHints().SetInSplitNode(true);
}
//Ersten Teil des Inhalts in den neuen Node uebertragen und
@@ -455,35 +461,41 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
pNode->SetSmartTags( GetSmartTags()->SplitList( nSplitPos ) );
SetSmartTagDirty( true );
- if( pNode->pSwpHints )
+ if ( pNode->HasHints() )
{
- if ( pNode->pSwpHints->CanBeDeleted() )
+ if ( pNode->m_pSwpHints->CanBeDeleted() )
{
- delete pNode->pSwpHints;
- pNode->pSwpHints = 0;
+ delete pNode->m_pSwpHints;
+ pNode->m_pSwpHints = 0;
}
else
- pNode->pSwpHints->bInSplitNode = FALSE;
+ {
+ pNode->m_pSwpHints->SetInSplitNode(false);
+ }
// alle zeichengebundenen Rahmen, die im neuen Absatz laden
// muessen aus den alten Frame entfernt werden:
// JP 01.10.96: alle leeren und nicht zu expandierenden
// Attribute loeschen
- if( pSwpHints )
+ if ( HasHints() )
{
SwTxtAttr* pHt;
xub_StrLen* pEnd;
- for( USHORT j = pSwpHints->Count(); j; )
- if( RES_TXTATR_FLYCNT ==
- ( pHt = pSwpHints->GetHt( --j ) )->Which() )
+ for ( USHORT j = m_pSwpHints->Count(); j; )
+ {
+ pHt = m_pSwpHints->GetTextHint( --j );
+ if ( RES_TXTATR_FLYCNT == pHt ->Which() )
+ {
pHt->GetFlyCnt().GetFrmFmt()->DelFrms();
+ }
else if( pHt->DontExpand() && 0 != ( pEnd = pHt->GetEnd() )
&& *pHt->GetStart() == *pEnd )
{
- // loeschen!
- pSwpHints->DeleteAtPos( j );
+ // delete it!
+ m_pSwpHints->DeleteAtPos( j );
DestroyAttr( pHt );
}
+ }
}
}
@@ -531,8 +543,10 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
pNode->SwModify::Modify( 0, &aHint );
}
}
- if( pSwpHints )
+ if ( HasHints() )
+ {
MoveTxtAttr_To_AttrSet();
+ }
pNode->MakeFrms( *this ); // neue Frames anlegen.
lcl_ChangeFtnRef( *this );
}
@@ -558,18 +572,21 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
// JP 01.10.96: alle leeren und nicht zu expandierenden
// Attribute loeschen
- if( pSwpHints )
+ if ( HasHints() )
{
SwTxtAttr* pHt;
xub_StrLen* pEnd;
- for( USHORT j = pSwpHints->Count(); j; )
- if( ( pHt = pSwpHints->GetHt( --j ) )->DontExpand() &&
- 0 != ( pEnd = pHt->GetEnd() ) && *pHt->GetStart() == *pEnd )
+ for ( USHORT j = m_pSwpHints->Count(); j; )
+ {
+ pHt = m_pSwpHints->GetTextHint( --j );
+ pEnd = pHt->GetEnd();
+ if ( pHt->DontExpand() && pEnd && (*pHt->GetStart() == *pEnd) )
{
- // loeschen!
- pSwpHints->DeleteAtPos( j );
+ // delete it!
+ m_pSwpHints->DeleteAtPos( j );
DestroyAttr( pHt );
}
+ }
MoveTxtAttr_To_AttrSet();
}
@@ -612,10 +629,10 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
void SwTxtNode::MoveTxtAttr_To_AttrSet()
{
- ASSERT( pSwpHints, "MoveTxtAttr_To_AttrSet without SwpHints?" );
- for( USHORT i = 0; pSwpHints && i < pSwpHints->Count(); ++i )
+ ASSERT( m_pSwpHints, "MoveTxtAttr_To_AttrSet without SwpHints?" );
+ for ( USHORT i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
- SwTxtAttr *pHt = pSwpHints->GetHt(i);
+ SwTxtAttr *pHt = m_pSwpHints->GetTextHint(i);
if( *pHt->GetStart() )
break;
@@ -625,13 +642,13 @@ void SwTxtNode::MoveTxtAttr_To_AttrSet()
if( !pHtEndIdx )
continue;
- if( *pHtEndIdx < aText.Len() || pHt->IsCharFmtAttr() )
+ if ( *pHtEndIdx < m_Text.Len() || pHt->IsCharFmtAttr() )
break;
if( !pHt->IsDontMoveAttr() &&
SetAttr( pHt->GetAttr() ) )
{
- pSwpHints->DeleteAtPos(i);
+ m_pSwpHints->DeleteAtPos(i);
DestroyAttr( pHt );
--i;
}
@@ -649,7 +666,10 @@ SwCntntNode *SwTxtNode::JoinNext()
SvULongs aBkmkArr( 15, 15 );
_SaveCntntIdx( pDoc, aIdx.GetIndex(), USHRT_MAX, aBkmkArr, SAVEFLY );
SwTxtNode *pTxtNode = aIdx.GetNode().GetTxtNode();
- xub_StrLen nOldLen = aText.Len();
+ xub_StrLen nOldLen = m_Text.Len();
+
+ // METADATA: merge
+ this->JoinMetadatable(*pTxtNode, !this->Len(), !pTxtNode->Len());
SwWrongList *pList = GetWrong();
if( pList )
@@ -857,7 +877,7 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
SetAutoCompleteWordDirty( TRUE );
TmpHints* pCollector = NULL;
- if( pSwpHints )
+ if ( HasHints() )
{
xub_StrLen nPos = aPos.GetIndex();
xub_StrLen* pIdx;
@@ -865,10 +885,10 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
if( bNegativ )
{
xub_StrLen nMax = nPos + nLen;
- for( USHORT n = 0; n < pSwpHints->Count(); ++n )
+ for ( USHORT n = 0; n < m_pSwpHints->Count(); ++n )
{
BOOL bSttBefore = FALSE;
- pHt = pSwpHints->GetHt(n);
+ pHt = m_pSwpHints->GetTextHint(n);
pIdx = pHt->GetStart();
if( *pIdx >= nPos )
{
@@ -898,7 +918,7 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
}
}
- pSwpHints->MergePortions( *this );
+ m_pSwpHints->MergePortions( *this );
}
else
{
@@ -913,17 +933,20 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
BOOL aDontExp[ coArrSz ];
memset( &aDontExp, 0, coArrSz * sizeof(BOOL) );
- for( USHORT n = 0; n < pSwpHints->Count(); ++n )
+ for ( USHORT n = 0; n < m_pSwpHints->Count(); ++n )
{
- pHt = pSwpHints->GetHt(n);
+ pHt = m_pSwpHints->GetTextHint(n);
pIdx = pHt->GetStart();
- if( *pIdx >= nPos )
+ pEnd = pHt->GetEnd();
+ if ( *pIdx >= nPos )
{
*pIdx = *pIdx + nLen;
- if( 0 != ( pEnd = pHt->GetEnd() ) )
+ if ( pEnd )
+ {
*pEnd = *pEnd + nLen;
+ }
}
- else if( 0 != ( pEnd = pHt->GetEnd() ) && *pEnd >= nPos )
+ else if ( pEnd && *pEnd >= nPos )
{
if( *pEnd > nPos || IsIgnoreDontExpand() )
{
@@ -933,16 +956,19 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
{
USHORT nWhPos, nWhich = pHt->Which();
- if( RES_CHRATR_BEGIN <= nWhich &&
- nWhich < RES_TXTATR_WITHEND_END )
- nWhPos = static_cast<USHORT>(nWhich - RES_CHRATR_BEGIN);
- else if( RES_UNKNOWNATR_BEGIN <= nWhich &&
- nWhich < RES_UNKNOWNATR_END )
+ if (isCHRATR(nWhich) || isTXTATR_WITHEND(nWhich))
+ {
+ nWhPos = static_cast<USHORT>(nWhich -
+ RES_CHRATR_BEGIN);
+ }
+ else if (isUNKNOWNATR(nWhich))
+ {
nWhPos = static_cast<USHORT>(
- nWhich -
- static_cast<USHORT>(RES_UNKNOWNATR_BEGIN) +
- static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
- static_cast<USHORT>(RES_CHRATR_BEGIN) );
+ nWhich -
+ static_cast<USHORT>(RES_UNKNOWNATR_BEGIN) +
+ static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
+ static_cast<USHORT>(RES_CHRATR_BEGIN) );
+ }
else
continue;
@@ -991,7 +1017,9 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
}
}
if( bResort )
- ((SwpHintsArr*)pSwpHints)->Resort();
+ {
+ m_pSwpHints->Resort();
+ }
}
}
@@ -1055,7 +1083,9 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
{
USHORT nCount = pCollector->Count();
for( USHORT i = 0; i < nCount; ++i )
- pSwpHints->Insert( (*pCollector)[ i ], *this, FALSE );
+ {
+ m_pSwpHints->Insert( (*pCollector)[ i ], *this, FALSE );
+ }
delete pCollector;
}
@@ -1112,21 +1142,23 @@ void SwTxtNode::_ChgTxtCollUpdateNum( const SwTxtFmtColl *pOldColl,
// Wenn man sich genau am Ende einer Text- bzw. INetvorlage befindet,
// bekommt diese das DontExpand-Flag verpasst
-BOOL SwTxtNode::DontExpandFmt( const SwIndex& rIdx, BOOL bFlag,
+BOOL SwTxtNode::DontExpandFmt( const SwIndex& rIdx, bool bFlag,
BOOL bFmtToTxtAttributes )
{
const xub_StrLen nIdx = rIdx.GetIndex();
- if( bFmtToTxtAttributes && nIdx == aText.Len() )
+ if ( bFmtToTxtAttributes && nIdx == m_Text.Len() )
+ {
FmtToTxtAttr( this );
+ }
BOOL bRet = FALSE;
- if( pSwpHints )
+ if ( HasHints() )
{
- const USHORT nEndCnt = pSwpHints->GetEndCount();
+ const USHORT nEndCnt = m_pSwpHints->GetEndCount();
USHORT nPos = nEndCnt;
while( nPos )
{
- SwTxtAttr *pTmp = pSwpHints->GetEnd( --nPos );
+ SwTxtAttr *pTmp = m_pSwpHints->GetEnd( --nPos );
xub_StrLen *pEnd = pTmp->GetEnd();
if( !pEnd || *pEnd > nIdx )
continue;
@@ -1136,7 +1168,7 @@ BOOL SwTxtNode::DontExpandFmt( const SwIndex& rIdx, BOOL bFlag,
&& *pEnd > *pTmp->GetStart())
{
bRet = TRUE;
- pSwpHints->NoteInHistory( pTmp );
+ m_pSwpHints->NoteInHistory( pTmp );
pTmp->SetDontExpand( bFlag );
}
}
@@ -1158,12 +1190,13 @@ SwTxtAttr* SwTxtNode::GetTxtAttr( const SwIndex& rIdx, USHORT nWhichHt,
const SwTxtAttr* pHt = 0;
const xub_StrLen *pEndIdx = 0;
const xub_StrLen nIdx = rIdx.GetIndex();
- const USHORT nSize = pSwpHints ? pSwpHints->Count() : 0;
+ const USHORT nSize = m_pSwpHints ? m_pSwpHints->Count() : 0;
for( USHORT i = 0; i < nSize; ++i )
{
// ist der Attribut-Anfang schon groesser als der Idx ?
- if( nIdx < *((pHt = (*pSwpHints)[i])->GetStart()) )
+ pHt = (*m_pSwpHints)[i];
+ if ( nIdx < *(pHt->GetStart()) )
break; // beenden, kein gueltiges Attribut
// ist es das gewuenschte Attribut ?
@@ -1323,7 +1356,7 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr *pHt,
void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
const xub_StrLen nOldPos )
{
- if( pSwpHints ) // keine Attribute, keine Kekse
+ if ( HasHints() ) // keine Attribute, keine Kekse
{
const xub_StrLen *pEndIdx = 0;
const SwTxtAttr *pHt = 0;
@@ -1335,9 +1368,9 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
if( pOtherDoc == GetDoc() )
pOtherDoc = 0;
- for( USHORT i = 0; i < pSwpHints->Count(); i++ )
+ for ( USHORT i = 0; i < m_pSwpHints->Count(); i++ )
{
- pHt = (*pSwpHints)[i];
+ pHt = (*m_pSwpHints)[i];
if( nTxtStartIdx < ( nAttrStartIdx = *pHt->GetStart() ) )
break; // ueber das Textende, da nLen == 0
@@ -1385,7 +1418,7 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
xub_StrLen nLen,
const bool bForceCopyOfAllAttrs )
{
- SwIndex aIdx( pDest, pDest->aText.Len() );
+ SwIndex aIdx( pDest, pDest->m_Text.Len() );
Copy( pDest, aIdx, rStart, nLen, bForceCopyOfAllAttrs );
}
// <--
@@ -1436,16 +1469,16 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
}
// 1. Text kopieren
- xub_StrLen i = pDest->aText.Len() - nDestStart;
+ xub_StrLen i = pDest->m_Text.Len() - nDestStart;
//JP 15.02.96: Bug 25537 - Attributbehandlung am Ende fehlt! Darum
// ueber die InsertMethode den Text einfuegen und nicht
// selbst direkt
- pDest->Insert( aText.Copy( nTxtStartIdx, nLen ), rDestStart,
- INS_EMPTYEXPAND );
+ pDest->Insert( m_Text.Copy( nTxtStartIdx, nLen ), rDestStart,
+ INS_EMPTYEXPAND );
// um reale Groesse Updaten !
- nLen = pDest->aText.Len() - nDestStart - i;
- if( !nLen ) // String nicht gewachsen ??
+ nLen = pDest->m_Text.Len() - nDestStart - i;
+ if ( !nLen ) // string not longer?
return;
i = 0;
@@ -1494,7 +1527,8 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
// 2. Attribute kopieren
// durch das Attribute-Array, bis der Anfang des Geltungsbereiches
// des Attributs hinter dem zu kopierenden Bereich liegt
- USHORT nWhich, nSize = pSwpHints ? pSwpHints->Count() : 0;
+ USHORT nWhich;
+ USHORT nSize = m_pSwpHints ? m_pSwpHints->Count() : 0;
xub_StrLen nAttrStt, nAttrEnd;
// wird in sich selbst kopiert, dann kann beim Einfuegen ein
@@ -1506,10 +1540,10 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
SwpHts aRefMrkArr;
//Achtung: kann ungueltig sein!!
- while( ( i < nSize ) &&
- ((nAttrStartIdx = *(*pSwpHints)[i]->GetStart()) < nEnd) )
+ while ( ( i < nSize ) &&
+ ((nAttrStartIdx = *(*m_pSwpHints)[i]->GetStart()) < nEnd) )
{
- pHt = (*pSwpHints)[i];
+ pHt = (*m_pSwpHints)[i];
pNewHt = 0;
pEndIdx = pHt->GetEnd();
nWhich = pHt->Which();
@@ -1645,14 +1679,14 @@ void SwTxtNode::Copy( SwTxtNode *pDest,
SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
const SwIndex &rIdx, const USHORT nMode )
{
- ASSERT( rIdx <= aText.Len(), "Array ueberindiziert." );
- ASSERT( (ULONG)aText.Len() + (ULONG)rStr.Len() <= STRING_LEN,
- "STRING_LEN ueberschritten." );
+ ASSERT( rIdx <= m_Text.Len(), "SwTxtNode::Insert: invalid index." );
+ ASSERT( (ULONG)m_Text.Len() + (ULONG)rStr.Len() <= STRING_LEN,
+ "SwTxtNode::Insert: node text with insertion > STRING_LEN." );
xub_StrLen aPos = rIdx.GetIndex();
- xub_StrLen nLen = aText.Len() - aPos;
- aText.Insert( rStr, aPos );
- nLen = aText.Len() - aPos - nLen;
+ xub_StrLen nLen = m_Text.Len() - aPos;
+ m_Text.Insert( rStr, aPos );
+ nLen = m_Text.Len() - aPos - nLen;
if( !nLen )
return *this;
Update( rIdx, nLen ); // um reale Groesse Updaten !
@@ -1663,12 +1697,12 @@ SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
USHORT i;
- if( pSwpHints )
+ if ( HasHints() )
{
- for( i = 0; i < pSwpHints->Count() &&
- rIdx >= *(*pSwpHints)[i]->GetStart(); ++i )
+ for ( i = 0; i < m_pSwpHints->Count() &&
+ rIdx >= *(*m_pSwpHints)[i]->GetStart(); ++i )
{
- SwTxtAttr *pHt = pSwpHints->GetHt( i );
+ SwTxtAttr *pHt = m_pSwpHints->GetTextHint( i );
xub_StrLen* pEndIdx = pHt->GetEnd();
if( !pEndIdx )
continue;
@@ -1681,7 +1715,7 @@ SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
if( rIdx == *pHt->GetStart() )
*pHt->GetStart() = *pHt->GetStart() - nLen;
*pEndIdx = *pEndIdx - nLen;
- pSwpHints->DeleteAtPos(i);
+ m_pSwpHints->DeleteAtPos(i);
Insert( pHt, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
// leere Hints an rIdx.GetIndex ?
@@ -1689,11 +1723,13 @@ SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
*pEndIdx == *pHt->GetStart() )
{
*pHt->GetStart() = *pHt->GetStart() - nLen;
- const USHORT nAktLen = pSwpHints->Count();
- pSwpHints->DeleteAtPos(i);
+ const USHORT nAktLen = m_pSwpHints->Count();
+ m_pSwpHints->DeleteAtPos(i);
Insert( pHt/* AUTOSTYLES:, nsSetAttrMode::SETATTR_NOHINTADJUST*/ );
- if( nAktLen > pSwpHints->Count() && i )
+ if ( nAktLen > m_pSwpHints->Count() && i )
+ {
--i;
+ }
continue;
}
else
@@ -1706,13 +1742,12 @@ SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
!pHt->IsDontExpandStartAttr() )
{
// Kein Feld, am Absatzanfang, HintExpand
- pSwpHints->DeleteAtPos(i);
+ m_pSwpHints->DeleteAtPos(i);
*pHt->GetStart() = *pHt->GetStart() - nLen;
Insert( pHt, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
}
- if ( pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
+ TryDeleteSwpHints();
}
if ( GetDepends() )
@@ -1778,7 +1813,7 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
xub_StrLen nTxtStartIdx = rStart.GetIndex();
xub_StrLen nDestStart = rDestStart.GetIndex(); // alte Pos merken
- xub_StrLen nInitSize = pDest->aText.Len();
+ xub_StrLen nInitSize = pDest->m_Text.Len();
xub_StrLen *pEndIdx = 0;
xub_StrLen nAttrStartIdx = 0;
@@ -1788,8 +1823,8 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
// wird in sich selbst verschoben, muss es gesondert behandelt werden !!
if( pDest == this )
{
- aText.Insert( aText, nTxtStartIdx, nLen, nDestStart );
- aText.Erase( nTxtStartIdx + (nDestStart<nTxtStartIdx ? nLen : 0), nLen );
+ m_Text.Insert( m_Text, nTxtStartIdx, nLen, nDestStart );
+ m_Text.Erase( nTxtStartIdx + (nDestStart<nTxtStartIdx ? nLen : 0), nLen );
xub_StrLen nEnd = rStart.GetIndex() + nLen;
USHORT n;
@@ -1804,8 +1839,8 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
// durch das Attribute-Array, bis der Anfang des Geltungsbereiches
// des Attributs hinter dem zu verschiebenden Bereich liegt
USHORT nAttrCnt = 0, nWhich;
- while( pSwpHints && nAttrCnt < pSwpHints->Count() &&
- (nAttrStartIdx = *(pHt = pSwpHints->GetHt(nAttrCnt))->
+ while ( m_pSwpHints && nAttrCnt < m_pSwpHints->Count() &&
+ (nAttrStartIdx = *(pHt = m_pSwpHints->GetTextHint(nAttrCnt))->
GetStart()) < nEnd )
{
pNewHt = 0;
@@ -1831,7 +1866,7 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
if( !pEndIdx || *pEndIdx < nEnd )
{
// Attribut verschieben
- pSwpHints->Delete( pHt );
+ m_pSwpHints->Delete( pHt );
// die Start/End Indicies neu setzen
*pHt->GetStart() = nAttrStartIdx - nTxtStartIdx;
if( pEndIdx )
@@ -1865,16 +1900,18 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
#ifdef CUTNOEXPAND
else
// wird am Ende eingefuegt, nur die Attribut-Indizies verschieben
- if( 0 < nLen && 0 < nInitSize && pSwpHints )
+ if ( 0 < nLen && 0 < nInitSize && m_pSwpHints )
{
- // siehe nach, ob an der Einfuegeposition das Ende eines
- // Attributes stand. Ist es kein Feld, muss es expandiert werden !!!
- for( n = 0; n < pSwpHints->Count(); n++ )
+ // check if there was the end of an attribute at the insertion
+ // position: if it is not a field, it must be expanded
+ for ( n = 0; n < m_pSwpHints->Count(); n++ )
{
- pHt = pSwpHints->GetHt(n);
- if( 0 != ( pEndIdx = pHt->GetEnd() ) &&
- *pEndIdx == nInitSize )
+ pHt = m_pSwpHints->GetTextHint(n);
+ pEndIdx = pHt->GetEnd();
+ if ( pEndIdx && (*pEndIdx == nInitSize) )
+ {
*pEndIdx = *pEndIdx + nLen;
+ }
}
}
#endif
@@ -1902,9 +1939,9 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
else
{
xub_StrLen i = nInitSize - nDestStart;
- pDest->aText.Insert( aText, nTxtStartIdx, nLen, nDestStart );
- aText.Erase( nTxtStartIdx, nLen );
- nLen = pDest->aText.Len() - nDestStart - i; // um reale Groesse Updaten !
+ pDest->m_Text.Insert( m_Text, nTxtStartIdx, nLen, nDestStart );
+ m_Text.Erase( nTxtStartIdx, nLen );
+ nLen = pDest->m_Text.Len() - nDestStart - i; // update w/ current size!
if( !nLen ) // String nicht gewachsen ??
return;
@@ -1916,16 +1953,18 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
#ifdef CUTNOEXPAND
else
// wird am Ende eingefuegt, nur die Attribut-Indizies verschieben
- if( 0 < nLen && 0 < nInitSize && pDest->pSwpHints )
+ if ( 0 < nLen && 0 < nInitSize && pDest->m_pSwpHints )
{
- // siehe nach, ob an der Einfuegeposition das Ende eines
- // Attributes stand. Ist es kein Feld, muss es expandiert werden !!!
- for( USHORT n = 0; n < pDest->pSwpHints->Count(); n++ )
+ // check if there was the end of an attribute at the insertion
+ // position: if it is not a field, it must be expanded
+ for ( USHORT n = 0; n < pDest->m_pSwpHints->Count(); n++ )
{
- pHt = pDest->pSwpHints->GetHt(n);
- if( 0 != ( pEndIdx = pHt->GetEnd() ) &&
- *pEndIdx == nInitSize )
+ pHt = pDest->m_pSwpHints->GetTextHint(n);
+ pEndIdx = pHt->GetEnd();
+ if ( pEndIdx && (*pEndIdx == nInitSize) )
+ {
*pEndIdx = *pEndIdx + nLen;
+ }
}
}
#endif
@@ -1962,8 +2001,8 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
// durch das Attribute-Array, bis der Anfang des Geltungsbereiches
// des Attributs hinter dem zu verschiebenden Bereich liegt
USHORT nAttrCnt = 0, nWhich;
- while( pSwpHints && nAttrCnt < pSwpHints->Count() &&
- ( (nAttrStartIdx = *(pHt = pSwpHints->GetHt(nAttrCnt))->
+ while ( m_pSwpHints && nAttrCnt < m_pSwpHints->Count() &&
+ ( (nAttrStartIdx = *(pHt = m_pSwpHints->GetTextHint(nAttrCnt))->
GetStart()) < nEnd ) )
{
pNewHt = 0;
@@ -1996,7 +2035,7 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
if ( GetDoc()->GetDocShell() )
GetDoc()->GetDocShell()->Broadcast( SfxSimpleHint(SFX_HINT_USER04));
// Attribut verschieben
- pSwpHints->Delete( pHt );
+ m_pSwpHints->Delete( pHt );
// die Start/End Indicies neu setzen
*pHt->GetStart() =
nDestStart + (nAttrStartIdx - nTxtStartIdx);
@@ -2032,17 +2071,18 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
// eine hoehere Praezedenz. Also herausholen und das Array updaten.
// Die dabei entstehenden leeren Hints werden von den gesicherten
// "uebergeplaettet". (Bug: 6977)
- if( pSwpHints && nAttrCnt < pSwpHints->Count() )
+ if( m_pSwpHints && nAttrCnt < m_pSwpHints->Count() )
{
SwpHts aArr( 5 );
- for( ; nAttrCnt < pSwpHints->Count() &&
- nEnd == *(pHt = pSwpHints->GetHt(nAttrCnt))->GetStart();
+ for ( ; nAttrCnt < m_pSwpHints->Count() &&
+ nEnd == *(pHt = m_pSwpHints->GetTextHint(nAttrCnt))->GetStart();
++nAttrCnt )
{
- if( 0 != ( pEndIdx = pHt->GetEnd() ) && *pEndIdx == nEnd )
+ pEndIdx = pHt->GetEnd();
+ if ( pEndIdx && *pEndIdx == nEnd )
{
aArr.C40_INSERT( SwTxtAttr, pHt, aArr.Count() );
- pSwpHints->Delete( pHt );
+ m_pSwpHints->Delete( pHt );
--nAttrCnt;
}
}
@@ -2061,8 +2101,7 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
CHECK_SWPHINTS(this);
}
- if( pSwpHints && pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
+ TryDeleteSwpHints();
// Frames benachrichtigen;
SwInsTxt aInsHint( nDestStart, nLen );
@@ -2075,22 +2114,21 @@ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
SwTxtNode& SwTxtNode::Erase(const SwIndex &rIdx, xub_StrLen nCount,
const USHORT nMode )
{
- ASSERT( rIdx <= aText.Len(), "Array ueberindiziert." );
+ ASSERT( rIdx <= m_Text.Len(), "SwTxtNode::Erase: invalid index." );
const xub_StrLen nCnt = STRING_LEN == nCount
- ? aText.Len() - rIdx.GetIndex() : nCount;
- aText.Erase( rIdx.GetIndex(), nCnt );
+ ? m_Text.Len() - rIdx.GetIndex() : nCount;
+ m_Text.Erase( rIdx.GetIndex(), nCnt );
/* GCAttr(); alle leeren weggwerfen ist zu brutal.
* Es duerfen nur die wegggeworfen werden,
* die im Bereich liegen und nicht am Ende des Bereiches liegen
*/
- // Abfrage auf pSwpHints weil TextFelder und FlyFrames Text loeschen
- // (Rekursion)!!
- for( USHORT i = 0; pSwpHints && i < pSwpHints->Count(); ++i )
+ // check m_pSwpHints because fields and FlyFrames delete text (recursion!)
+ for ( USHORT i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
- SwTxtAttr *pHt = pSwpHints->GetHt(i);
+ SwTxtAttr *pHt = m_pSwpHints->GetTextHint(i);
const xub_StrLen nHtStt = *pHt->GetStart();
@@ -2109,11 +2147,10 @@ SwTxtNode& SwTxtNode::Erase(const SwIndex &rIdx, xub_StrLen nCount,
if( !pHtEndIdx )
{
- // TxtHints ohne EndIndex werden natuerlich auch geloescht:
- if( RES_TXTATR_BEGIN <= nWhich && RES_TXTATR_END > nWhich &&
- nHtStt >= rIdx.GetIndex() && nHtStt < nEndIdx )
+ if (isTXTATR(nWhich) &&
+ (nHtStt >= rIdx.GetIndex()) && (nHtStt < nEndIdx))
{
- pSwpHints->DeleteAtPos(i);
+ m_pSwpHints->DeleteAtPos(i);
// Damit im Dtor der TxtAttr ohne End die CH_TXTATR nicht
// geloescht werden...
*(pHt->GetStart()) = USHRT_MAX;
@@ -2140,13 +2177,12 @@ SwTxtNode& SwTxtNode::Erase(const SwIndex &rIdx, xub_StrLen nCount,
)
continue;
- pSwpHints->DeleteAtPos(i);
+ m_pSwpHints->DeleteAtPos(i);
DestroyAttr( pHt );
--i;
}
- if ( pSwpHints && pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
+ TryDeleteSwpHints();
Update( rIdx, nCnt, TRUE );
@@ -2182,20 +2218,20 @@ SwTxtNode& SwTxtNode::Erase(const SwIndex &rIdx, xub_StrLen nCount,
void SwTxtNode::GCAttr()
{
- if ( !pSwpHints )
+ if ( !HasHints() )
return;
const SwTxtAttr *pHt = 0;
const xub_StrLen *pEndIdx = 0;
BOOL bChanged = FALSE;
- USHORT nMin = aText.Len(),
+ USHORT nMin = m_Text.Len(),
nMax = 0;
BOOL bAll = nMin != 0; // Bei leeren Absaetzen werden nur die
// INet-Formate entfernt.
- for ( USHORT i = 0; pSwpHints && i < pSwpHints->Count(); ++i )
+ for ( USHORT i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
- pHt = (*pSwpHints)[i];
+ pHt = (*m_pSwpHints)[i];
// wenn Ende und Start gleich sind --> loeschen
pEndIdx = pHt->GetEnd();
@@ -2205,14 +2241,13 @@ void SwTxtNode::GCAttr()
bChanged = TRUE;
nMin = Min( nMin, *pHt->GetStart() );
nMax = Max( nMax, *pHt->GetEnd() );
- DestroyAttr( pSwpHints->Cut(i) );
+ DestroyAttr( m_pSwpHints->Cut(i) );
--i;
}
else
((SwTxtAttr*)pHt)->SetDontExpand( FALSE );
}
- if ( pSwpHints && pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
+ TryDeleteSwpHints();
if(bChanged)
{
@@ -2236,17 +2271,6 @@ SwNumRule* SwTxtNode::_GetNumRule(BOOL bInParent) const
if (sNumRuleName.Len() > 0)
{
pRet = GetDoc()->FindNumRulePtr( sNumRuleName );
- // --> OD 2006-01-13 #i60395#
- // It's not allowed to apply the outline numbering rule as hard
- // attribute to a paragraph.
- // Because currently not all situation are known, in which such
- // a situation is triggered, it's asserted in order to find these.
- ASSERT( !pRet || !HasSwAttrSet() ||
- pRet != GetDoc()->GetOutlineNumRule() ||
- SFX_ITEM_SET !=
- GetpSwAttrSet()->GetItemState( RES_PARATR_NUMRULE, FALSE ),
- "<SwTxtNode::_GetNumRule(..)> - found outline numbering rule as hard attribute at a paragraph. This isn't allowed. It's a serious defect, please inform OD" );
- // <--
}
else // numbering is turned off
bNoNumRule = true;
@@ -2521,8 +2545,8 @@ SwTxtNode* SwTxtNode::_MakeNewTxtNode( const SwNodeIndex& rPos, BOOL bNext,
return pNode;
SwTxtFmtColl *pNextColl = &pColl->GetNextTxtFmtColl();
- ChgFmtColl( pNextColl );
-
+ // --> OD 2009-08-12 #i101870#
+ // perform action on different paragraph styles before applying the new paragraph style
if (pNextColl != pColl)
{
// --> OD 2007-07-10 #i75353#
@@ -2538,6 +2562,8 @@ SwTxtNode* SwTxtNode::_MakeNewTxtNode( const SwNodeIndex& rPos, BOOL bNext,
}
// <--
}
+ // <--
+ ChgFmtColl( pNextColl );
return pNode;
}
@@ -2584,11 +2610,11 @@ SwCntntNode* SwTxtNode::AppendNode( const SwPosition & rPos )
SwTxtAttr *SwTxtNode::GetTxtAttr( const xub_StrLen nIdx,
const USHORT nWhichHt ) const
{
- if( pSwpHints )
+ if ( HasHints() )
{
- for( USHORT i = 0; i < pSwpHints->Count(); ++i )
+ for ( USHORT i = 0; i < m_pSwpHints->Count(); ++i )
{
- SwTxtAttr *pPos = pSwpHints->GetHt(i);
+ SwTxtAttr *pPos = m_pSwpHints->GetTextHint(i);
const xub_StrLen nStartPos = *pPos->GetStart();
if( nIdx < nStartPos )
return 0;
@@ -2937,12 +2963,12 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
nLen = aDestIdx.GetIndex() - nDestStt;
// alle FontAttribute mit CHARSET Symbol in dem Bereich setzen
- if( pSwpHints )
+ if ( HasHints() )
{
xub_StrLen nInsPos = nDestStt - nIdx;
- for( USHORT i = 0; i < pSwpHints->Count(); i++ )
+ for ( USHORT i = 0; i < m_pSwpHints->Count(); i++ )
{
- const SwTxtAttr* pHt = (*pSwpHints)[i];
+ const SwTxtAttr* pHt = (*m_pSwpHints)[i];
xub_StrLen nAttrStartIdx;
USHORT nWhich = pHt->Which();
if( nIdx + nLen <= ( nAttrStartIdx = *pHt->GetStart() ) )
@@ -2982,7 +3008,7 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
break;
case RES_TXTATR_HARDBLANK:
- rDestNd.aText.SetChar( nInsPos + nAttrStartIdx,
+ rDestNd.m_Text.SetChar( nInsPos + nAttrStartIdx,
((SwTxtHardBlank*)pHt)->GetChar() );
break;
@@ -3059,12 +3085,12 @@ const ModelToViewHelper::ConversionMap*
rRetText = rNodeText;
ModelToViewHelper::ConversionMap* pConversionMap = 0;
- SwpHints* pSwpHints2 = const_cast<SwTxtNode*>(this)->GetpSwpHints();
+ const SwpHints* pSwpHints2 = GetpSwpHints();
xub_StrLen nPos = 0;
for ( USHORT i = 0; pSwpHints2 && i < pSwpHints2->Count(); ++i )
{
- const SwTxtAttr* pAttr = pSwpHints2->GetHt(i);
+ const SwTxtAttr* pAttr = (*pSwpHints2)[i];
if ( RES_TXTATR_FIELD == pAttr->Which() )
{
const XubString aExpand( ((SwTxtFld*)pAttr)->GetFld().GetFld()->Expand() );
@@ -3168,18 +3194,21 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen,
void SwTxtNode::Replace( const SwIndex& rStart, xub_Unicode cCh )
{
+ ASSERT( rStart.GetIndex() < m_Text.Len(),
+ "SwTxtNode::Replace: invalid index." );
- ASSERT( rStart.GetIndex() < aText.Len(), "ausserhalb des Strings" );
SwTxtAttr* pHt;
- if( ( CH_TXTATR_BREAKWORD == aText.GetChar( rStart.GetIndex() ) ||
- CH_TXTATR_INWORD == aText.GetChar( rStart.GetIndex() )) &&
+ if ( ( CH_TXTATR_BREAKWORD == m_Text.GetChar( rStart.GetIndex() ) ||
+ CH_TXTATR_INWORD == m_Text.GetChar( rStart.GetIndex() )) &&
0 != ( pHt = GetTxtAttr( rStart.GetIndex() ) ))
{
Delete( pHt );
- aText.Insert( cCh, rStart.GetIndex() );
+ m_Text.Insert( cCh, rStart.GetIndex() );
}
else
- aText.SetChar( rStart.GetIndex(), cCh );
+ {
+ m_Text.SetChar( rStart.GetIndex(), cCh );
+ }
SwDelTxt aDelHint( rStart.GetIndex(), 1 );
SwModify::Modify( 0, &aDelHint );
@@ -3192,22 +3221,24 @@ void SwTxtNode::Replace( const SwIndex& rStart, xub_Unicode cCh )
void SwTxtNode::Replace( const SwIndex& rStart, xub_StrLen nLen,
const XubString& rText )
{
- ASSERT( rStart.GetIndex() < aText.Len() &&
- rStart.GetIndex() + nLen <= aText.Len(),
+ ASSERT( rStart.GetIndex() < m_Text.Len() &&
+ rStart.GetIndex() + nLen <= m_Text.Len(),
"ausserhalb des Strings" );
SwTxtAttr* pHt;
const xub_StrLen nStartPos = rStart.GetIndex();
xub_StrLen nEnde = nStartPos + nLen;
xub_StrLen nDelLen = nLen;
for( xub_StrLen nPos = nStartPos; nPos < nEnde; ++nPos )
- if( ( CH_TXTATR_BREAKWORD == aText.GetChar( nPos ) ||
- CH_TXTATR_INWORD == aText.GetChar( nPos )) &&
+ {
+ if ( ( CH_TXTATR_BREAKWORD == m_Text.GetChar( nPos ) ||
+ CH_TXTATR_INWORD == m_Text.GetChar( nPos )) &&
0 != ( pHt = GetTxtAttr( nPos ) ))
{
Delete( pHt );
--nEnde;
--nLen;
}
+ }
BOOL bOldExpFlg = IsIgnoreDontExpand();
SetIgnoreDontExpand( TRUE );
@@ -3216,22 +3247,22 @@ void SwTxtNode::Replace( const SwIndex& rStart, xub_StrLen nLen,
{
// dann das 1. Zeichen ersetzen den Rest loschen und einfuegen
// Dadurch wird die Attributierung des 1. Zeichen expandiert!
- aText.SetChar( nStartPos, rText.GetChar( 0 ) );
+ m_Text.SetChar( nStartPos, rText.GetChar( 0 ) );
((SwIndex&)rStart)++;
- aText.Erase( rStart.GetIndex(), nLen - 1 );
+ m_Text.Erase( rStart.GetIndex(), nLen - 1 );
Update( rStart, nLen - 1, TRUE );
XubString aTmpTxt( rText ); aTmpTxt.Erase( 0, 1 );
- aText.Insert( aTmpTxt, rStart.GetIndex() );
+ m_Text.Insert( aTmpTxt, rStart.GetIndex() );
Update( rStart, aTmpTxt.Len(), FALSE );
}
else
{
- aText.Erase( nStartPos, nLen );
+ m_Text.Erase( nStartPos, nLen );
Update( rStart, nLen, TRUE );
- aText.Insert( rText, nStartPos );
+ m_Text.Insert( rText, nStartPos );
Update( rStart, rText.Len(), FALSE );
}
SetIgnoreDontExpand( bOldExpFlg );
@@ -3467,8 +3498,8 @@ namespace {
void SwTxtNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
{
- bool bWasNotifiable = bNotifiable;
- bNotifiable = false;
+ bool bWasNotifiable = m_bNotifiable;
+ m_bNotifiable = false;
// Bug 24616/24617:
// Modify ueberladen, damit beim Loeschen von Vorlagen diese
@@ -3501,7 +3532,7 @@ void SwTxtNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
pDoc->GetNodes().UpdateOutlineNode(*this);
}
- bNotifiable = bWasNotifiable;
+ m_bNotifiable = bWasNotifiable;
}
SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl )
@@ -3541,24 +3572,6 @@ SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl )
return pOldColl;
}
-// #111840#
-SwPosition * SwTxtNode::GetPosition(const SwTxtAttr * pAttr)
-{
- SwPosition * pResult = NULL;
-
- for (xub_StrLen i = 0; i < Len(); i++)
- {
- if (GetTxtAttr(i, pAttr->Which()) == pAttr)
- {
- pResult = new SwPosition(*this, SwIndex(this, i));
-
- break;
- }
- }
-
- return pResult;
-}
-
SwNodeNum* SwTxtNode::CreateNum() const
{
if ( !mpNodeNum )
@@ -3583,9 +3596,9 @@ SwNumberTree::tNumberVector SwTxtNode::GetNumberVector() const
}
}
-BOOL SwTxtNode::IsOutline() const
+bool SwTxtNode::IsOutline() const
{
- BOOL bResult = FALSE;
+ bool bResult = false;
//if ( GetOutlineLevel() != NO_NUMBERING )//#outline level,removed by zhaojianwei
if ( GetAttrOutlineLevel() > 0 ) //<-end,zhaojianwei
@@ -3604,14 +3617,14 @@ BOOL SwTxtNode::IsOutline() const
return bResult;
}
-BOOL SwTxtNode::IsOutlineStateChanged() const
+bool SwTxtNode::IsOutlineStateChanged() const
{
- return IsOutline() != bLastOutlineState;
+ return IsOutline() != m_bLastOutlineState;
}
void SwTxtNode::UpdateOutlineState()
{
- bLastOutlineState = IsOutline();
+ m_bLastOutlineState = IsOutline();
}
//#outline level, zhaojianwei
@@ -3823,7 +3836,7 @@ SwNumberTree::tSwNumTreeNumber SwTxtNode::GetActualListStartValue() const
bool SwTxtNode::IsNotifiable() const
{
- return bNotifiable && IsNotificationEnabled();
+ return m_bNotifiable && IsNotificationEnabled();
}
bool SwTxtNode::IsNotificationEnabled() const
@@ -4846,3 +4859,50 @@ USHORT SwTxtNode::ResetAllAttr()
return nRet;
}
// <--
+
+
+// sw::Metadatable
+::sfx2::IXmlIdRegistry& SwTxtNode::GetRegistry()
+{
+ return GetDoc()->GetXmlIdRegistry();
+}
+
+bool SwTxtNode::IsInClipboard() const
+{
+ return GetDoc()->IsClipBoard();
+}
+
+bool SwTxtNode::IsInUndo() const
+{
+ return &GetNodes() == GetDoc()->GetUndoNds();
+}
+
+bool SwTxtNode::IsInContent() const
+{
+ return !GetDoc()->IsInHeaderFooter( SwNodeIndex(*this) );
+}
+
+#include <unoobj.hxx>
+
+::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable >
+SwTxtNode::MakeUnoObject()
+{
+ // re-use existing SwXParagraph
+ SwClientIter iter( *this );
+ SwClient * pClient( iter.First( TYPE( SwXParagraph ) ) );
+ while (pClient) {
+ SwXParagraph *pPara( dynamic_cast<SwXParagraph*>(pClient) );
+ if (pPara && pPara->GetCoreObject() == this ) {
+ return pPara;
+ }
+ pClient = iter.Next();
+ }
+
+ // create new SwXParagraph
+ SwPosition Pos( *this );
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent(
+ SwXTextRange::CreateParentXText( GetDoc(), Pos ) );
+ SwXParagraph * pXPara( new SwXParagraph( xParent, this ) );
+ return pXPara;
+}
+
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 797e4269689e..659a79f4a5fd 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -40,9 +40,7 @@
#include <svtools/stylepool.hxx>
#include <svx/fontitem.hxx>
#include <svx/langitem.hxx>
-#ifndef _SVX_EMPHITEM_HXX //autogen
#include <svx/emphitem.hxx>
-#endif
#include <svx/charscaleitem.hxx>
#include <svx/charrotateitem.hxx>
// --> OD 2008-01-16 #newlistlevelattrs#
@@ -97,6 +95,19 @@
using namespace ::com::sun::star::i18n;
+
+SwpHints::SwpHints()
+ : m_pHistory(0)
+ , m_bFontChange(true)
+ , m_bInSplitNode(false)
+ , m_bCalcHiddenParaField(false)
+ , m_bHasHiddenParaField(false)
+ , m_bFootnote(false)
+ , m_bDDEFields(false)
+{
+}
+
+
// This function takes care for the following text attribute:
// RES_TXTATR_CHARFMT, RES_TXTATR_INETFMT, RES_TXTATR_AUTOFMT, and
// RES_TXTATR_CJK_RUBY. These attributes have to be handled in a
@@ -138,7 +149,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
{
for ( USHORT i = 0; i < Count(); ++i )
{
- SwTxtAttr* pOther = GetHt(i);
+ SwTxtAttr* pOther = GetTextHint(i);
if ( nWhich == pOther->Which() )
{
@@ -152,9 +163,9 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
SwTxtAttr* pNewAttr = rNode.MakeTxtAttr( pOther->GetAttr(), nOtherStart, nThisStart );
aInsDelHints.push_back( pNewAttr );
- if( pHistory ) pHistory->Add( pOther );
+ NoteInHistory( pOther );
*pOther->GetStart() = nThisStart;
- if( pHistory ) pHistory->Add( pOther, TRUE );
+ NoteInHistory( pOther, true );
nOtherStart = nThisStart;
}
@@ -162,12 +173,13 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
// Split pOther if necessary:
if ( nOtherStart < nThisEnd && nThisEnd < nOtherEnd )
{
- SwTxtAttr* pNewAttr = rNode.MakeTxtAttr( pOther->GetAttr(), nOtherStart, nThisEnd );
+ SwTxtAttr* pNewAttr = rNode.MakeTxtAttr( pOther->GetAttr(),
+ nOtherStart, nThisEnd );
aInsDelHints.push_back( pNewAttr );
- if( pHistory ) pHistory->Add( pOther );
+ NoteInHistory( pOther );
*pOther->GetStart() = nThisEnd;
- if( pHistory ) pHistory->Add( pOther, TRUE );
+ NoteInHistory( pOther, true );
}
}
}
@@ -196,8 +208,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
}
- SwpHintsArr::Insert( *aIter );
- if ( pHistory ) pHistory->Add( *aIter, TRUE );
+ SwpHintsArray::Insert( *aIter );
+ NoteInHistory( *aIter, true );
}
aInsDelHints.clear();
@@ -206,7 +218,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
// which are fully covered by the new attribute:
for ( USHORT i = 0; i < Count(); ++i )
{
- SwTxtAttr* pOther = GetHt(i);
+ SwTxtAttr* pOther = GetTextHint(i);
if ( nWhich == pOther->Which() )
{
const xub_StrLen nOtherStart = *pOther->GetStart();
@@ -222,9 +234,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
rNode.DestroyAttr( *aIter );
}
- SwpHintsArr::Insert( &rNewHint );
- if ( pHistory )
- pHistory->Add( &rNewHint, TRUE );
+ SwpHintsArray::Insert( &rNewHint );
+ NoteInHistory( &rNewHint, true );
return;
}
@@ -241,7 +252,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
{
for ( USHORT i = 0; i < Count(); ++i )
{
- SwTxtAttr* pOther = GetHt(i);
+ SwTxtAttr* pOther = GetTextHint(i);
if ( RES_TXTATR_CHARFMT != pOther->Which() &&
RES_TXTATR_AUTOFMT != pOther->Which() )
@@ -259,9 +270,9 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
static_cast<SwTxtCharFmt*>(pNewAttr)->SetSortNumber( static_cast<SwTxtCharFmt*>(pOther)->GetSortNumber() );
aInsDelHints.push_back( pNewAttr );
- if( pHistory ) pHistory->Add( pOther );
+ NoteInHistory( pOther );
*pOther->GetStart() = nThisStart;
- if( pHistory ) pHistory->Add( pOther, TRUE );
+ NoteInHistory( pOther, true );
nOtherStart = nThisStart;
}
@@ -275,17 +286,17 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
static_cast<SwTxtCharFmt*>(pNewAttr)->SetSortNumber( static_cast<SwTxtCharFmt*>(pOther)->GetSortNumber() );
aInsDelHints.push_back( pNewAttr );
- if( pHistory ) pHistory->Add( pOther );
+ NoteInHistory( pOther );
*pOther->GetStart() = nThisEnd;
- if( pHistory ) pHistory->Add( pOther, TRUE );
+ NoteInHistory( pOther, true );
}
}
// Insert the newly created attributes:
for ( aIter = aInsDelHints.begin(); aIter != aInsDelHints.end(); ++aIter )
{
- SwpHintsArr::Insert( *aIter );
- if ( pHistory ) pHistory->Add( *aIter, TRUE );
+ SwpHintsArray::Insert( *aIter );
+ NoteInHistory( *aIter, true );
}
}
@@ -305,7 +316,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
{
for ( USHORT i = 0; i < Count(); ++i )
{
- const SwTxtAttr* pOther = GetHt(i);
+ const SwTxtAttr* pOther = GetTextHint(i);
if ( RES_TXTATR_CHARFMT != pOther->Which() &&
RES_TXTATR_AUTOFMT != pOther->Which() )
@@ -338,7 +349,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
// Get all hints that are in [nPorStart, nPorEnd[:
for ( USHORT i = 0; i < Count(); ++i )
{
- SwTxtAttr *pOther = GetHt(i);
+ SwTxtAttr *pOther = GetTextHint(i);
if ( RES_TXTATR_CHARFMT != pOther->Which() &&
RES_TXTATR_AUTOFMT != pOther->Which() )
@@ -422,9 +433,10 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
// Create new AutoStyle
if ( aNewSet.Count() )
{
- pNewAttr = rNode.MakeTxtAttr( aNewSet, nPorStart, nPorEnd );
- SwpHintsArr::Insert( pNewAttr );
- if ( pHistory ) pHistory->Add( pNewAttr, TRUE );
+ pNewAttr = rNode.MakeTxtAttr( aNewSet,
+ nPorStart, nPorEnd );
+ SwpHintsArray::Insert( pNewAttr );
+ NoteInHistory( pNewAttr, true );
}
}
++aIter;
@@ -563,9 +575,9 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
if ( pNewAttr )
{
- SwpHintsArr::Insert( pNewAttr );
- if ( pHistory /* && bDestroyHint*/ )
- pHistory->Add( pNewAttr, TRUE );
+ SwpHintsArray::Insert( pNewAttr );
+// if ( bDestroyHint )
+ NoteInHistory( pNewAttr, true );
}
if ( !bNoLengthAttribute )
@@ -585,13 +597,13 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod
* SwTxtNode::MakeTxtAttr()
*************************************************************************/
- // lege ein neues TextAttribut an und fuege es SwpHints-Array ein
+// create new text attribute
SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxPoolItem& rAttr,
xub_StrLen nStt, xub_StrLen nEnd, bool bRedlineAttr )
{
SwDoc* pDoc = GetDoc();
- if ( !bRedlineAttr && RES_CHRATR_BEGIN <= rAttr.Which () && rAttr.Which() < RES_CHRATR_END )
+ if ( !bRedlineAttr && isCHRATR(rAttr.Which()) )
{
// Somebody wants to build a SwTxtAttr for a character attribute (and
// this attribute is not meant for redlining). Sorry, this is not allowed
@@ -791,8 +803,8 @@ SwTxtAttr* SwTxtNode::InsertItem( const SfxPoolItem& rAttr,
xub_StrLen nStt, xub_StrLen nEnd, USHORT nMode )
{
// character attributes will be inserted as automatic styles:
- ASSERT( rAttr.Which() < RES_CHRATR_BEGIN || rAttr.Which() >= RES_CHRATR_END,
- "AUTOSTYLES - InsertItem should not be called with character attributes" )
+ ASSERT( !isCHRATR(rAttr.Which()), "AUTOSTYLES - "
+ "SwTxtNode::InsertItem should not be called with character attributes");
SwTxtAttr* pNew = MakeTxtAttr( rAttr, nStt, nEnd );
@@ -866,11 +878,11 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
{
// loesche das Zeichen aus dem String !
ASSERT( ( CH_TXTATR_BREAKWORD ==
- aText.GetChar(*pAttr->GetStart() ) ||
+ m_Text.GetChar(*pAttr->GetStart() ) ||
CH_TXTATR_INWORD ==
- aText.GetChar(*pAttr->GetStart())),
- "where is my attribu character" );
- aText.Erase( *pAttr->GetStart(), 1 );
+ m_Text.GetChar(*pAttr->GetStart())),
+ "where is my attribute character?" );
+ m_Text.Erase( *pAttr->GetStart(), 1 );
// Indizies Updaten
SwIndex aTmpIdx( this, *pAttr->GetStart() );
Update( aTmpIdx, 1, TRUE );
@@ -904,11 +916,11 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
{
// loesche das Zeichen aus dem String !
ASSERT( ( CH_TXTATR_BREAKWORD ==
- aText.GetChar(*pAttr->GetStart() ) ||
+ m_Text.GetChar(*pAttr->GetStart() ) ||
CH_TXTATR_INWORD ==
- aText.GetChar(*pAttr->GetStart())),
- "where is my attribu character" );
- aText.Erase( *pAttr->GetStart(), 1 );
+ m_Text.GetChar(*pAttr->GetStart())),
+ "where is my attribute character?" );
+ m_Text.Erase( *pAttr->GetStart(), 1 );
// Indizies Updaten
SwIndex aTmpIdx( this, *pAttr->GetStart() );
Update( aTmpIdx, 1, TRUE );
@@ -922,7 +934,8 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
if( bNewFtn )
{
((SwTxtFtn*)pAttr)->MakeNewTextSection( GetNodes() );
- SwRegHistory* pHist = GetpSwpHints() ? GetpSwpHints()->getHistory() : 0;
+ SwRegHistory* pHist = GetpSwpHints()
+ ? GetpSwpHints()->GetHistory() : 0;
if( pHist )
pHist->ChangeNodeIndex( GetIndex() );
}
@@ -1014,17 +1027,18 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
ASSERT( *pAttr->GetEnd() <= Len(), "EndIdx hinter Len!" );
}
- if ( !pSwpHints )
- pSwpHints = new SwpHints();
+ GetOrCreateSwpHints();
// 4263: AttrInsert durch TextInsert => kein Adjust
- pSwpHints->Insert( pAttr, *this, nMode );
+ m_pSwpHints->Insert( pAttr, *this, nMode );
// 47375: In pSwpHints->Insert wird u.a. Merge gerufen und das Hints-Array
// von ueberfluessigen Hints befreit, dies kann u.U. sogar der frisch
// eingefuegte Hint pAttr sein, der dann zerstoert wird!!
- if( USHRT_MAX == pSwpHints->GetPos( pAttr ) )
+ if ( USHRT_MAX == m_pSwpHints->GetPos( pAttr ) )
+ {
return FALSE;
+ }
if( bHiddenPara )
SetCalcHiddenParaField();
@@ -1039,8 +1053,9 @@ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
void SwTxtNode::Delete( SwTxtAttr *pAttr, BOOL bThisOnly )
{
- if ( !pSwpHints )
+ if ( !HasHints() )
return;
+
if( bThisOnly )
{
xub_StrLen* pEndIdx = pAttr->GetEnd();
@@ -1056,13 +1071,12 @@ void SwTxtNode::Delete( SwTxtAttr *pAttr, BOOL bThisOnly )
// den MsgHint jetzt fuettern, weil gleich sind
// Start und End weg.
SwUpdateAttr aHint( *pAttr->GetStart(), *pEndIdx, pAttr->Which() );
- pSwpHints->Delete( pAttr );
+ m_pSwpHints->Delete( pAttr );
pAttr->RemoveFromPool( GetDoc()->GetAttrPool() );
delete pAttr;
SwModify::Modify( 0, &aHint ); // die Frames benachrichtigen
- if( pSwpHints && pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
+ TryDeleteSwpHints();
}
return;
@@ -1076,16 +1090,16 @@ void SwTxtNode::Delete( SwTxtAttr *pAttr, BOOL bThisOnly )
void SwTxtNode::Delete( USHORT nTxtWhich, xub_StrLen nStt, xub_StrLen nEnd )
{
- if ( !pSwpHints )
+ if ( !HasHints() )
return;
const xub_StrLen *pEndIdx;
const xub_StrLen *pSttIdx;
SwTxtAttr* pTxtHt;
- for( USHORT nPos = 0; pSwpHints && nPos < pSwpHints->Count(); nPos++ )
+ for ( USHORT nPos = 0; m_pSwpHints && nPos < m_pSwpHints->Count(); nPos++ )
{
- pTxtHt = pSwpHints->GetHt( nPos );
+ pTxtHt = m_pSwpHints->GetTextHint( nPos );
const USHORT nWhich = pTxtHt->Which();
if( nWhich == nTxtWhich &&
*( pSttIdx = pTxtHt->GetStart()) == nStt )
@@ -1128,7 +1142,7 @@ void SwTxtNode::Delete( USHORT nTxtWhich, xub_StrLen nStt, xub_StrLen nEnd )
// Das CalcVisibleFlag bei HiddenParaFields entfaellt,
// da dies das Feld im Dtor selbst erledigt.
SwUpdateAttr aHint( *pSttIdx, *pEndIdx, nTxtWhich );
- pSwpHints->DeleteAtPos( nPos ); // gefunden, loeschen,
+ m_pSwpHints->DeleteAtPos( nPos ); // gefunden, loeschen,
pTxtHt->RemoveFromPool( GetDoc()->GetAttrPool() );
delete pTxtHt;
SwModify::Modify( 0, &aHint ); // die Frames benachrichtigen
@@ -1136,8 +1150,7 @@ void SwTxtNode::Delete( USHORT nTxtWhich, xub_StrLen nStt, xub_StrLen nEnd )
}
}
}
- if( pSwpHints && pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
+ TryDeleteSwpHints();
}
/*************************************************************************
@@ -1148,7 +1161,7 @@ void SwTxtNode::DelSoftHyph( const xub_StrLen nStt, const xub_StrLen nEnd )
{
xub_StrLen nFndPos = nStt, nEndPos = nEnd;
while( STRING_NOTFOUND !=
- ( nFndPos = aText.Search( CHAR_SOFTHYPHEN, nFndPos )) &&
+ ( nFndPos = m_Text.Search( CHAR_SOFTHYPHEN, nFndPos )) &&
nFndPos < nEndPos )
{
const SwIndex aIdx( this, nFndPos );
@@ -1170,18 +1183,23 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
SfxItemSet aTxtSet( *rSet.GetPool(), RES_TXTATR_BEGIN, RES_TXTATR_END-1 );
// gesamter Bereich
- if( !nStt && nEnd == aText.Len() && !(nMode & nsSetAttrMode::SETATTR_NOFORMATATTR ) )
+ if ( !nStt && (nEnd == m_Text.Len()) &&
+ !(nMode & nsSetAttrMode::SETATTR_NOFORMATATTR ) )
{
// sind am Node schon Zeichenvorlagen gesetzt, muss man diese Attribute
// (rSet) immer als TextAttribute setzen, damit sie angezeigt werden.
int bHasCharFmts = FALSE;
- if( pSwpHints )
- for( USHORT n = 0; n < pSwpHints->Count(); ++n )
- if( (*pSwpHints)[ n ]->IsCharFmtAttr() )
+ if ( HasHints() )
+ {
+ for ( USHORT n = 0; n < m_pSwpHints->Count(); ++n )
+ {
+ if ( (*m_pSwpHints)[ n ]->IsCharFmtAttr() )
{
bHasCharFmts = TRUE;
break;
}
+ }
+ }
if( !bHasCharFmts )
{
@@ -1211,8 +1229,7 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
}
}
- if ( !pSwpHints )
- pSwpHints = new SwpHints();
+ GetOrCreateSwpHints();
SfxItemSet aCharSet( *rSet.GetPool(), aCharAutoFmtSetRange );
@@ -1223,47 +1240,50 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
do
{
- if( pItem && (SfxPoolItem*)-1 != pItem &&
- (( RES_CHRATR_BEGIN <= ( nWhich = pItem->Which()) &&
- RES_CHRATR_END > nWhich ) ||
- ( RES_TXTATR_BEGIN <= nWhich && RES_TXTATR_END > nWhich ) ||
- ( RES_UNKNOWNATR_BEGIN <= nWhich && RES_UNKNOWNATR_END > nWhich )) )
+ if ( pItem && (reinterpret_cast<SfxPoolItem*>(-1) != pItem))
{
- if( RES_TXTATR_CHARFMT == pItem->Which() &&
- GetDoc()->GetDfltCharFmt()==((SwFmtCharFmt*)pItem)->GetCharFmt())
- {
- SwIndex aIndex( this, nStt );
- RstAttr( aIndex, nEnd - nStt, RES_TXTATR_CHARFMT, 0 );
- DontExpandFmt( aIndex );
- }
- else
+ nWhich = pItem->Which();
+ if ( isCHRATR(nWhich) || isTXTATR(nWhich) || isUNKNOWNATR(nWhich) )
{
- if ( ( RES_CHRATR_BEGIN <= nWhich && RES_CHRATR_END > nWhich ) ||
- RES_TXTATR_UNKNOWN_CONTAINER == nWhich )
+ if ((RES_TXTATR_CHARFMT == nWhich) &&
+ (GetDoc()->GetDfltCharFmt() ==
+ static_cast<const SwFmtCharFmt*>(pItem)->GetCharFmt()))
{
- aCharSet.Put( *pItem );
+ SwIndex aIndex( this, nStt );
+ RstAttr( aIndex, nEnd - nStt, RES_TXTATR_CHARFMT, 0 );
+ DontExpandFmt( aIndex );
}
else
{
- pNew = MakeTxtAttr( *pItem, nStt, nEnd );
- if( pNew )
+ if (isCHRATR(nWhich) ||
+ (RES_TXTATR_UNKNOWN_CONTAINER == nWhich))
{
- // Attribut ohne Ende, aber Bereich markiert ?
- if( nEnd != nStt && !pNew->GetEnd() )
+ aCharSet.Put( *pItem );
+ }
+ else
+ {
+ pNew = MakeTxtAttr( *pItem, nStt, nEnd );
+ if ( pNew )
{
- ASSERT( !this, "Attribut ohne Ende aber Bereich vorgegeben" );
- DestroyAttr( pNew ); // nicht einfuegen
+ if ( nEnd != nStt && !pNew->GetEnd() )
+ {
+ ASSERT(false,
+ "Attribut without end, but area marked");
+ DestroyAttr( pNew ); // do not insert
+ }
+ else if ( Insert( pNew, nMode ) )
+ {
+ ++nCount;
+ }
}
- else if( Insert( pNew, nMode ))
- ++nCount;
}
}
}
}
- if( aIter.IsAtEnd() )
+ if ( aIter.IsAtEnd() )
break;
pItem = aIter.NextItem();
- } while( TRUE );
+ } while( true );
if ( aCharSet.Count() )
{
@@ -1272,8 +1292,7 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
++nCount;
}
- if( pSwpHints && pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
+ TryDeleteSwpHints();
return nCount ? TRUE : FALSE;
}
@@ -1372,7 +1391,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
BOOL bOnlyTxtAttr, BOOL bGetFromChrFmt,
const bool bMergeIndentValuesOfNumRule ) const
{
- if( pSwpHints )
+ if( HasHints() )
{
/* stelle erstmal fest, welche Text-Attribut in dem Bereich gueltig
* sind. Dabei gibt es folgende Faelle:
@@ -1403,7 +1422,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
// <--
}
- const USHORT nSize = pSwpHints->Count();
+ const USHORT nSize = m_pSwpHints->Count();
USHORT n;
xub_StrLen nAttrStart;
const xub_StrLen* pAttrEnd;
@@ -1412,7 +1431,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
{
for( n = 0; n < nSize; ++n ) //
{
- const SwTxtAttr* pHt = (*pSwpHints)[n];
+ const SwTxtAttr* pHt = (*m_pSwpHints)[n];
nAttrStart = *pHt->GetStart();
if( nAttrStart > nEnd ) // ueber den Bereich hinaus
break;
@@ -1441,7 +1460,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
for( n = 0; n < nSize; ++n )
{
- const SwTxtAttr* pHt = (*pSwpHints)[n];
+ const SwTxtAttr* pHt = (*m_pSwpHints)[n];
nAttrStart = *pHt->GetStart();
if( nAttrStart > nEnd ) // ueber den Bereich hinaus
break;
@@ -1494,13 +1513,21 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
pAttrArr = new std::vector< SwPoolItemEndPair >( coArrSz );
std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin();
- if( RES_CHRATR_BEGIN <= nHintWhich && nHintWhich < RES_TXTATR_WITHEND_END )
+ if (isCHRATR(nHintWhich) ||
+ isTXTATR_WITHEND(nHintWhich))
+ {
pPrev += nHintWhich - RES_CHRATR_BEGIN;
- else if( RES_UNKNOWNATR_BEGIN <= nHintWhich && nHintWhich < RES_UNKNOWNATR_END )
+ }
+ else if (isUNKNOWNATR(nHintWhich))
+ {
pPrev += nHintWhich - RES_UNKNOWNATR_BEGIN + (
- static_cast< USHORT >(RES_TXTATR_WITHEND_END) - static_cast< USHORT >(RES_CHRATR_BEGIN) );
+ static_cast< USHORT >(RES_TXTATR_WITHEND_END) -
+ static_cast< USHORT >(RES_CHRATR_BEGIN) );
+ }
else
+ {
pPrev = pAttrArr->end();
+ }
#if OSL_DEBUG_LEVEL > 1
SwPoolItemEndPair aTmp = *pPrev;
@@ -1627,8 +1654,7 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
if( HasSwAttrSet() && GetpSwAttrSet()->Count() )
aThisSet.Put( *GetpSwAttrSet() );
- if ( !pSwpHints )
- pSwpHints = new SwpHints();
+ GetOrCreateSwpHints();
if( pNd == this )
{
@@ -1638,11 +1664,11 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
const SfxPoolItem* pItem = aIter.GetCurItem();
std::vector<USHORT> aClearWhichIds;
- while( TRUE )
+ while ( true )
{
- if( lcl_IsNewAttrInSet( *pSwpHints, *pItem, GetTxt().Len() ) )
+ if (lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ))
{
- pSwpHints->SwpHintsArr::Insert(
+ m_pSwpHints->SwpHintsArray::Insert(
MakeTxtAttr( *pItem, 0, GetTxt().Len() ) );
aClearWhichIds.push_back( pItem->Which() );
}
@@ -1661,8 +1687,7 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
if( pNd->HasSwAttrSet() && pNd->GetpSwAttrSet()->Count() )
aNdSet.Put( *pNd->GetpSwAttrSet() );
- if ( !pNd->pSwpHints )
- pNd->pSwpHints = new SwpHints();
+ pNd->GetOrCreateSwpHints();
if( aThisSet.Count() )
{
@@ -1674,9 +1699,9 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
{
if( ( SFX_ITEM_SET != aNdSet.GetItemState( pItem->Which(), FALSE,
&pNdItem ) || *pItem != *pNdItem ) &&
- lcl_IsNewAttrInSet( *pSwpHints, *pItem, GetTxt().Len() ) )
+ lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ) )
{
- pSwpHints->SwpHintsArr::Insert(
+ m_pSwpHints->SwpHintsArray::Insert(
MakeTxtAttr( *pItem, 0, GetTxt().Len() ) );
aClearWhichIds.push_back( pItem->Which() );
}
@@ -1695,11 +1720,14 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
const SfxPoolItem* pItem = aIter.GetCurItem();
std::vector<USHORT> aClearWhichIds;
- while( TRUE )
+ while ( true )
{
- if( lcl_IsNewAttrInSet( *pNd->pSwpHints, *pItem, pNd->GetTxt().Len() ) )
- pNd->pSwpHints->SwpHintsArr::Insert(
+ if ( lcl_IsNewAttrInSet( *pNd->m_pSwpHints, *pItem,
+ pNd->GetTxt().Len() ) )
+ {
+ pNd->m_pSwpHints->SwpHintsArray::Insert(
pNd->MakeTxtAttr( *pItem, 0, pNd->GetTxt().Len() ) );
+ }
aClearWhichIds.push_back( pItem->Which() );
if( aIter.IsAtEnd() )
@@ -1715,8 +1743,7 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
SetCalcHiddenCharFlags();
- if( pNd->pSwpHints->CanBeDeleted() )
- DELETEZ( pNd->pSwpHints );
+ pNd->TryDeleteSwpHints();
}
/*************************************************************************
@@ -1725,15 +1752,16 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
void SwpHints::CalcFlags()
{
- bDDEFlds = bFtn = FALSE;
+ m_bDDEFields = m_bFootnote = false;
const USHORT nSize = Count();
const SwTxtAttr* pAttr;
for( USHORT nPos = 0; nPos < nSize; ++nPos )
+ {
switch( ( pAttr = (*this)[ nPos ])->Which() )
{
case RES_TXTATR_FTN:
- bFtn = TRUE;
- if( bDDEFlds )
+ m_bFootnote = true;
+ if ( m_bDDEFields )
return;
break;
case RES_TXTATR_FIELD:
@@ -1741,24 +1769,25 @@ void SwpHints::CalcFlags()
const SwField* pFld = pAttr->GetFld().GetFld();
if( RES_DDEFLD == pFld->GetTyp()->Which() )
{
- bDDEFlds = TRUE;
- if( bFtn )
+ m_bDDEFields = true;
+ if ( m_bFootnote )
return;
}
}
break;
}
+ }
}
/*************************************************************************
* SwpHints::CalcVisibleFlag()
*************************************************************************/
-BOOL SwpHints::CalcHiddenParaField()
+bool SwpHints::CalcHiddenParaField()
{
- bCalcHiddenParaField = FALSE;
- BOOL bOldHasHiddenParaField = bHasHiddenParaField;
- BOOL bNewHasHiddenParaField = FALSE;
+ m_bCalcHiddenParaField = false;
+ bool bOldHasHiddenParaField = m_bHasHiddenParaField;
+ bool bNewHasHiddenParaField = false;
const USHORT nSize = Count();
const SwTxtAttr *pTxtHt;
@@ -1774,11 +1803,13 @@ BOOL SwpHints::CalcHiddenParaField()
{
if( !((SwHiddenParaField*)rFld.GetFld())->IsHidden() )
{
- SetHiddenParaField(FALSE);
+ SetHiddenParaField(false);
return bOldHasHiddenParaField != bNewHasHiddenParaField;
}
else
- bNewHasHiddenParaField = TRUE;
+ {
+ bNewHasHiddenParaField = true;
+ }
}
}
}
@@ -1791,10 +1822,9 @@ BOOL SwpHints::CalcHiddenParaField()
* SwpHints::NoteInHistory()
*************************************************************************/
-void SwpHints::NoteInHistory( SwTxtAttr *pAttr, const BOOL bNew )
+void SwpHints::NoteInHistory( SwTxtAttr *pAttr, const bool bNew )
{
- if ( pHistory )
- pHistory->Add( pAttr, bNew );
+ if ( m_pHistory ) { m_pHistory->AddHint( pAttr, bNew ); }
}
/*************************************************************************
@@ -1807,7 +1837,7 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
return false;
// sort before merging
- SwpHintsArr::Resort();
+ SwpHintsArray::Resort();
bool bRet = false;
typedef std::multimap< int, SwTxtAttr* > PortionMap;
@@ -1819,7 +1849,7 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
// get portions by start position:
for ( i = 0; i < Count(); ++i )
{
- SwTxtAttr *pHt = GetHt( i );
+ SwTxtAttr *pHt = GetTextHint( i );
if ( RES_TXTATR_CHARFMT != pHt->Which() &&
RES_TXTATR_AUTOFMT != pHt->Which() )
//&&
@@ -1891,9 +1921,9 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
for ( aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1 )
{
SwTxtAttr* p1 = (*aIter1).second;
- if( pHistory ) pHistory->Add( p1 );
+ NoteInHistory( p1 );
*p1->GetEnd() = nNewPortionEnd;
- if( pHistory ) pHistory->Add( p1, TRUE );
+ NoteInHistory( p1, true );
bRet = true;
}
}
@@ -1905,7 +1935,9 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
}
if ( bRet )
- SwpHintsArr::Resort();
+ {
+ SwpHintsArray::Resort();
+ }
return bRet;
}
@@ -2083,12 +2115,12 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
((SwTxtRefMark*)pHint)->ChgTxtNode( &rNode );
if( rNode.GetNodes().IsDocNodes() )
{
- //search for a refernce with the same name
+ // search for a reference with the same name
SwTxtAttr* pTmpHt;
xub_StrLen *pTmpHtEnd, *pTmpHintEnd;
for( USHORT n = 0, nEnd = Count(); n < nEnd; ++n )
{
- if( RES_TXTATR_REFMARK == (pTmpHt = GetHt( n ))->Which() &&
+ if (RES_TXTATR_REFMARK == (pTmpHt = GetTextHint(n))->Which() &&
pHint->GetAttr() == pTmpHt->GetAttr() &&
0 != ( pTmpHtEnd = pTmpHt->GetEnd() ) &&
0 != ( pTmpHintEnd = pHint->GetEnd() ) )
@@ -2118,8 +2150,7 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
if( bDelOld )
{
- if( pHistory )
- pHistory->Add( pTmpHt );
+ NoteInHistory( pTmpHt );
rNode.DestroyAttr( Cut( n-- ) );
--nEnd;
}
@@ -2155,7 +2186,7 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
xub_StrLen nHtStart = *pHint->GetStart();
if( !pHtEnd )
{
- SwpHintsArr::Insert( pHint );
+ SwpHintsArray::Insert( pHint );
CalcFlags();
#ifdef DBG_UTIL
if( !rNode.GetDoc()->IsInReading() )
@@ -2232,9 +2263,8 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
lcl_CheckSortNumber( *this, *static_cast<SwTxtCharFmt*>(pHint) );
// <--
- SwpHintsArr::Insert( pHint );
- if ( pHistory )
- pHistory->Add( pHint, TRUE );
+ SwpHintsArray::Insert( pHint );
+ NoteInHistory( pHint, true );
}
}
@@ -2259,10 +2289,10 @@ void SwpHints::Insert( SwTxtAttr* pHint, SwTxtNode &rNode, USHORT nMode )
void SwpHints::DeleteAtPos( const USHORT nPos )
{
- SwTxtAttr *pHint = GetHt(nPos);
+ SwTxtAttr *pHint = GetTextHint(nPos);
// ChainDelete( pHint );
- if( pHistory ) pHistory->Add( pHint );
- SwpHintsArr::DeleteAtPos( nPos );
+ NoteInHistory( pHint );
+ SwpHintsArray::DeleteAtPos( nPos );
if( RES_TXTATR_FIELD == pHint->Which() )
{
@@ -2278,8 +2308,11 @@ void SwpHints::DeleteAtPos( const USHORT nPos )
{
const_cast<SwFmtFld&>(((SwTxtFld*)pHint)->GetFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFld(), SWFMTFLD_REMOVED ) );
}
- else if( bHasHiddenParaField && RES_HIDDENPARAFLD == pFldTyp->Which() )
- bCalcHiddenParaField = TRUE;
+ else if ( m_bHasHiddenParaField &&
+ RES_HIDDENPARAFLD == pFldTyp->Which() )
+ {
+ m_bCalcHiddenParaField = true;
+ }
}
CalcFlags();
@@ -2300,12 +2333,12 @@ void SwpHints::Delete( SwTxtAttr* pTxtHt )
void SwTxtNode::ClearSwpHintsArr( bool bDelFields )
{
- if( pSwpHints )
+ if ( HasHints() )
{
USHORT nPos = 0;
- while( nPos < pSwpHints->Count() )
+ while ( nPos < m_pSwpHints->Count() )
{
- SwTxtAttr* pDel = pSwpHints->GetHt( nPos );
+ SwTxtAttr* pDel = m_pSwpHints->GetTextHint( nPos );
bool bDel = false;
switch( pDel->Which() )
@@ -2325,7 +2358,7 @@ void SwTxtNode::ClearSwpHintsArr( bool bDelFields )
if( bDel )
{
- pSwpHints->SwpHintsArr::DeleteAtPos( nPos );
+ m_pSwpHints->SwpHintsArray::DeleteAtPos( nPos );
DestroyAttr( pDel );
}
else
@@ -2339,20 +2372,22 @@ USHORT SwTxtNode::GetLang( const xub_StrLen nBegin, const xub_StrLen nLen,
{
USHORT nRet = LANGUAGE_DONTKNOW;
- if ( ! nScript )
- nScript = pBreakIt->GetRealScriptOfText( aText, nBegin );
+ if ( ! nScript )
+ {
+ nScript = pBreakIt->GetRealScriptOfText( m_Text, nBegin );
+ }
// --> FME 2008-09-29 #i91465# hennerdrewes: Consider nScript if pSwpHints == 0
const USHORT nWhichId = GetWhichOfScript( RES_CHRATR_LANGUAGE, nScript );
// <--
- if( pSwpHints )
+ if ( HasHints() )
{
const xub_StrLen nEnd = nBegin + nLen;
- for( USHORT i = 0, nSize = pSwpHints->Count(); i < nSize; ++i )
+ for ( USHORT i = 0, nSize = m_pSwpHints->Count(); i < nSize; ++i )
{
// ist der Attribut-Anfang schon groesser als der Idx ?
- const SwTxtAttr *pHt = pSwpHints->operator[](i);
+ const SwTxtAttr *pHt = m_pSwpHints->operator[](i);
const xub_StrLen nAttrStart = *pHt->GetStart();
if( nEnd < nAttrStart )
break;
diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx
index 71938961ef7f..17c94a9e20c9 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -37,12 +37,18 @@
#include <fmtfld.hxx>
#include <docufld.hxx>
-SwTxtAttr::SwTxtAttr( const SfxPoolItem& rAttr, xub_StrLen nStt )
- : pAttr( &rAttr ), nStart( nStt )
+SwTxtAttr::SwTxtAttr( const SfxPoolItem& rAttr, xub_StrLen nStart )
+ : m_pAttr( &rAttr )
+ , m_nStart( nStart )
+ , m_bDontExpand( false )
+ , m_bLockExpandFlag( false )
+ , m_bDontMergeAttr( false )
+ , m_bDontMoveAttr( false )
+ , m_bCharFmtAttr( false )
+ , m_bOverlapAllowedAttr( false )
+ , m_bPriorityAttr( false )
+ , m_bDontExpandStart( false )
{
- bDontExpand = bLockExpandFlag = bDontMergeAttr = bDontMoveAttr =
- bCharFmtAttr = bOverlapAllowedAttr = bPriorityAttr =
- bDontExpandStart = FALSE;
}
SwTxtAttr::~SwTxtAttr( )
@@ -54,12 +60,11 @@ xub_StrLen* SwTxtAttr::GetEnd()
return 0;
}
- // RemoveFromPool muss immer vorm DTOR Aufruf erfolgen!!
- // Meldet sein Attribut beim Pool ab
+// RemoveFromPool must be called before destructor!
void SwTxtAttr::RemoveFromPool( SfxItemPool& rPool )
{
rPool.Remove( GetAttr() );
- pAttr = 0;
+ m_pAttr = 0;
}
int SwTxtAttr::operator==( const SwTxtAttr& rAttr ) const
@@ -67,13 +72,14 @@ int SwTxtAttr::operator==( const SwTxtAttr& rAttr ) const
return GetAttr() == rAttr.GetAttr();
}
-SwTxtAttrEnd::SwTxtAttrEnd( const SfxPoolItem& rAttr, xub_StrLen nS,
- xub_StrLen nE )
- : SwTxtAttr( rAttr, nS ), nEnd( nE )
+SwTxtAttrEnd::SwTxtAttrEnd( const SfxPoolItem& rAttr,
+ xub_StrLen nStart, xub_StrLen nEnd ) :
+ SwTxtAttr( rAttr, nStart ), m_nEnd( nEnd )
{
}
xub_StrLen* SwTxtAttrEnd::GetEnd()
{
- return &nEnd;
+ return & m_nEnd;
}
+
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index a55678eca057..eca88502f771 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -56,10 +56,10 @@ TYPEINIT1(SwTxtRuby,SwClient);
*************************************************************************/
SwTxtHardBlank::SwTxtHardBlank( const SwFmtHardBlank& rAttr, xub_StrLen nStt )
- : SwTxtAttr( rAttr, nStt ),
- cChar( rAttr.GetChar() )
+ : SwTxtAttr( rAttr, nStt )
+ , m_Char( rAttr.GetChar() )
{
- ASSERT( ' ' != cChar && '-' != cChar,
+ ASSERT( ' ' != m_Char && '-' != m_Char,
"Invalid character for the HardBlank attribute - "
"must be a normal unicode character" );
}
@@ -69,13 +69,13 @@ SwTxtHardBlank::SwTxtHardBlank( const SwFmtHardBlank& rAttr, xub_StrLen nStt )
* class SwTxtCharFmt
*************************************************************************/
-SwTxtCharFmt::SwTxtCharFmt( const SwFmtCharFmt& rAttr,
+SwTxtCharFmt::SwTxtCharFmt( SwFmtCharFmt& rAttr,
xub_StrLen nStt, xub_StrLen nEnde )
- : SwTxtAttrEnd( rAttr, nStt, nEnde ),
- pMyTxtNd( 0 ),
- mnSortNumber( 0 )
+ : SwTxtAttrEnd( rAttr, nStt, nEnde )
+ , m_pTxtNode( 0 )
+ , m_nSortNumber( 0 )
{
- ((SwFmtCharFmt&)rAttr).pTxtAttr = this;
+ rAttr.pTxtAttr = this;
SetCharFmtAttr( TRUE );
}
@@ -86,29 +86,27 @@ SwTxtCharFmt::~SwTxtCharFmt( )
void SwTxtCharFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
{
USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
-#ifdef DBG_UTIL
- if ( (nWhich<RES_CHRATR_BEGIN || nWhich>RES_CHRATR_END)
- && (nWhich!=RES_OBJECTDYING)
- && (nWhich!=RES_ATTRSET_CHG)
- && (nWhich!=RES_FMT_CHG) )
- ASSERT(!this, "SwTxtCharFmt::Modify(): unbekanntes Modify!");
-#endif
-
- if( pMyTxtNd )
+ ASSERT( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich)
+ || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich),
+ "SwTxtCharFmt::Modify(): unknown Modify");
+
+ if ( m_pTxtNode )
{
SwUpdateAttr aUpdateAttr( *GetStart(), *GetEnd(), nWhich );
- pMyTxtNd->Modify( &aUpdateAttr, &aUpdateAttr );
+ m_pTxtNode->Modify( &aUpdateAttr, &aUpdateAttr );
}
}
// erfrage vom Modify Informationen
BOOL SwTxtCharFmt::GetInfo( SfxPoolItem& rInfo ) const
{
- if( RES_AUTOFMT_DOCNODE != rInfo.Which() || !pMyTxtNd ||
- &pMyTxtNd->GetNodes() != ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+ if ( RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTxtNode ||
+ &m_pTxtNode->GetNodes() != static_cast<SwAutoFmtGetDocNode&>(rInfo).pNodes )
+ {
return TRUE;
+ }
- ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = pMyTxtNd;
+ static_cast<SwAutoFmtGetDocNode&>(rInfo).pCntntNode = m_pTxtNode;
return FALSE;
}
@@ -116,14 +114,15 @@ BOOL SwTxtCharFmt::GetInfo( SfxPoolItem& rInfo ) const
* class SwTxtINetFmt
*************************************************************************/
-SwTxtINetFmt::SwTxtINetFmt( const SwFmtINetFmt& rAttr,
+SwTxtINetFmt::SwTxtINetFmt( SwFmtINetFmt& rAttr,
xub_StrLen nStt, xub_StrLen nEnde )
- : SwTxtAttrEnd( rAttr, nStt, nEnde ),
- SwClient( 0 ),
- pMyTxtNd( 0 )
+ : SwTxtAttrEnd( rAttr, nStt, nEnde )
+ , SwClient( 0 )
+ , m_pTxtNode( 0 )
+ , m_bVisited( false )
+ , m_bVisitedValid( false )
{
- bValidVis = FALSE;
- ((SwFmtINetFmt&)rAttr).pTxtAttr = this;
+ rAttr.pTxtAttr = this;
SetCharFmtAttr( TRUE );
}
@@ -139,10 +138,10 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt()
if( rFmt.GetValue().Len() )
{
const SwDoc* pDoc = GetTxtNode().GetDoc();
- if( !IsValidVis() )
+ if( !IsVisitedValid() )
{
SetVisited( pDoc->IsVisitedURL( rFmt.GetValue() ) );
- SetValidVis( TRUE );
+ SetVisitedValid( true );
}
USHORT nId;
const String& rStr = IsVisited() ? rFmt.GetVisitedFmt()
@@ -184,35 +183,33 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt()
void SwTxtINetFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
{
USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
-#ifdef DBG_UTIL
- if ( (nWhich<RES_CHRATR_BEGIN || nWhich>RES_CHRATR_END)
- && (nWhich!=RES_OBJECTDYING)
- && (nWhich!=RES_ATTRSET_CHG)
- && (nWhich!=RES_FMT_CHG) )
- ASSERT(!this, "SwTxtCharFmt::Modify(): unbekanntes Modify!");
-#endif
-
- if( pMyTxtNd )
+ ASSERT( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich)
+ || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich),
+ "SwTxtINetFmt::Modify(): unknown Modify");
+
+ if ( m_pTxtNode )
{
SwUpdateAttr aUpdateAttr( *GetStart(), *GetEnd(), nWhich );
- pMyTxtNd->Modify( &aUpdateAttr, &aUpdateAttr );
+ m_pTxtNode->Modify( &aUpdateAttr, &aUpdateAttr );
}
}
// erfrage vom Modify Informationen
BOOL SwTxtINetFmt::GetInfo( SfxPoolItem& rInfo ) const
{
- if( RES_AUTOFMT_DOCNODE != rInfo.Which() || !pMyTxtNd ||
- &pMyTxtNd->GetNodes() != ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+ if ( RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTxtNode ||
+ &m_pTxtNode->GetNodes() != static_cast<SwAutoFmtGetDocNode&>(rInfo).pNodes )
+ {
return TRUE;
+ }
- ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = pMyTxtNd;
+ static_cast<SwAutoFmtGetDocNode&>(rInfo).pCntntNode = m_pTxtNode;
return FALSE;
}
BOOL SwTxtINetFmt::IsProtect( ) const
{
- return pMyTxtNd && pMyTxtNd->IsProtect();
+ return m_pTxtNode && m_pTxtNode->IsProtect();
}
// ATT_XNLCONTAINERITEM ******************************
@@ -224,20 +221,21 @@ SwTxtXMLAttrContainer::SwTxtXMLAttrContainer(
{}
+/*************************************************************************
+ * class SwTxtRuby
+ *************************************************************************/
-// ******************************
-
-SwTxtRuby::SwTxtRuby( const SwFmtRuby& rAttr,
- xub_StrLen nStt, xub_StrLen nEnde )
- : SwTxtAttrEnd( rAttr, nStt, nEnde ),
- SwClient( 0 ),
- pMyTxtNd( 0 )
+SwTxtRuby::SwTxtRuby( SwFmtRuby& rAttr,
+ xub_StrLen nStart, xub_StrLen nEnd )
+ : SwTxtAttrEnd( rAttr, nStart, nEnd )
+ , SwClient( 0 )
+ , m_pTxtNode( 0 )
{
- ((SwFmtRuby&)rAttr).pTxtAttr = this;
- SetDontExpand( TRUE ); // never expand this attribut
- SetLockExpandFlag( TRUE );
- SetDontMergeAttr( TRUE );
- SetDontExpandStartAttr( TRUE );
+ rAttr.pTxtAttr = this;
+ SetDontExpand( true ); // never expand this attribute
+ SetLockExpandFlag( true );
+ SetDontMergeAttr( true );
+ SetDontExpandStartAttr( true );
}
SwTxtRuby::~SwTxtRuby()
@@ -247,28 +245,26 @@ SwTxtRuby::~SwTxtRuby()
void SwTxtRuby::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
{
USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
-#ifdef DBG_UTIL
- if ( (nWhich<RES_CHRATR_BEGIN || nWhich>RES_CHRATR_END)
- && (nWhich!=RES_OBJECTDYING)
- && (nWhich!=RES_ATTRSET_CHG)
- && (nWhich!=RES_FMT_CHG) )
- ASSERT(!this, "SwTxtCharFmt::Modify(): unbekanntes Modify!");
-#endif
-
- if( pMyTxtNd )
+ ASSERT( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich)
+ || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich),
+ "SwTxtRuby::Modify(): unknown Modify");
+
+ if ( m_pTxtNode )
{
SwUpdateAttr aUpdateAttr( *GetStart(), *GetEnd(), nWhich );
- pMyTxtNd->Modify( &aUpdateAttr, &aUpdateAttr );
+ m_pTxtNode->Modify( &aUpdateAttr, &aUpdateAttr );
}
}
BOOL SwTxtRuby::GetInfo( SfxPoolItem& rInfo ) const
{
- if( RES_AUTOFMT_DOCNODE != rInfo.Which() || !pMyTxtNd ||
- &pMyTxtNd->GetNodes() != ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+ if( RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTxtNode ||
+ &m_pTxtNode->GetNodes() != static_cast<SwAutoFmtGetDocNode&>(rInfo).pNodes )
+ {
return TRUE;
+ }
- ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = pMyTxtNd;
+ static_cast<SwAutoFmtGetDocNode&>(rInfo).pCntntNode = m_pTxtNode;
return FALSE;
}
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index b00e9c0febcd..51e4963698a7 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -50,12 +50,8 @@
#include <SwSmartTagMgr.hxx>
#include <linguistic/lngprops.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HDL
#include <com/sun/star/i18n/WordType.hdl>
-#endif
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
#include <unotools/transliterationwrapper.hxx>
#include <unotools/charclass.hxx>
#include <dlelstnr.hxx>
@@ -64,9 +60,7 @@
#include <viewopt.hxx>
#include <acmplwrd.hxx>
#include <doc.hxx> // GetDoc()
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <txtfld.hxx>
#include <fmtfld.hxx>
#include <txatbase.hxx>
@@ -380,25 +374,27 @@ static bool lcl_HaveCommonAttributes( IStyleAccess& rStyleAccess,
SwTxtNode& SwTxtNode::Insert( xub_Unicode c, const SwIndex &rIdx )
{
- xub_StrLen nOrigLen = aText.Len();
+ xub_StrLen nOrigLen = m_Text.Len();
- ASSERT( rIdx <= nOrigLen, "Array ueberindiziert." );
- ASSERT( nOrigLen < STRING_LEN, "USHRT_MAX ueberschritten." );
+ ASSERT( rIdx <= nOrigLen, "SwTxtNode::Insert: invalid index." );
+ ASSERT( nOrigLen < STRING_LEN,
+ "SwTxtNode::Insert: node text with insertion > STRING_LEN." );
- if( nOrigLen == aText.Insert( c, rIdx.GetIndex() ).Len() )
+ if ( nOrigLen == m_Text.Insert( c, rIdx.GetIndex() ).Len() )
return *this;
Update(rIdx,1);
// leere Hints und Feldattribute an rIdx.GetIndex suchen
- if( pSwpHints )
+ if ( HasHints() )
{
USHORT* pEndIdx;
- for( USHORT i=0; i < pSwpHints->Count() &&
- rIdx >= *(*pSwpHints)[i]->GetStart(); ++i)
+ for ( USHORT i=0; i < m_pSwpHints->Count() &&
+ rIdx >= *(*m_pSwpHints)[i]->GetStart(); ++i)
{
- SwTxtAttr *pHt = pSwpHints->GetHt(i);
- if( 0 != ( pEndIdx = pHt->GetEnd()) )
+ SwTxtAttr *pHt = m_pSwpHints->GetTextHint(i);
+ pEndIdx = pHt->GetEnd();
+ if ( pEndIdx )
{
// leere Hints an rIdx.GetIndex ?
BOOL bEmpty = *pEndIdx == *pHt->GetStart()
@@ -406,7 +402,7 @@ SwTxtNode& SwTxtNode::Insert( xub_Unicode c, const SwIndex &rIdx )
if( bEmpty )
{
- pSwpHints->DeleteAtPos(i);
+ m_pSwpHints->DeleteAtPos(i);
if( bEmpty )
*pHt->GetStart() -= 1;
else
@@ -415,8 +411,7 @@ SwTxtNode& SwTxtNode::Insert( xub_Unicode c, const SwIndex &rIdx )
}
}
}
- if ( pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
+ TryDeleteSwpHints();
}
// den Frames Bescheid sagen
SwInsChr aHint( rIdx.GetIndex()-1 );
@@ -431,23 +426,22 @@ inline BOOL InRange(xub_StrLen nIdx, xub_StrLen nStart, xub_StrLen nEnd) {
/*
* void SwTxtNode::RstAttr(const SwIndex &rIdx, USHORT nLen)
*
- * loescht alle Attribute ab der Position rIdx ueber eine Laenge
- * von nLen.
+ * Deletes all attributes, starting at position rIdx, for length nLen.
*/
-/* 5 Faelle:
- * 1) Das Attribut liegt vollstaendig im Bereich:
- * -> loeschen
- * 2) Das Attributende liegt im Bereich:
- * -> Loeschen, mit neuem Ende einfuegen
- * 3) Der Attributanfang liegt im Bereich:
- * -> Loeschen, mit neuem Anfang einfuegen
- * 4) Das Attrib umfasst den Bereich:
- * Aufsplitten, d.h.
- * -> Loeschen, mit alten Anfang und Anfang des Bereiches einfuegen
- * -> Neues Attribut mit Ende des Bereiches und altem Ende einfuegen
- * 5) Das Attribut liegt ausserhalb des Bereiches
- * -> nichts tun.
+/* 5 cases:
+ * 1) The attribute is completely in the deletion range:
+ * -> delete it
+ * 2) The end of the attribute is in the deletion range:
+ * -> delete it, then re-insert it with new end
+ * 3) The start of the attribute is in the deletion range:
+ * -> delete it, then re-insert it with new start
+ * 4) The attribute contains the deletion range:
+ * Split, i.e.,
+ * -> Delete, re-insert from old start to start of deletion range
+ * -> insert new attribute from end of deletion range to old end
+ * 5) The attribute is outside the deletion range
+ * -> nothing to do
*/
void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
@@ -466,8 +460,8 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
BOOL bChanged = FALSE;
- // nMin und nMax werden invers auf das Maximum bzw. Minimum gesetzt.
- xub_StrLen nMin = aText.Len();
+ // nMin and nMax initialized to maximum / minimum (inverse)
+ xub_StrLen nMin = m_Text.Len();
xub_StrLen nMax = nStt;
const BOOL bNoLen = !nMin;
@@ -477,16 +471,16 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
// They may not be forgotten inside the "Forget" function
//std::vector< const SwTxtAttr* > aNewAttributes;
- // durch das Attribute-Array, bis der Anfang des Geltungsbereiches
- // des Attributs hinter dem Bereich liegt
- while( (i < pSwpHints->Count()) &&
- ((( nAttrStart = *(*pSwpHints)[i]->GetStart()) < nEnd )
- || nLen==0) )
+ // iterate over attribute array until start of attribute is behind
+ // deletion range
+ while ((i < m_pSwpHints->Count()) &&
+ ((( nAttrStart = *(*m_pSwpHints)[i]->GetStart()) < nEnd ) || nLen==0) )
{
- pHt = pSwpHints->GetHt(i);
+ pHt = m_pSwpHints->GetTextHint(i);
- // Attribute ohne Ende bleiben drin!
- if ( 0 == (pAttrEnd=pHt->GetEnd()) )
+ // attributes without end stay in!
+ pAttrEnd = pHt->GetEnd();
+ if ( !pAttrEnd )
{
i++;
continue;
@@ -524,10 +518,8 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
RES_TXTATR_TOXMARK == pHt->Which();
}
- if( bSkipAttr )
-
+ if ( bSkipAttr )
{
- // Es sollen nur Attribute mit nWhich beachtet werden
i++;
continue;
}
@@ -550,7 +542,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
{
const xub_StrLen nAttrEnd = *pAttrEnd;
- pSwpHints->DeleteAtPos(i);
+ m_pSwpHints->DeleteAtPos(i);
DestroyAttr( pHt );
if ( pStyleHandle.get() )
@@ -559,9 +551,9 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
Insert( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
- // falls das letzte Attribut ein Field ist, loescht
- // dieses das HintsArray !!!
- if( !pSwpHints )
+ // if the last attribute is a Field, the HintsArray is
+ // deleted!
+ if ( !m_pSwpHints )
break;
//JP 26.11.96:
@@ -576,9 +568,9 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
}
else // Fall: 3
{
- pSwpHints->NoteInHistory( pHt );
+ m_pSwpHints->NoteInHistory( pHt );
*pHt->GetStart() = nEnd;
- pSwpHints->NoteInHistory( pHt, TRUE );
+ m_pSwpHints->NoteInHistory( pHt, TRUE );
if ( pStyleHandle.get() && nAttrStart < nEnd )
{
@@ -603,9 +595,9 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
const xub_StrLen nAttrEnd = *pAttrEnd;
- pSwpHints->NoteInHistory( pHt );
+ m_pSwpHints->NoteInHistory( pHt );
*pAttrEnd = nStt;
- pSwpHints->NoteInHistory( pHt, TRUE );
+ m_pSwpHints->NoteInHistory( pHt, TRUE );
if ( pStyleHandle.get() )
{
@@ -622,9 +614,9 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
nMax = *pAttrEnd;
bChanged = TRUE;
xub_StrLen nTmpEnd = *pAttrEnd;
- pSwpHints->NoteInHistory( pHt );
+ m_pSwpHints->NoteInHistory( pHt );
*pAttrEnd = nStt;
- pSwpHints->NoteInHistory( pHt, TRUE );
+ m_pSwpHints->NoteInHistory( pHt, TRUE );
if ( pStyleHandle.get() && nStt < nEnd )
{
@@ -654,13 +646,12 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
++i;
}
- if ( pSwpHints && pSwpHints->CanBeDeleted() )
- DELETEZ( pSwpHints );
- if(bChanged)
+ TryDeleteSwpHints();
+ if (bChanged)
{
- if ( pSwpHints )
+ if ( HasHints() )
{
- ((SwpHintsArr*)pSwpHints)->Resort();
+ m_pSwpHints->Resort();
}
//TxtFrm's reagieren auf aHint, andere auf aNew
SwUpdateAttr aHint( nMin, nMax, 0 );
@@ -683,13 +674,12 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
* einen leeren String.
*************************************************************************/
-
-
XubString SwTxtNode::GetCurWord( xub_StrLen nPos ) const
{
- ASSERT( nPos<=aText.Len() , "SwTxtNode::GetCurWord: Pos hinter String?");
- if (!aText.Len())
- return aText;
+ ASSERT( nPos <= m_Text.Len(), "SwTxtNode::GetCurWord: invalid index." );
+
+ if (!m_Text.Len())
+ return m_Text;
Boundary aBndry;
const uno::Reference< XBreakIterator > &rxBreak = pBreakIt->xBreak;
@@ -698,16 +688,19 @@ XubString SwTxtNode::GetCurWord( xub_StrLen nPos ) const
sal_Int16 nWordType = WordType::DICTIONARY_WORD;
lang::Locale aLocale( pBreakIt->GetLocale( GetLang( nPos ) ) );
#ifdef DEBUG
- BOOL bBegin = rxBreak->isBeginWord( aText, nPos, aLocale, nWordType );
- BOOL bEnd = rxBreak->isEndWord ( aText, nPos, aLocale, nWordType );
+ BOOL bBegin = rxBreak->isBeginWord( m_Text, nPos, aLocale, nWordType );
+ BOOL bEnd = rxBreak->isEndWord ( m_Text, nPos, aLocale, nWordType );
(void)bBegin;
(void)bEnd;
#endif
- aBndry = rxBreak->getWordBoundary( aText, nPos, aLocale, nWordType, TRUE );
+ aBndry =
+ rxBreak->getWordBoundary( m_Text, nPos, aLocale, nWordType, TRUE );
// if no word was found use previous word (if any)
if (aBndry.startPos == aBndry.endPos)
- aBndry = rxBreak->previousWord( aText, nPos, aLocale, nWordType );
+ {
+ aBndry = rxBreak->previousWord( m_Text, nPos, aLocale, nWordType );
+ }
}
// check if word was found and if it uses a symbol font, if so
@@ -715,7 +708,7 @@ XubString SwTxtNode::GetCurWord( xub_StrLen nPos ) const
if (aBndry.endPos != aBndry.startPos && IsSymbol( (xub_StrLen)aBndry.startPos ))
aBndry.endPos = aBndry.startPos;
- return aText.Copy( static_cast<xub_StrLen>(aBndry.startPos),
+ return m_Text.Copy( static_cast<xub_StrLen>(aBndry.startPos),
static_cast<xub_StrLen>(aBndry.endPos - aBndry.startPos) );
}
@@ -865,19 +858,18 @@ USHORT SwTxtNode::Spell(SwSpellArgs* pArgs)
xub_StrLen nBegin, nEnd;
// modify string according to redline information and hidden text
- const XubString aOldTxt( aText );
+ const XubString aOldTxt( m_Text );
const bool bRestoreString =
- lcl_MaskRedlinesAndHiddenText( *this, aText, 0, aText.Len() ) > 0;
+ lcl_MaskRedlinesAndHiddenText( *this, m_Text, 0, m_Text.Len() ) > 0;
if ( pArgs->pStartNode != this )
nBegin = 0;
else
nBegin = pArgs->pStartIdx->GetIndex();
- if ( pArgs->pEndNode != this )
- nEnd = aText.Len();
- else
- nEnd = pArgs->pEndIdx->GetIndex();
+ nEnd = ( pArgs->pEndNode != this )
+ ? m_Text.Len()
+ : pArgs->pEndIdx->GetIndex();
pArgs->xSpellAlt = NULL;
@@ -893,12 +885,16 @@ USHORT SwTxtNode::Spell(SwSpellArgs* pArgs)
// Text has been checked but there is an invalid range in the wrong list
//
// Nothing has to be done for case 1.
- if( ( IsWrongDirty() || GetWrong() ) && aText.Len() )
+ if ( ( IsWrongDirty() || GetWrong() ) && m_Text.Len() )
{
- if( nBegin > aText.Len() )
- nBegin = aText.Len();
- if( nEnd > aText.Len() )
- nEnd = aText.Len();
+ if ( nBegin > m_Text.Len() )
+ {
+ nBegin = m_Text.Len();
+ }
+ if ( nEnd > m_Text.Len() )
+ {
+ nEnd = m_Text.Len();
+ }
//
if(!IsWrongDirty())
{
@@ -907,7 +903,9 @@ USHORT SwTxtNode::Spell(SwSpellArgs* pArgs)
{
// reset original text
if ( bRestoreString )
- aText = aOldTxt;
+ {
+ m_Text = aOldTxt;
+ }
return 0;
}
if(nTemp > nBegin)
@@ -917,7 +915,7 @@ USHORT SwTxtNode::Spell(SwSpellArgs* pArgs)
// In case 2. we pass the wrong list to the scanned, because only
// the words in the wrong list have to be checked
- SwScanner aScanner( *this, aText, 0, 0,
+ SwScanner aScanner( *this, m_Text, 0, 0,
WordType::DICTIONARY_WORD,
nBegin, nEnd );
while( !pArgs->xSpellAlt.is() && aScanner.NextWord() )
@@ -970,7 +968,9 @@ USHORT SwTxtNode::Spell(SwSpellArgs* pArgs)
// reset original text
if ( bRestoreString )
- aText = aOldTxt;
+ {
+ m_Text = aOldTxt;
+ }
return pArgs->xSpellAlt.is() ? 1 : 0;
}
@@ -1025,28 +1025,27 @@ USHORT SwTxtNode::Convert( SwConversionArgs &rArgs )
}
else
nTextBegin = rArgs.pStartIdx->GetIndex();
- if (nTextBegin > aText.Len())
- nTextBegin = aText.Len();
- //
- if ( rArgs.pEndNode != this )
- nTextEnd = aText.Len();
- else
- nTextEnd = rArgs.pEndIdx->GetIndex();
- if (nTextEnd > aText.Len())
- nTextEnd = aText.Len();
+ if (nTextBegin > m_Text.Len())
+ {
+ nTextBegin = m_Text.Len();
+ }
+
+ nTextEnd = ( rArgs.pEndNode != this )
+ ? m_Text.Len()
+ : ::std::min( rArgs.pEndIdx->GetIndex(), m_Text.Len() );
rArgs.aConvText = rtl::OUString();
// modify string according to redline information and hidden text
- const XubString aOldTxt( aText );
+ const XubString aOldTxt( m_Text );
const bool bRestoreString =
- lcl_MaskRedlinesAndHiddenText( *this, aText, 0, aText.Len() ) > 0;
+ lcl_MaskRedlinesAndHiddenText( *this, m_Text, 0, m_Text.Len() ) > 0;
sal_Bool bFound = sal_False;
xub_StrLen nBegin = nTextBegin;
xub_StrLen nLen = 0;
LanguageType nLangFound = LANGUAGE_NONE;
- if (!aText.Len())
+ if (!m_Text.Len())
{
if (rArgs.bAllowImplicitChangesForNotConvertibleText)
{
@@ -1075,7 +1074,9 @@ USHORT SwTxtNode::Convert( SwConversionArgs &rArgs )
// which becomes 65535 when converted to xub_StrLen,
// and thus must be cut to the end of the actual string.
if (nChPos == (xub_StrLen) -1)
- nChPos = aText.Len();
+ {
+ nChPos = m_Text.Len();
+ }
nLen = nChPos - nBegin;
bFound = bLangOk && nLen > 0;
@@ -1114,9 +1115,9 @@ USHORT SwTxtNode::Convert( SwConversionArgs &rArgs )
if (bFound && bInSelection) // convertible text found within selection/range?
{
- const XubString aTxtPortion = aText.Copy( nBegin, nLen );
- DBG_ASSERT( aText.Len() > 0, "convertible text portion missing!" );
- rArgs.aConvText = aText.Copy( nBegin, nLen );
+ const XubString aTxtPortion = m_Text.Copy( nBegin, nLen );
+ DBG_ASSERT( m_Text.Len() > 0, "convertible text portion missing!" );
+ rArgs.aConvText = m_Text.Copy( nBegin, nLen );
rArgs.nConvTextLang = nLangFound;
// position where to start looking in next iteration (after current ends)
@@ -1129,7 +1130,9 @@ USHORT SwTxtNode::Convert( SwConversionArgs &rArgs )
// restore original text
if ( bRestoreString )
- aText = aOldTxt;
+ {
+ m_Text = aOldTxt;
+ }
return rArgs.aConvText.getLength() ? 1 : 0;
}
@@ -1153,15 +1156,17 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords();
// modify string according to redline information and hidden text
- const XubString aOldTxt( pNode->aText );
+ const XubString aOldTxt( pNode->GetTxt() );
const bool bRestoreString =
- lcl_MaskRedlinesAndHiddenText( *pNode, pNode->aText, 0, pNode->aText.Len() ) > 0;
+ lcl_MaskRedlinesAndHiddenText( *pNode, pNode->m_Text,
+ 0, pNode->GetTxt().Len() ) > 0;
// a change of data indicates that at least one word has been modified
- const sal_Bool bRedlineChg = ( pNode->aText.GetBuffer() != aOldTxt.GetBuffer() );
+ const sal_Bool bRedlineChg =
+ ( pNode->GetTxt().GetBuffer() != aOldTxt.GetBuffer() );
xub_StrLen nBegin = 0;
- xub_StrLen nEnd = pNode->aText.Len();
+ xub_StrLen nEnd = pNode->GetTxt().Len();
xub_StrLen nInsertPos = 0;
xub_StrLen nChgStart = STRING_LEN;
xub_StrLen nChgEnd = 0;
@@ -1177,8 +1182,10 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
if( STRING_LEN != nBegin )
{
nEnd = pNode->GetWrong()->GetEndInv();
- if ( nEnd > pNode->aText.Len() )
- nEnd = pNode->aText.Len();
+ if ( nEnd > pNode->GetTxt().Len() )
+ {
+ nEnd = pNode->GetTxt().Len();
+ }
}
// get word around nBegin, we start at nBegin - 1
@@ -1188,8 +1195,10 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
--nBegin;
LanguageType eActLang = pNode->GetLang( nBegin );
- Boundary aBound = pBreakIt->xBreak->getWordBoundary( pNode->aText, nBegin,
- pBreakIt->GetLocale( eActLang ), WordType::DICTIONARY_WORD, TRUE );
+ Boundary aBound =
+ pBreakIt->xBreak->getWordBoundary( pNode->GetTxt(), nBegin,
+ pBreakIt->GetLocale( eActLang ),
+ WordType::DICTIONARY_WORD, TRUE );
nBegin = xub_StrLen(aBound.startPos);
}
@@ -1216,8 +1225,8 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() );
SwDoc* pDoc = pNode->GetDoc();
- SwScanner aScanner( *pNode, pNode->aText, 0, 0, WordType::DICTIONARY_WORD,
- nBegin, nEnd);
+ SwScanner aScanner( *pNode, pNode->GetTxt(), 0, 0,
+ WordType::DICTIONARY_WORD, nBegin, nEnd);
while( aScanner.NextWord() )
{
@@ -1274,7 +1283,9 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
// reset original text
// i63141 before calling GetCharRect(..) with formatting!
if ( bRestoreString )
- pNode->aText = aOldTxt;
+ {
+ pNode->m_Text = aOldTxt;
+ }
if( pNode->GetWrong() )
{
if( bFresh )
@@ -1443,7 +1454,7 @@ void SwTxtFrm::CollectAutoCmplWrds( SwCntntNode* pActNode, xub_StrLen nActPos )
SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords();
xub_StrLen nBegin = 0;
- xub_StrLen nEnd = pNode->aText.Len();
+ xub_StrLen nEnd = pNode->GetTxt().Len();
xub_StrLen nLen;
BOOL bACWDirty = FALSE, bAnyWrd = FALSE;
@@ -1451,8 +1462,8 @@ void SwTxtFrm::CollectAutoCmplWrds( SwCntntNode* pActNode, xub_StrLen nActPos )
if( nBegin < nEnd )
{
USHORT nCnt = 200;
- SwScanner aScanner( *pNode, pNode->aText, 0, 0, WordType::DICTIONARY_WORD,
- nBegin, nEnd );
+ SwScanner aScanner( *pNode, pNode->GetTxt(), 0, 0,
+ WordType::DICTIONARY_WORD, nBegin, nEnd );
while( aScanner.NextWord() )
{
nBegin = aScanner.GetBegin();
@@ -1492,8 +1503,8 @@ void SwTxtFrm::CollectAutoCmplWrds( SwCntntNode* pActNode, xub_StrLen nActPos )
BOOL SwTxtNode::Hyphenate( SwInterHyphInfo &rHyphInf )
{
// Abkuerzung: am Absatz ist keine Sprache eingestellt:
- if( LANGUAGE_NONE == USHORT( GetSwAttrSet().GetLanguage().GetLanguage() ) &&
- USHRT_MAX == GetLang( 0, aText.Len() ) )
+ if ( LANGUAGE_NONE == USHORT( GetSwAttrSet().GetLanguage().GetLanguage() )
+ && USHRT_MAX == GetLang( 0, m_Text.Len() ) )
{
if( !rHyphInf.IsCheck() )
rHyphInf.SetNoLang( TRUE );
@@ -1642,12 +1653,14 @@ void SwTxtNode::TransliterateText( utl::TransliterationWrapper& rTrans,
xub_StrLen nLen = nEndPos - nStt;
Sequence <sal_Int32> aOffsets;
- String sChgd( rTrans.transliterate( aText, nLang, nStt, nLen,
- &aOffsets ));
- if( !aText.Equals( sChgd, nStt, nLen ) )
+ String sChgd( rTrans.transliterate( m_Text, nLang, nStt, nLen,
+ &aOffsets ));
+ if( !m_Text.Equals( sChgd, nStt, nLen ) )
{
- if( pUndo )
+ if ( pUndo )
+ {
pUndo->AddChanges( *this, nStt, nLen, aOffsets );
+ }
ReplaceTextOnly( nStt, nLen, sChgd, aOffsets );
}
nStt = nEndPos;
@@ -1661,7 +1674,7 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
const XubString& rText,
const Sequence<sal_Int32>& rOffsets )
{
- aText.Replace( nPos, nLen, rText );
+ m_Text.Replace( nPos, nLen, rText );
xub_StrLen nTLen = rText.Len();
const sal_Int32* pOffsets = rOffsets.getConstArray();
@@ -1721,8 +1734,8 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
}
else
{
- String aOldStr( aText );
- String& rCastStr = (String&)aText;
+ String aOldStr( m_Text );
+ String& rCastStr = const_cast<String&>(m_Text);
// fills the deleted redlines and hidden ranges with cChar:
const xub_Unicode cChar(' ');
@@ -1839,53 +1852,59 @@ struct SwParaIdleData_Impl
void SwTxtNode::InitSwParaStatistics( bool bNew )
{
if ( bNew )
- pParaIdleData_Impl = new SwParaIdleData_Impl;
- else if ( pParaIdleData_Impl )
{
- delete pParaIdleData_Impl->pWrong;
- delete pParaIdleData_Impl->pGrammarCheck;
- delete pParaIdleData_Impl->pSmartTags;
- delete pParaIdleData_Impl;
- pParaIdleData_Impl = 0;
+ m_pParaIdleData_Impl = new SwParaIdleData_Impl;
+ }
+ else if ( m_pParaIdleData_Impl )
+ {
+ delete m_pParaIdleData_Impl->pWrong;
+ delete m_pParaIdleData_Impl->pGrammarCheck;
+ delete m_pParaIdleData_Impl->pSmartTags;
+ delete m_pParaIdleData_Impl;
+ m_pParaIdleData_Impl = 0;
}
}
void SwTxtNode::SetWrong( SwWrongList* pNew, bool bDelete )
{
- if ( pParaIdleData_Impl )
+ if ( m_pParaIdleData_Impl )
{
if ( bDelete )
- delete pParaIdleData_Impl->pWrong;
- pParaIdleData_Impl->pWrong = pNew;
+ {
+ delete m_pParaIdleData_Impl->pWrong;
+ }
+ m_pParaIdleData_Impl->pWrong = pNew;
}
}
SwWrongList* SwTxtNode::GetWrong()
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->pWrong : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pWrong : 0;
}
// --> OD 2008-05-27 #i71360#
const SwWrongList* SwTxtNode::GetWrong() const
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->pWrong : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pWrong : 0;
}
// <--
void SwTxtNode::SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete )
{
- if ( pParaIdleData_Impl )
+ if ( m_pParaIdleData_Impl )
{
if ( bDelete )
- delete pParaIdleData_Impl->pGrammarCheck;
- pParaIdleData_Impl->pGrammarCheck = pNew;
+ {
+ delete m_pParaIdleData_Impl->pGrammarCheck;
+ }
+ m_pParaIdleData_Impl->pGrammarCheck = pNew;
}
}
SwGrammarMarkUp* SwTxtNode::GetGrammarCheck()
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->pGrammarCheck : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pGrammarCheck : 0;
}
void SwTxtNode::SetSmartTags( SwWrongList* pNew, bool bDelete )
@@ -1893,81 +1912,97 @@ void SwTxtNode::SetSmartTags( SwWrongList* pNew, bool bDelete )
ASSERT( !pNew || SwSmartTagMgr::Get().IsSmartTagsEnabled(),
"Weird - we have a smart tag list without any recognizers?" )
- if ( pParaIdleData_Impl )
+ if ( m_pParaIdleData_Impl )
{
if ( bDelete )
- delete pParaIdleData_Impl->pSmartTags;
- pParaIdleData_Impl->pSmartTags = pNew;
+ {
+ delete m_pParaIdleData_Impl->pSmartTags;
+ }
+ m_pParaIdleData_Impl->pSmartTags = pNew;
}
}
SwWrongList* SwTxtNode::GetSmartTags()
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->pSmartTags : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pSmartTags : 0;
}
void SwTxtNode::SetParaNumberOfWords( ULONG nNew ) const
{
- if ( pParaIdleData_Impl )
- pParaIdleData_Impl->nNumberOfWords = nNew;
+ if ( m_pParaIdleData_Impl )
+ {
+ m_pParaIdleData_Impl->nNumberOfWords = nNew;
+ }
}
ULONG SwTxtNode::GetParaNumberOfWords() const
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->nNumberOfWords : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->nNumberOfWords : 0;
}
void SwTxtNode::SetParaNumberOfChars( ULONG nNew ) const
{
- if ( pParaIdleData_Impl )
- pParaIdleData_Impl->nNumberOfChars = nNew;
+ if ( m_pParaIdleData_Impl )
+ {
+ m_pParaIdleData_Impl->nNumberOfChars = nNew;
+ }
}
ULONG SwTxtNode::GetParaNumberOfChars() const
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->nNumberOfChars : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->nNumberOfChars : 0;
}
void SwTxtNode::SetWordCountDirty( bool bNew ) const
{
- if ( pParaIdleData_Impl )
- pParaIdleData_Impl->bWordCountDirty = bNew;
+ if ( m_pParaIdleData_Impl )
+ {
+ m_pParaIdleData_Impl->bWordCountDirty = bNew;
+ }
}
bool SwTxtNode::IsWordCountDirty() const
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->bWordCountDirty : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bWordCountDirty : 0;
}
void SwTxtNode::SetWrongDirty( bool bNew ) const
{
- if ( pParaIdleData_Impl )
- pParaIdleData_Impl->bWrongDirty = bNew;
+ if ( m_pParaIdleData_Impl )
+ {
+ m_pParaIdleData_Impl->bWrongDirty = bNew;
+ }
}
bool SwTxtNode::IsWrongDirty() const
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->bWrongDirty : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bWrongDirty : 0;
}
void SwTxtNode::SetGrammarCheckDirty( bool bNew ) const
{
- if ( pParaIdleData_Impl )
- pParaIdleData_Impl->bGrammarCheckDirty = bNew;
+ if ( m_pParaIdleData_Impl )
+ {
+ m_pParaIdleData_Impl->bGrammarCheckDirty = bNew;
+ }
}
bool SwTxtNode::IsGrammarCheckDirty() const
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->bGrammarCheckDirty : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bGrammarCheckDirty : 0;
}
void SwTxtNode::SetSmartTagDirty( bool bNew ) const
{
- if ( pParaIdleData_Impl )
- pParaIdleData_Impl->bSmartTagDirty = bNew;
+ if ( m_pParaIdleData_Impl )
+ {
+ m_pParaIdleData_Impl->bSmartTagDirty = bNew;
+ }
}
bool SwTxtNode::IsSmartTagDirty() const
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->bSmartTagDirty : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bSmartTagDirty : 0;
}
void SwTxtNode::SetAutoCompleteWordDirty( bool bNew ) const
{
- if ( pParaIdleData_Impl )
- pParaIdleData_Impl->bAutoComplDirty = bNew;
+ if ( m_pParaIdleData_Impl )
+ {
+ m_pParaIdleData_Impl->bAutoComplDirty = bNew;
+ }
}
bool SwTxtNode::IsAutoCompleteWordDirty() const
{
- return pParaIdleData_Impl ? pParaIdleData_Impl->bAutoComplDirty : 0;
+ return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bAutoComplDirty : 0;
}
//
// Paragraph statistics end
diff --git a/sw/source/core/undo/makefile.mk b/sw/source/core/undo/makefile.mk
index 12665cf26daa..4c7a332eec74 100644
--- a/sw/source/core/undo/makefile.mk
+++ b/sw/source/core/undo/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -68,6 +68,7 @@ SLOFILES = \
$(SLO)$/undel.obj \
$(SLO)$/undobj.obj \
$(SLO)$/undobj1.obj \
+ $(SLO)$/undoflystrattr.obj \
$(SLO)$/undraw.obj \
$(SLO)$/unfmco.obj \
$(SLO)$/unins.obj \
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 776dee62f443..ec62ab78de79 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -72,41 +72,46 @@
#include <svx/brkitem.hxx>
#include <bookmrk.hxx>
-SV_IMPL_PTRARR( SwpHstry, SwHstryHintPtr)
+SV_IMPL_PTRARR( SwpHstry, SwHistoryHintPtr)
-String SwHstryHint::GetDescription() const
+String SwHistoryHint::GetDescription() const
{
return String();
}
-SwSetFmtHint::SwSetFmtHint( const SfxPoolItem* pFmtHt, ULONG nNd )
- : SwHstryHint( HSTRY_SETFMTHNT ),
- pAttr( pFmtHt->Clone() ),
- nNode( nNd )
+SwHistorySetFmt::SwHistorySetFmt( const SfxPoolItem* pFmtHt, ULONG nNd )
+ : SwHistoryHint( HSTRY_SETFMTHNT )
+ , m_pAttr( pFmtHt->Clone() )
+ , m_nNodeIndex( nNd )
{
- switch( pAttr->Which() )
+ switch ( m_pAttr->Which() )
{
- case RES_PAGEDESC:
- ((SwFmtPageDesc*)pAttr)->ChgDefinedIn( 0 );
- break;
- case RES_PARATR_DROP:
- ((SwFmtDrop*)pAttr)->ChgDefinedIn( 0 );
- break;
- case RES_BOXATR_FORMULA:
+ case RES_PAGEDESC:
+ static_cast<SwFmtPageDesc&>(*m_pAttr).ChgDefinedIn( 0 );
+ break;
+ case RES_PARATR_DROP:
+ static_cast<SwFmtDrop&>(*m_pAttr).ChgDefinedIn( 0 );
+ break;
+ case RES_BOXATR_FORMULA:
{
//JP 30.07.98: Bug 54295 - Formeln immer im Klartext speichern
- SwTblBoxFormula& rNew = *(SwTblBoxFormula*)pAttr;
- if( rNew.IsIntrnlName() )
+ SwTblBoxFormula& rNew = static_cast<SwTblBoxFormula&>(*m_pAttr);
+ if ( rNew.IsIntrnlName() )
{
- const SwTblBoxFormula& rOld = *(SwTblBoxFormula*)pFmtHt;
+ const SwTblBoxFormula& rOld =
+ *static_cast<const SwTblBoxFormula*>(pFmtHt);
const SwNode* pNd = rOld.GetNodeOfFormula();
- if( pNd && 0 != (pNd = pNd->FindTableNode() ))
+ if ( pNd )
{
- SwTableFmlUpdate aMsgHnt( &((SwTableNode*)pNd)->GetTable() );
- aMsgHnt.eFlags = TBL_BOXNAME;
- rNew.ChgDefinedIn( rOld.GetDefinedIn() );
- rNew.ChangeState( &aMsgHnt );
+ const SwTableNode* pTableNode = pNd->FindTableNode();
+ if (pTableNode)
+ {
+ SwTableFmlUpdate aMsgHnt( &pTableNode->GetTable() );
+ aMsgHnt.eFlags = TBL_BOXNAME;
+ rNew.ChgDefinedIn( rOld.GetDefinedIn() );
+ rNew.ChangeState( &aMsgHnt );
+ }
}
}
rNew.ChgDefinedIn( 0 );
@@ -115,15 +120,15 @@ SwSetFmtHint::SwSetFmtHint( const SfxPoolItem* pFmtHt, ULONG nNd )
}
}
-String SwSetFmtHint::GetDescription() const
+String SwHistorySetFmt::GetDescription() const
{
String aResult ;
- USHORT nWhich = pAttr->Which();
+ USHORT nWhich = m_pAttr->Which();
switch (nWhich)
{
case RES_BREAK:
- switch (((SvxFmtBreakItem *) pAttr)->GetBreak())
+ switch ((static_cast<SvxFmtBreakItem &>(*m_pAttr)).GetBreak())
{
case SVX_BREAK_PAGE_BEFORE:
case SVX_BREAK_PAGE_AFTER:
@@ -148,58 +153,73 @@ String SwSetFmtHint::GetDescription() const
return aResult;
}
-void SwSetFmtHint::SetInDoc( SwDoc* pDoc, BOOL bTmpSet )
+void SwHistorySetFmt::SetInDoc( SwDoc* pDoc, bool bTmpSet )
{
- SwNode * pNode = pDoc->GetNodes()[ nNode ];
- if( pNode->IsCntntNode() )
+ SwNode * pNode = pDoc->GetNodes()[ m_nNodeIndex ];
+ if ( pNode->IsCntntNode() )
{
- ((SwCntntNode*)pNode)->SetAttr( *pAttr );
+ static_cast<SwCntntNode*>(pNode)->SetAttr( *m_pAttr );
}
- else if( pNode->IsTableNode() )
- ((SwTableNode*)pNode)->GetTable().GetFrmFmt()->SetFmtAttr( *pAttr );
- else if( pNode->IsStartNode() &&
- SwTableBoxStartNode == ((SwStartNode*)pNode)->GetStartNodeType() )
+ else if ( pNode->IsTableNode() )
+ {
+ static_cast<SwTableNode*>(pNode)->GetTable().GetFrmFmt()->SetFmtAttr(
+ *m_pAttr );
+ }
+ else if ( pNode->IsStartNode() && (SwTableBoxStartNode ==
+ static_cast<SwStartNode*>(pNode)->GetStartNodeType()) )
{
SwTableNode* pTNd = pNode->FindTableNode();
- SwTableBox* pBox;
- if( pTNd && 0 != ( pBox = pTNd->GetTable().GetTblBox( nNode )))
- pBox->ClaimFrmFmt()->SetFmtAttr( *pAttr );
+ if ( pTNd )
+ {
+ SwTableBox* pBox = pTNd->GetTable().GetTblBox( m_nNodeIndex );
+ if (pBox)
+ {
+ pBox->ClaimFrmFmt()->SetFmtAttr( *m_pAttr );
+ }
+ }
}
- if( !bTmpSet )
- DELETEZ( pAttr );
+ if ( !bTmpSet )
+ {
+ m_pAttr.reset();
+ }
}
-SwSetFmtHint::~SwSetFmtHint()
+SwHistorySetFmt::~SwHistorySetFmt()
{
- delete pAttr;
}
// --> OD 2008-02-27 #refactorlists# - removed <rDoc>
-SwResetFmtHint::SwResetFmtHint( const SfxPoolItem* pFmtHt, ULONG nNodeIdx )
+SwHistoryResetFmt::SwHistoryResetFmt(const SfxPoolItem* pFmtHt, ULONG nNodeIdx)
// <--
- : SwHstryHint( HSTRY_RESETFMTHNT ),
- nNode( nNodeIdx ),
- nWhich( pFmtHt->Which() )
+ : SwHistoryHint( HSTRY_RESETFMTHNT )
+ , m_nNodeIndex( nNodeIdx )
+ , m_nWhich( pFmtHt->Which() )
{
}
-void SwResetFmtHint::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistoryResetFmt::SetInDoc( SwDoc* pDoc, bool )
{
- SwNode * pNode = pDoc->GetNodes()[ nNode ];
+ SwNode * pNode = pDoc->GetNodes()[ m_nNodeIndex ];
if ( pNode->IsCntntNode() )
{
- ((SwCntntNode*)pNode)->ResetAttr( nWhich );
+ static_cast<SwCntntNode*>(pNode)->ResetAttr( m_nWhich );
+ }
+ else if ( pNode->IsTableNode() )
+ {
+ static_cast<SwTableNode*>(pNode)->GetTable().GetFrmFmt()->
+ ResetFmtAttr( m_nWhich );
}
- else if( pNode->IsTableNode() )
- ((SwTableNode*)pNode)->GetTable().GetFrmFmt()->ResetFmtAttr( nWhich );
}
-SwSetTxtHint::SwSetTxtHint( SwTxtAttr* pTxtHt, ULONG nNodePos )
- : SwHstryHint( HSTRY_SETTXTHNT )
+SwHistorySetTxt::SwHistorySetTxt( SwTxtAttr* pTxtHt, ULONG nNodePos )
+ : SwHistoryHint( HSTRY_SETTXTHNT )
+ , m_nNodeIndex( nNodePos )
+ , m_nStart( *pTxtHt->GetStart() )
+ , m_nEnd( *pTxtHt->GetAnyEnd() )
{
// !! Achtung: folgende Attribute erzeugen keine FormatAttribute:
// - NoLineBreak, NoHypen, Inserted, Deleted
@@ -208,354 +228,372 @@ SwSetTxtHint::SwSetTxtHint( SwTxtAttr* pTxtHt, ULONG nNodePos )
// ein bisschen kompliziert, aber ist Ok so: erst vom default
// eine Kopie und dann die Werte aus dem Text Attribut zuweisen
USHORT nWhich = pTxtHt->Which();
- if( RES_TXTATR_CHARFMT == nWhich )
- pAttr = new SwFmtCharFmt( pTxtHt->GetCharFmt().GetCharFmt() );
+ if ( RES_TXTATR_CHARFMT == nWhich )
+ {
+ m_pAttr.reset( new SwFmtCharFmt( pTxtHt->GetCharFmt().GetCharFmt() ) );
+ }
else
- pAttr = pTxtHt->GetAttr().Clone();
- nNode = nNodePos;
- nStart = *pTxtHt->GetStart();
- nEnd = *pTxtHt->GetAnyEnd();
+ {
+ m_pAttr.reset( pTxtHt->GetAttr().Clone() );
+ }
}
-SwSetTxtHint::~SwSetTxtHint()
+SwHistorySetTxt::~SwHistorySetTxt()
{
- delete pAttr;
}
-void SwSetTxtHint::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistorySetTxt::SetInDoc( SwDoc* pDoc, bool )
{
- if( !pAttr )
+ if ( !m_pAttr.get() )
return;
- if( RES_TXTATR_CHARFMT == pAttr->Which() )
+ if ( RES_TXTATR_CHARFMT == m_pAttr->Which() )
{
- // befrage das Doc, ob das CharFmt noch vorhanden ist !
- if( USHRT_MAX == pDoc->GetCharFmts()->GetPos(
- ((SwFmtCharFmt*)pAttr)->GetCharFmt() ) )
- return; // nicht setzen, Format nicht vorhanden
+ // ask the Doc if the CharFmt still exists
+ if ( USHRT_MAX == pDoc->GetCharFmts()->GetPos(
+ (static_cast<SwFmtCharFmt&>(*m_pAttr)).GetCharFmt() ) )
+ return; // do not set, format does not exist
}
- SwTxtNode * pTxtNd = pDoc->GetNodes()[ nNode ]->GetTxtNode();
- ASSERT( pTxtNd, "Undo-TxtAttr: kein TextNode" );
+ SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode();
+ ASSERT( pTxtNd, "SwHistorySetTxt::SetInDoc: not a TextNode" );
- if( pTxtNd )
- pTxtNd->InsertItem( *pAttr, nStart, nEnd,
- nsSetAttrMode::SETATTR_NOTXTATRCHR | nsSetAttrMode::SETATTR_NOHINTADJUST );
+ if ( pTxtNd )
+ {
+ pTxtNd->InsertItem( *m_pAttr, m_nStart, m_nEnd,
+ nsSetAttrMode::SETATTR_NOTXTATRCHR |
+ nsSetAttrMode::SETATTR_NOHINTADJUST );
+ }
}
-SwSetTxtFldHint::SwSetTxtFldHint( SwTxtFld* pTxtFld, ULONG nNodePos )
- : SwHstryHint( HSTRY_SETTXTFLDHNT ), pFldType( 0 )
+SwHistorySetTxtFld::SwHistorySetTxtFld( SwTxtFld* pTxtFld, ULONG nNodePos )
+ : SwHistoryHint( HSTRY_SETTXTFLDHNT )
+ , m_pFldType( 0 )
+ , m_pFld( new SwFmtFld( *pTxtFld->GetFld().GetFld() ) )
{
- pFld = new SwFmtFld( *pTxtFld->GetFld().GetFld() );
-
- // nur kopieren wenn kein Sys-FieldType
- SwDoc* pDoc = (SwDoc*)pTxtFld->GetTxtNode().GetDoc();
+ // only copy if not Sys-FieldType
+ SwDoc* pDoc = pTxtFld->GetTxtNode().GetDoc();
- nFldWhich = pFld->GetFld()->GetTyp()->Which();
- if( nFldWhich == RES_DBFLD ||
- nFldWhich == RES_USERFLD ||
- nFldWhich == RES_SETEXPFLD ||
- nFldWhich == RES_DDEFLD ||
- !pDoc->GetSysFldType( nFldWhich ))
+ m_nFldWhich = m_pFld->GetFld()->GetTyp()->Which();
+ if (m_nFldWhich == RES_DBFLD ||
+ m_nFldWhich == RES_USERFLD ||
+ m_nFldWhich == RES_SETEXPFLD ||
+ m_nFldWhich == RES_DDEFLD ||
+ !pDoc->GetSysFldType( m_nFldWhich ))
{
- pFldType = pFld->GetFld()->GetTyp()->Copy();
- pFld->GetFld()->ChgTyp( pFldType ); // Fieldtype umsetzen
+ m_pFldType.reset( m_pFld->GetFld()->GetTyp()->Copy() );
+ m_pFld->GetFld()->ChgTyp( m_pFldType.get() ); // change field type
}
- nNode = nNodePos;
- nPos = *pTxtFld->GetStart();
+ m_nNodeIndex = nNodePos;
+ m_nPos = *pTxtFld->GetStart();
}
-String SwSetTxtFldHint::GetDescription() const
+String SwHistorySetTxtFld::GetDescription() const
{
- return pFld->GetFld()->GetDescription();;
+ return m_pFld->GetFld()->GetDescription();;
}
-SwSetTxtFldHint::~SwSetTxtFldHint()
+SwHistorySetTxtFld::~SwHistorySetTxtFld()
{
- delete pFld;
- delete pFldType;
}
-void SwSetTxtFldHint::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistorySetTxtFld::SetInDoc( SwDoc* pDoc, bool )
{
- if( !pFld )
+ if ( !m_pFld.get() )
return;
- SwFieldType* pNewFldType = pFldType;
- if( !pNewFldType )
- pNewFldType = pDoc->GetSysFldType( nFldWhich );
+ SwFieldType* pNewFldType = m_pFldType.get();
+ if ( !pNewFldType )
+ {
+ pNewFldType = pDoc->GetSysFldType( m_nFldWhich );
+ }
else
- // den Type am Dokuement anmelden
- pNewFldType = pDoc->InsertFldType( *pFldType );
+ {
+ // register type with the document
+ pNewFldType = pDoc->InsertFldType( *m_pFldType );
+ }
- pFld->GetFld()->ChgTyp( pNewFldType ); // Fieldtype umsetzen
+ m_pFld->GetFld()->ChgTyp( pNewFldType ); // change field type
- SwTxtNode * pTxtNd = pDoc->GetNodes()[ nNode ]->GetTxtNode();
- ASSERT( pTxtNd, "Undo-TxtAttr: kein TextNode" );
+ SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode();
+ ASSERT( pTxtNd, "SwHistorySetTxtFld: no TextNode" );
- if( pTxtNd )
- pTxtNd->InsertItem( *pFld, nPos, nPos, nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ if ( pTxtNd )
+ {
+ pTxtNd->InsertItem( *m_pFld, m_nPos, m_nPos,
+ nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ }
}
-SwSetRefMarkHint::SwSetRefMarkHint( SwTxtRefMark* pTxtHt, ULONG nNodePos )
- : SwHstryHint( HSTRY_SETREFMARKHNT )
+SwHistorySetRefMark::SwHistorySetRefMark( SwTxtRefMark* pTxtHt, ULONG nNodePos )
+ : SwHistoryHint( HSTRY_SETREFMARKHNT )
+ , m_RefName( pTxtHt->GetRefMark().GetRefName() )
+ , m_nNodeIndex( nNodePos )
+ , m_nStart( *pTxtHt->GetStart() )
+ , m_nEnd( *pTxtHt->GetAnyEnd() )
{
- aRefName = pTxtHt->GetRefMark().GetRefName();
- nNode = nNodePos;
- nStart = *pTxtHt->GetStart();
- nEnd = *pTxtHt->GetAnyEnd();
}
-void SwSetRefMarkHint::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistorySetRefMark::SetInDoc( SwDoc* pDoc, bool )
{
- SwTxtNode * pTxtNd = pDoc->GetNodes()[ nNode ]->GetTxtNode();
- ASSERT( pTxtNd, "Undo-TxtAttr: kein TextNode" );
- if( !pTxtNd )
+ SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode();
+ ASSERT( pTxtNd, "SwHistorySetRefMark: no TextNode" );
+ if ( !pTxtNd )
return;
- SwFmtRefMark aRefMark( aRefName );
+ SwFmtRefMark aRefMark( m_RefName );
- // existiert hier schon eine Referenz-Markierung ohne Ende, so
- // darf es nicht eingefuegt werden !!
- if( nStart != nEnd || !pTxtNd->GetTxtAttr( nStart, RES_TXTATR_REFMARK ) )
- pTxtNd->InsertItem( aRefMark, nStart, nEnd, nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ // if a reference mark without an end already exists here: must not insert!
+ if ( m_nStart != m_nEnd ||
+ !pTxtNd->GetTxtAttr( m_nStart, RES_TXTATR_REFMARK ) )
+ {
+ pTxtNd->InsertItem( aRefMark, m_nStart, m_nEnd,
+ nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ }
}
-SwSetTOXMarkHint::SwSetTOXMarkHint( SwTxtTOXMark* pTxtHt, ULONG nNodePos )
- : SwHstryHint( HSTRY_SETTOXMARKHNT ), aTOXMark( pTxtHt->GetTOXMark() )
+SwHistorySetTOXMark::SwHistorySetTOXMark( SwTxtTOXMark* pTxtHt, ULONG nNodePos )
+ : SwHistoryHint( HSTRY_SETTOXMARKHNT )
+ , m_TOXMark( pTxtHt->GetTOXMark() )
+ , m_TOXName( m_TOXMark.GetTOXType()->GetTypeName() )
+ , m_eTOXTypes( m_TOXMark.GetTOXType()->GetType() )
+ , m_nNodeIndex( nNodePos )
+ , m_nStart( *pTxtHt->GetStart() )
+ , m_nEnd( *pTxtHt->GetAnyEnd() )
{
- aTOXName = aTOXMark.GetTOXType()->GetTypeName();
- eTOXTypes = aTOXMark.GetTOXType()->GetType();
- ((SwModify*)aTOXMark.GetRegisteredIn())->Remove( &aTOXMark );
-
- nNode = nNodePos;
- nStart = *pTxtHt->GetStart();
- nEnd = *pTxtHt->GetAnyEnd();
+ const_cast<SwModify*>(m_TOXMark.GetRegisteredIn())->Remove( &m_TOXMark );
}
-void SwSetTOXMarkHint::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistorySetTOXMark::SetInDoc( SwDoc* pDoc, bool )
{
- SwTxtNode * pTxtNd = pDoc->GetNodes()[ nNode ]->GetTxtNode();
- ASSERT( pTxtNd, "Undo-TxtAttr: kein TextNode" );
- if( !pTxtNd )
+ SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode();
+ ASSERT( pTxtNd, "SwHistorySetTOXMark: no TextNode" );
+ if ( !pTxtNd )
return;
- // suche den entsprechenden Verzeichnistyp
- USHORT nCnt = pDoc->GetTOXTypeCount( eTOXTypes );
- const SwTOXType* pToxType = 0;
- for( USHORT n = 0; n < nCnt; ++n )
+ // search for respective TOX type
+ USHORT nCnt = pDoc->GetTOXTypeCount( m_eTOXTypes );
+ SwTOXType* pToxType = 0;
+ for ( USHORT n = 0; n < nCnt; ++n )
{
- pToxType = pDoc->GetTOXType( eTOXTypes, n );
- if( pToxType->GetTypeName() == aTOXName )
+ pToxType = const_cast<SwTOXType*>(pDoc->GetTOXType( m_eTOXTypes, n ));
+ if ( pToxType->GetTypeName() == m_TOXName )
break;
pToxType = 0;
}
- if( !pToxType ) // Verzeichnistyp nicht gefunden, neu anlegen
- pToxType = pDoc->InsertTOXType( SwTOXType( eTOXTypes, aTOXName ));
+ if ( !pToxType ) // TOX type not found, create new
+ {
+ pToxType = const_cast<SwTOXType*>(
+ pDoc->InsertTOXType( SwTOXType( m_eTOXTypes, m_TOXName )));
+ }
- SwTOXMark aNew( aTOXMark );
- ((SwTOXType*)pToxType)->Add( &aNew );
+ SwTOXMark aNew( m_TOXMark );
+ pToxType->Add( &aNew );
- pTxtNd->InsertItem( aNew, nStart, nEnd, nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ pTxtNd->InsertItem( aNew, m_nStart, m_nEnd,
+ nsSetAttrMode::SETATTR_NOTXTATRCHR );
}
-int SwSetTOXMarkHint::IsEqual( const SwTOXMark& rCmp ) const
+int SwHistorySetTOXMark::IsEqual( const SwTOXMark& rCmp ) const
{
- return aTOXName == rCmp.GetTOXType()->GetTypeName() &&
- eTOXTypes == rCmp.GetTOXType()->GetType() &&
- aTOXMark.GetAlternativeText() == rCmp.GetAlternativeText() &&
- ( TOX_INDEX == eTOXTypes
- ? ( aTOXMark.GetPrimaryKey() == rCmp.GetPrimaryKey() &&
- aTOXMark.GetSecondaryKey() == rCmp.GetSecondaryKey() )
- : aTOXMark.GetLevel() == rCmp.GetLevel()
+ return m_TOXName == rCmp.GetTOXType()->GetTypeName() &&
+ m_eTOXTypes == rCmp.GetTOXType()->GetType() &&
+ m_TOXMark.GetAlternativeText() == rCmp.GetAlternativeText() &&
+ ( (TOX_INDEX == m_eTOXTypes)
+ ? ( m_TOXMark.GetPrimaryKey() == rCmp.GetPrimaryKey() &&
+ m_TOXMark.GetSecondaryKey() == rCmp.GetSecondaryKey() )
+ : m_TOXMark.GetLevel() == rCmp.GetLevel()
);
}
-SwResetTxtHint::SwResetTxtHint( USHORT nWhich, xub_StrLen nAttrStt,
- xub_StrLen nAttrEnd, ULONG nNodePos )
- : SwHstryHint( HSTRY_RESETTXTHNT ),
- nNode( nNodePos ), nStart( nAttrStt ), nEnd( nAttrEnd ), nAttr( nWhich )
+SwHistoryResetTxt::SwHistoryResetTxt( USHORT nWhich,
+ xub_StrLen nAttrStart, xub_StrLen nAttrEnd, ULONG nNodePos )
+ : SwHistoryHint( HSTRY_RESETTXTHNT )
+ , m_nNodeIndex( nNodePos ), m_nStart( nAttrStart ), m_nEnd( nAttrEnd )
+ , m_nAttr( nWhich )
{
}
-void SwResetTxtHint::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistoryResetTxt::SetInDoc( SwDoc* pDoc, bool )
{
- SwTxtNode * pTxtNd = pDoc->GetNodes()[ nNode ]->GetTxtNode();
- ASSERT( pTxtNd, "Undo-TxtAttr: kein TextNode" );
- if( pTxtNd )
- pTxtNd->Delete( nAttr, nStart, nEnd );
+ SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode();
+ ASSERT( pTxtNd, "SwHistoryResetTxt: no TextNode" );
+ if ( pTxtNd )
+ {
+ pTxtNd->Delete( m_nAttr, m_nStart, m_nEnd );
+ }
}
-SwSetFtnHint::SwSetFtnHint( SwTxtFtn* pTxtFtn, ULONG nNodePos )
- : SwHstryHint( HSTRY_SETFTNHNT ),
- nNode( nNodePos ), nStart( *pTxtFtn->GetStart() )
+SwHistorySetFootnote::SwHistorySetFootnote( SwTxtFtn* pTxtFtn, ULONG nNodePos )
+ : SwHistoryHint( HSTRY_SETFTNHNT )
+ , m_pUndo( new SwUndoSaveSection )
+ , m_FootnoteNumber( pTxtFtn->GetFtn().GetNumStr() )
+ , m_nNodeIndex( nNodePos )
+ , m_nStart( *pTxtFtn->GetStart() )
+ , m_bEndNote( pTxtFtn->GetFtn().IsEndNote() )
{
- ASSERT( pTxtFtn->GetStartNode(), "Footnote ohne Section" );
-
- aFtnStr = pTxtFtn->GetFtn().GetNumStr();
- bEndNote = pTxtFtn->GetFtn().IsEndNote();
+ ASSERT( pTxtFtn->GetStartNode(),
+ "SwHistorySetFootnote: Footnote without Section" );
// merke die alte NodePos, denn wer weiss was alles in der SaveSection
// gespeichert (geloescht) wird
- SwDoc* pDoc = (SwDoc*)pTxtFtn->GetTxtNode().GetDoc();
- SwNode* pSaveNd = pDoc->GetNodes()[ nNode ];
+ SwDoc* pDoc = const_cast<SwDoc*>(pTxtFtn->GetTxtNode().GetDoc());
+ SwNode* pSaveNd = pDoc->GetNodes()[ m_nNodeIndex ];
//Pointer auf StartNode der FtnSection merken und erstmal den Pointer im
//Attribut zuruecksetzen -> Damit werden automatisch die Frms vernichtet.
SwNodeIndex aSttIdx( *pTxtFtn->GetStartNode() );
pTxtFtn->SetStartNode( 0, FALSE );
- pUndo = new SwUndoSaveSection;
- pUndo->SaveSection( pDoc, aSttIdx );
- nNode = pSaveNd->GetIndex();
+ m_pUndo->SaveSection( pDoc, aSttIdx );
+ m_nNodeIndex = pSaveNd->GetIndex();
}
-SwSetFtnHint::SwSetFtnHint( const SwTxtFtn &rTxtFtn ) :
- SwHstryHint( HSTRY_SETFTNHNT ),
- pUndo( 0 ),
- nNode( _SwTxtFtn_GetIndex( (&rTxtFtn) ) ),
- nStart( *rTxtFtn.GetStart() )
+SwHistorySetFootnote::SwHistorySetFootnote( const SwTxtFtn &rTxtFtn )
+ : SwHistoryHint( HSTRY_SETFTNHNT )
+ , m_pUndo( 0 )
+ , m_FootnoteNumber( rTxtFtn.GetFtn().GetNumStr() )
+ , m_nNodeIndex( _SwTxtFtn_GetIndex( (&rTxtFtn) ) )
+ , m_nStart( *rTxtFtn.GetStart() )
+ , m_bEndNote( rTxtFtn.GetFtn().IsEndNote() )
{
- ASSERT( rTxtFtn.GetStartNode(), "Footnote ohne Section" );
-
- aFtnStr = rTxtFtn.GetFtn().GetNumStr();
- bEndNote = rTxtFtn.GetFtn().IsEndNote();
+ ASSERT( rTxtFtn.GetStartNode(),
+ "SwHistorySetFootnote: Footnote without Section" );
}
-String SwSetFtnHint::GetDescription() const
+String SwHistorySetFootnote::GetDescription() const
{
return SW_RES(STR_FOOTNOTE);
}
-SwSetFtnHint::~SwSetFtnHint()
+SwHistorySetFootnote::~SwHistorySetFootnote()
{
- delete pUndo;
}
-void SwSetFtnHint::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistorySetFootnote::SetInDoc( SwDoc* pDoc, bool )
{
- SwTxtNode * pTxtNd = pDoc->GetNodes()[ nNode ]->GetTxtNode();
- ASSERT( pTxtNd, "Undo-TxtAttr: kein TextNode" );
- if( !pTxtNd )
+ SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode();
+ ASSERT( pTxtNd, "SwHistorySetFootnote: no TextNode" );
+ if ( !pTxtNd )
return;
- if ( pUndo )
+ if ( m_pUndo.get() )
{
- // setze die Fussnote im TextNode
- SwFmtFtn aTemp( bEndNote );
- SwFmtFtn& rNew = (SwFmtFtn&)pDoc->GetAttrPool().Put(aTemp);
- if( aFtnStr.Len() )
- rNew.SetNumStr( aFtnStr );
- SwTxtFtn* pTxtFtn = new SwTxtFtn( rNew, nStart );
-
- // erzeuge schon die Section der Fussnote
+ // set the footnote in the TextNode
+ SwFmtFtn aTemp( m_bEndNote );
+ SwFmtFtn& rNew = const_cast<SwFmtFtn&>(
+ static_cast<const SwFmtFtn&>(pDoc->GetAttrPool().Put(aTemp)) );
+ if ( m_FootnoteNumber.Len() )
+ {
+ rNew.SetNumStr( m_FootnoteNumber );
+ }
+ SwTxtFtn* pTxtFtn = new SwTxtFtn( rNew, m_nStart );
+
+ // create the section of the Footnote
SwNodeIndex aIdx( *pTxtNd );
- pUndo->RestoreSection( pDoc, &aIdx, SwFootnoteStartNode );
+ m_pUndo->RestoreSection( pDoc, &aIdx, SwFootnoteStartNode );
pTxtFtn->SetStartNode( &aIdx );
- if( pUndo->GetHistory() )
- // erst jetzt die Frames anlegen lassen
- pUndo->GetHistory()->Rollback( pDoc );
+ if ( m_pUndo->GetHistory() )
+ {
+ // create frames only now
+ m_pUndo->GetHistory()->Rollback( pDoc );
+ }
pTxtNd->Insert( pTxtFtn );
}
else
{
- SwTxtFtn *pFtn = (SwTxtFtn*)pTxtNd->GetTxtAttr( nStart );
- SwFmtFtn &rFtn = (SwFmtFtn&)pFtn->GetFtn();
- rFtn.SetNumStr( aFtnStr );
- if( rFtn.IsEndNote() != bEndNote )
+ SwTxtFtn *pFtn = const_cast<SwTxtFtn*>(
+ static_cast<const SwTxtFtn*>(pTxtNd->GetTxtAttr( m_nStart )));
+ SwFmtFtn &rFtn = const_cast<SwFmtFtn&>(pFtn->GetFtn());
+ rFtn.SetNumStr( m_FootnoteNumber );
+ if ( rFtn.IsEndNote() != m_bEndNote )
{
- rFtn.SetEndNote( bEndNote );
+ rFtn.SetEndNote( m_bEndNote );
pFtn->CheckCondColl();
}
}
}
-SwChgFmtColl::SwChgFmtColl( const SwFmtColl* pFmtColl, ULONG nNd,
+SwHistoryChangeFmtColl::SwHistoryChangeFmtColl( SwFmtColl* pFmtColl, ULONG nNd,
BYTE nNodeWhich )
- : SwHstryHint( HSTRY_CHGFMTCOLL ),
- pColl( pFmtColl ),
- nNode( nNd ),
- nNdWhich( nNodeWhich )
+ : SwHistoryHint( HSTRY_CHGFMTCOLL )
+ , m_pColl( pFmtColl )
+ , m_nNodeIndex( nNd )
+ , m_nNodeType( nNodeWhich )
{
}
-void SwChgFmtColl::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistoryChangeFmtColl::SetInDoc( SwDoc* pDoc, bool )
{
- SwCntntNode * pCntntNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
- ASSERT( pCntntNd, "Undo-ChgFmt: kein ContentNode" );
+ SwCntntNode * pCntntNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetCntntNode();
+ ASSERT( pCntntNd, "SwHistoryChangeFmtColl: no ContentNode" );
- // prufe vor dem setzen des Formates, ob dieses ueberhaupt noch im
- // Dokument vorhanden ist. Wurde es schon geloescht, gibt es kein Undo !!
- if( pCntntNd && nNdWhich == pCntntNd->GetNodeType() )
+ // before setting the format, check if it is still available in the
+ // document. if it has been deleted, there is no undo!
+ if ( pCntntNd && m_nNodeType == pCntntNd->GetNodeType() )
{
- if( ND_TEXTNODE == nNdWhich )
+ if ( ND_TEXTNODE == m_nNodeType )
{
- if( USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos( (SwTxtFmtColl*)pColl ))
+ if ( USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos(
+ static_cast<SwTxtFmtColl * const>(m_pColl) ))
{
- pCntntNd->ChgFmtColl( (SwFmtColl*)pColl );
+ pCntntNd->ChgFmtColl( m_pColl );
}
}
- else if( USHRT_MAX != pDoc->GetGrfFmtColls()->GetPos( (SwGrfFmtColl*)pColl ))
- pCntntNd->ChgFmtColl( (SwFmtColl*)pColl );
+ else if ( USHRT_MAX != pDoc->GetGrfFmtColls()->GetPos(
+ static_cast<SwGrfFmtColl * const>(m_pColl) ))
+ {
+ pCntntNd->ChgFmtColl( m_pColl );
+ }
}
}
-SwHstryTxtFlyCnt::SwHstryTxtFlyCnt( SwTxtFlyCnt* pTxtFly )
- : SwHstryHint( HSTRY_FLYCNT )
+SwHistoryTxtFlyCnt::SwHistoryTxtFlyCnt( SwFrmFmt* const pFlyFmt )
+ : SwHistoryHint( HSTRY_FLYCNT )
+ , m_pUndo( new SwUndoDelLayFmt( pFlyFmt ) )
{
- ASSERT( pTxtFly->GetFlyCnt().GetFrmFmt(), "FlyCntnt ohne Format" );
- pUndo = new SwUndoDelLayFmt( pTxtFly->GetFlyCnt().GetFrmFmt() );
- pUndo->ChgShowSel( FALSE );
+ ASSERT( pFlyFmt, "SwHistoryTxtFlyCnt: no Format" );
+ m_pUndo->ChgShowSel( FALSE );
}
-SwHstryTxtFlyCnt::SwHstryTxtFlyCnt( SwFlyFrmFmt* pFlyFmt )
- : SwHstryHint( HSTRY_FLYCNT )
+SwHistoryTxtFlyCnt::~SwHistoryTxtFlyCnt()
{
- ASSERT( pFlyFmt, "kein Format" );
- pUndo = new SwUndoDelLayFmt( pFlyFmt );
- pUndo->ChgShowSel( FALSE );
}
-SwHstryTxtFlyCnt::~SwHstryTxtFlyCnt()
-{
- delete pUndo;
-}
-
-
-void SwHstryTxtFlyCnt::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistoryTxtFlyCnt::SetInDoc( SwDoc* pDoc, bool )
{
SwPaM aPam( pDoc->GetNodes().GetEndOfPostIts() );
SwUndoIter aUndoIter( &aPam );
- pUndo->Undo( aUndoIter );
+ m_pUndo->Undo( aUndoIter );
}
-SwHstryBookmark::SwHstryBookmark(
+SwHistoryBookmark::SwHistoryBookmark(
const ::sw::mark::IMark& rBkmk,
bool bSavePos,
bool bSaveOtherPos)
- : SwHstryHint(HSTRY_BOOKMARK)
+ : SwHistoryHint(HSTRY_BOOKMARK)
, m_aName(rBkmk.GetName())
, m_aShortName()
, m_aKeycode()
@@ -581,7 +619,7 @@ SwHstryBookmark::SwHstryBookmark(
}
-void SwHstryBookmark::SetInDoc(SwDoc* pDoc, BOOL)
+void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool )
{
bool bDoesUndo = pDoc->DoesUndo();
pDoc->DoUndo(false);
@@ -595,7 +633,7 @@ void SwHstryBookmark::SetInDoc(SwDoc* pDoc, BOOL)
{
SwCntntNode* const pCntntNd = rNds[m_nNode]->GetCntntNode();
OSL_ENSURE(pCntntNd,
- "<SwHstryBookmark::SetInDoc(..)>"
+ "<SwHistoryBookmark::SetInDoc(..)>"
" - wrong node for a mark");
// #111660# don't crash when nNode1 doesn't point to content node.
@@ -612,7 +650,7 @@ void SwHstryBookmark::SetInDoc(SwDoc* pDoc, BOOL)
{
SwCntntNode* const pCntntNd = rNds[m_nOtherNode]->GetCntntNode();
OSL_ENSURE(pCntntNd,
- "<SwHstryBookmark::SetInDoc(..)>"
+ "<SwHistoryBookmark::SetInDoc(..)>"
" - wrong node for a mark");
if(pPam.get() != NULL && pCntntNd)
@@ -627,7 +665,7 @@ void SwHstryBookmark::SetInDoc(SwDoc* pDoc, BOOL)
if(!pMark)
pMark = pMarkAccess->findMark(m_aName)->get();
OSL_ENSURE(pMark->IsExpanded(),
- "<SwHstryBookmark::SetInDoc(..)>"
+ "<SwHistoryBookmark::SetInDoc(..)>"
" - missing pos on old mark");
pPam->SetMark();
*pPam->GetMark() = pMark->GetOtherMarkPos();
@@ -649,14 +687,14 @@ void SwHstryBookmark::SetInDoc(SwDoc* pDoc, BOOL)
}
-BOOL SwHstryBookmark::IsEqualBookmark(const ::sw::mark::IMark& rBkmk)
+bool SwHistoryBookmark::IsEqualBookmark(const ::sw::mark::IMark& rBkmk)
{
return m_nNode == rBkmk.GetMarkPos().nNode.GetIndex()
&& m_nCntnt == rBkmk.GetMarkPos().nContent.GetIndex()
&& m_aName == rBkmk.GetName();
}
-const ::rtl::OUString& SwHstryBookmark::GetName() const
+const ::rtl::OUString& SwHistoryBookmark::GetName() const
{
return m_aName;
}
@@ -664,65 +702,70 @@ const ::rtl::OUString& SwHstryBookmark::GetName() const
/*************************************************************************/
-SwHstrySetAttrSet::SwHstrySetAttrSet( const SfxItemSet& rSet, ULONG nNodePos,
- const SvUShortsSort& rSetArr )
- : SwHstryHint( HSTRY_SETATTRSET ),
- aOldSet( rSet ),
- aResetArr( 0, 4 ),
- nNode( nNodePos ),
- // --> OD 2007-07-09 #i77372#
- //mnNumLvl( MAXLEVEL),//NO_NUMBERING ),
- mnNumLvl( MAXLEVEL), //#outline level,zhaojianwei
- mbIsRestart( false ),
- mnRestartVal( USHRT_MAX ),
- mbIsCounted( false )
- // <--
-{
- SfxItemIter aIter( aOldSet ), aOrigIter( rSet );
+SwHistorySetAttrSet::SwHistorySetAttrSet( const SfxItemSet& rSet,
+ ULONG nNodePos, const SvUShortsSort& rSetArr )
+ : SwHistoryHint( HSTRY_SETATTRSET )
+ , m_OldSet( rSet )
+ , m_ResetArray( 0, 4 )
+ , m_nNodeIndex( nNodePos )
+{
+ SfxItemIter aIter( m_OldSet ), aOrigIter( rSet );
const SfxPoolItem* pItem = aIter.FirstItem(),
* pOrigItem = aOrigIter.FirstItem();
do {
if( !rSetArr.Seek_Entry( pOrigItem->Which() ))
{
- aResetArr.Insert( pOrigItem->Which(), aResetArr.Count() );
- aOldSet.ClearItem( pOrigItem->Which() );
+ m_ResetArray.Insert( pOrigItem->Which(), m_ResetArray.Count() );
+ m_OldSet.ClearItem( pOrigItem->Which() );
}
else
{
- switch( pItem->Which() )
+ switch ( pItem->Which() )
{
- case RES_PAGEDESC:
- ((SwFmtPageDesc*)pItem)->ChgDefinedIn( 0 );
- break;
+ case RES_PAGEDESC:
+ static_cast<SwFmtPageDesc*>(
+ const_cast<SfxPoolItem*>(pItem))->ChgDefinedIn( 0 );
+ break;
- case RES_PARATR_DROP:
- ((SwFmtDrop*)pItem)->ChgDefinedIn( 0 );
- break;
+ case RES_PARATR_DROP:
+ static_cast<SwFmtDrop*>(
+ const_cast<SfxPoolItem*>(pItem))->ChgDefinedIn( 0 );
+ break;
- case RES_BOXATR_FORMULA:
- {
+ case RES_BOXATR_FORMULA:
+ {
//JP 20.04.98: Bug 49502 - wenn eine Formel gesetzt ist, nie den
// Value mit sichern. Der muss gegebenfalls neu
// errechnet werden!
//JP 30.07.98: Bug 54295 - Formeln immer im Klartext speichern
- aOldSet.ClearItem( RES_BOXATR_VALUE );
+ m_OldSet.ClearItem( RES_BOXATR_VALUE );
- SwTblBoxFormula& rNew = *(SwTblBoxFormula*)pItem;
- if( rNew.IsIntrnlName() )
- {
- const SwTblBoxFormula& rOld = (SwTblBoxFormula&)rSet.Get( RES_BOXATR_FORMULA );
- const SwNode* pNd = rOld.GetNodeOfFormula();
- if( pNd && 0 != (pNd = pNd->FindTableNode() ))
+ SwTblBoxFormula& rNew =
+ *static_cast<SwTblBoxFormula*>(
+ const_cast<SfxPoolItem*>(pItem));
+ if ( rNew.IsIntrnlName() )
{
- SwTableFmlUpdate aMsgHnt( &((SwTableNode*)pNd)->GetTable() );
- aMsgHnt.eFlags = TBL_BOXNAME;
- rNew.ChgDefinedIn( rOld.GetDefinedIn() );
- rNew.ChangeState( &aMsgHnt );
+ const SwTblBoxFormula& rOld =
+ static_cast<const SwTblBoxFormula&>(
+ rSet.Get( RES_BOXATR_FORMULA ));
+ const SwNode* pNd = rOld.GetNodeOfFormula();
+ if ( pNd )
+ {
+ const SwTableNode* pTableNode
+ = pNd->FindTableNode();
+ if (pTableNode)
+ {
+ SwTableFmlUpdate aMsgHnt(
+ &pTableNode->GetTable() );
+ aMsgHnt.eFlags = TBL_BOXNAME;
+ rNew.ChgDefinedIn( rOld.GetDefinedIn() );
+ rNew.ChangeState( &aMsgHnt );
+ }
+ }
}
+ rNew.ChgDefinedIn( 0 );
}
- rNew.ChgDefinedIn( 0 );
- }
- break;
+ break;
}
}
@@ -733,24 +776,29 @@ SwHstrySetAttrSet::SwHstrySetAttrSet( const SfxItemSet& rSet, ULONG nNodePos,
} while( TRUE );
}
-void SwHstrySetAttrSet::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistorySetAttrSet::SetInDoc( SwDoc* pDoc, bool )
{
BOOL bDoesUndo = pDoc->DoesUndo();
pDoc->DoUndo( FALSE );
- SwNode * pNode = pDoc->GetNodes()[ nNode ];
- if( pNode->IsCntntNode() )
+ SwNode * pNode = pDoc->GetNodes()[ m_nNodeIndex ];
+ if ( pNode->IsCntntNode() )
{
- ((SwCntntNode*)pNode)->SetAttr( aOldSet );
- if( aResetArr.Count() )
- ((SwCntntNode*)pNode)->ResetAttr( aResetArr );
+ static_cast<SwCntntNode*>(pNode)->SetAttr( m_OldSet );
+ if ( m_ResetArray.Count() )
+ {
+ static_cast<SwCntntNode*>(pNode)->ResetAttr( m_ResetArray );
+ }
}
- else if( pNode->IsTableNode() )
+ else if ( pNode->IsTableNode() )
{
- SwFmt& rFmt = *((SwTableNode*)pNode)->GetTable().GetFrmFmt();
- rFmt.SetFmtAttr( aOldSet );
- if( aResetArr.Count() )
- rFmt.ResetFmtAttr( *aResetArr.GetData() );
+ SwFmt& rFmt =
+ *static_cast<SwTableNode*>(pNode)->GetTable().GetFrmFmt();
+ rFmt.SetFmtAttr( m_OldSet );
+ if ( m_ResetArray.Count() )
+ {
+ rFmt.ResetFmtAttr( *m_ResetArray.GetData() );
+ }
}
pDoc->DoUndo( bDoesUndo );
@@ -759,11 +807,11 @@ void SwHstrySetAttrSet::SetInDoc( SwDoc* pDoc, BOOL )
/*************************************************************************/
-SwHstryResetAttrSet::SwHstryResetAttrSet( const SfxItemSet& rSet,
+SwHistoryResetAttrSet::SwHistoryResetAttrSet( const SfxItemSet& rSet,
ULONG nNodePos, xub_StrLen nAttrStt, xub_StrLen nAttrEnd )
- : SwHstryHint( HSTRY_RESETATTRSET ),
- nNode( nNodePos ), nStart( nAttrStt ), nEnd( nAttrEnd ),
- aArr( (BYTE)rSet.Count() )
+ : SwHistoryHint( HSTRY_RESETATTRSET )
+ , m_nNodeIndex( nNodePos ), m_nStart( nAttrStt ), m_nEnd( nAttrEnd )
+ , m_Array( (BYTE)rSet.Count() )
{
SfxItemIter aIter( rSet );
bool bAutoStyle = true;
@@ -773,10 +821,14 @@ SwHstryResetAttrSet::SwHstryResetAttrSet( const SfxItemSet& rSet,
const USHORT nWhich = aIter.GetCurItem()->Which();
// Character attribute cannot be inserted into the hints array
// anymore. Therefore we have to treat them as one RES_TXTATR_AUTOFMT:
- if ( RES_CHRATR_BEGIN <= nWhich && RES_CHRATR_END > nWhich )
+ if (isCHRATR(nWhich))
+ {
bAutoStyle = true;
+ }
else
- aArr.Insert( aIter.GetCurItem()->Which() ,aArr.Count() );
+ {
+ m_Array.Insert( aIter.GetCurItem()->Which(), m_Array.Count() );
+ }
if( aIter.IsAtEnd() )
break;
@@ -785,32 +837,39 @@ SwHstryResetAttrSet::SwHstryResetAttrSet( const SfxItemSet& rSet,
}
if ( bAutoStyle )
- aArr.Insert( RES_TXTATR_AUTOFMT, aArr.Count() );
+ {
+ m_Array.Insert( RES_TXTATR_AUTOFMT, m_Array.Count() );
+ }
}
-void SwHstryResetAttrSet::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistoryResetAttrSet::SetInDoc( SwDoc* pDoc, bool )
{
BOOL bDoesUndo = pDoc->DoesUndo();
pDoc->DoUndo( FALSE );
- SwCntntNode * pCntntNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
- ASSERT( pCntntNd, "wo ist mein CntntNode" );
+ SwCntntNode * pCntntNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetCntntNode();
+ ASSERT( pCntntNd, "SwHistoryResetAttrSet: no CntntNode" );
if (pCntntNd)
{
- const USHORT* pArr = aArr.GetData();
- if( USHRT_MAX == nEnd && USHRT_MAX == nStart )
+ const USHORT* pArr = m_Array.GetData();
+ if ( USHRT_MAX == m_nEnd && USHRT_MAX == m_nStart )
{
- // kein Bereich also Schnittstelle zum Content-Node
- for( USHORT n = aArr.Count(); n; --n, ++pArr )
+ // no area: use ContentNode
+ for ( USHORT n = m_Array.Count(); n; --n, ++pArr )
+ {
pCntntNd->ResetAttr( *pArr );
+ }
}
else
{
- // Bereich: also Schnittstelle zum Text-Node
- for( USHORT n = aArr.Count(); n; --n, ++pArr )
- ((SwTxtNode*)pCntntNd)->Delete( *pArr, nStart, nEnd );
+ // area: use TextNode
+ for ( USHORT n = m_Array.Count(); n; --n, ++pArr )
+ {
+ static_cast<SwTxtNode*>(pCntntNd)->
+ Delete( *pArr, m_nStart, m_nEnd );
+ }
}
}
@@ -821,41 +880,47 @@ void SwHstryResetAttrSet::SetInDoc( SwDoc* pDoc, BOOL )
/*************************************************************************/
-SwHstryChgFlyAnchor::SwHstryChgFlyAnchor( const SwFrmFmt& rFmt )
- : SwHstryHint( HSTRY_CHGFLYANCHOR ),
- pFmt( (SwFrmFmt*)&rFmt )
+SwHistoryChangeFlyAnchor::SwHistoryChangeFlyAnchor( SwFrmFmt& rFmt )
+ : SwHistoryHint( HSTRY_CHGFLYANCHOR )
+ , m_rFmt( rFmt )
+ , m_nOldNodeIndex( rFmt.GetAnchor().GetCntntAnchor()->nNode.GetIndex() )
+ , m_nOldContentIndex( ( FLY_AUTO_CNTNT == rFmt.GetAnchor().GetAnchorId() )
+ ? rFmt.GetAnchor().GetCntntAnchor()->nContent.GetIndex()
+ : STRING_MAXLEN )
{
- const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
- nOldPos = rAnchor.GetCntntAnchor()->nNode.GetIndex();
- if( FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
- nOldCnt = rAnchor.GetCntntAnchor()->nContent.GetIndex();
- else
- nOldCnt = STRING_MAXLEN;
}
-void SwHstryChgFlyAnchor::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool )
{
BOOL bDoesUndo = pDoc->DoesUndo();
pDoc->DoUndo( FALSE );
- USHORT nPos = pDoc->GetSpzFrmFmts()->GetPos( pFmt );
- if( USHRT_MAX != nPos ) // Format noch vorhanden
+ USHORT nPos = pDoc->GetSpzFrmFmts()->GetPos( &m_rFmt );
+ if ( USHRT_MAX != nPos ) // Format does still exist
{
- SwFmtAnchor aTmp( pFmt->GetAnchor() );
+ SwFmtAnchor aTmp( m_rFmt.GetAnchor() );
- SwNode* pNd = pDoc->GetNodes()[ nOldPos ];
+ SwNode* pNd = pDoc->GetNodes()[ m_nOldNodeIndex ];
+ SwCntntNode* pCNd = pNd->GetCntntNode();
SwPosition aPos( *pNd );
- if( STRING_MAXLEN != nOldCnt )
- aPos.nContent.Assign( (SwCntntNode*)pNd, nOldCnt );
+ if ( STRING_MAXLEN != m_nOldContentIndex )
+ {
+ ASSERT(pCNd, "SwHistoryChangeFlyAnchor: no ContentNode");
+ if (pCNd)
+ {
+ aPos.nContent.Assign( pCNd, m_nOldContentIndex );
+ }
+ }
aTmp.SetAnchor( &aPos );
- // damit das Layout nicht durcheinander kommt!
- SwCntntNode* pCNd = pNd->GetCntntNode();
- if( !pCNd || !pCNd->GetFrm( 0, 0, FALSE ) )
- pFmt->DelFrms();
+ // so the Layout does not get confused
+ if ( !pCNd || !pCNd->GetFrm( 0, 0, FALSE ) )
+ {
+ m_rFmt.DelFrms();
+ }
- pFmt->SetFmtAttr( aTmp );
+ m_rFmt.SetFmtAttr( aTmp );
}
pDoc->DoUndo( bDoesUndo );
}
@@ -863,55 +928,64 @@ void SwHstryChgFlyAnchor::SetInDoc( SwDoc* pDoc, BOOL )
/*************************************************************************/
-SwHstryChgFlyChain::SwHstryChgFlyChain( const SwFlyFrmFmt& rFmt,
+SwHistoryChangeFlyChain::SwHistoryChangeFlyChain( SwFlyFrmFmt& rFmt,
const SwFmtChain& rAttr )
- : SwHstryHint( HSTRY_CHGFLYCHAIN ),
- pPrevFmt( rAttr.GetPrev() ),
- pNextFmt( rAttr.GetNext() ),
- pFlyFmt( (SwFlyFrmFmt*)&rFmt )
+ : SwHistoryHint( HSTRY_CHGFLYCHAIN )
+ , m_pPrevFmt( rAttr.GetPrev() )
+ , m_pNextFmt( rAttr.GetNext() )
+ , m_pFlyFmt( &rFmt )
{
}
-void SwHstryChgFlyChain::SetInDoc( SwDoc* pDoc, BOOL )
+void SwHistoryChangeFlyChain::SetInDoc( SwDoc* pDoc, bool )
{
- if( USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( pFlyFmt ) )
+ if ( USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( m_pFlyFmt ) )
{
SwFmtChain aChain;
- if( pPrevFmt && USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( pPrevFmt ))
+
+ if ( m_pPrevFmt &&
+ USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( m_pPrevFmt ) )
{
- aChain.SetPrev( pPrevFmt );
- SwFmtChain aTmp( pPrevFmt->GetChain() );
- aTmp.SetNext( pFlyFmt );
- pPrevFmt->SetFmtAttr( aTmp );
+ aChain.SetPrev( m_pPrevFmt );
+ SwFmtChain aTmp( m_pPrevFmt->GetChain() );
+ aTmp.SetNext( m_pFlyFmt );
+ m_pPrevFmt->SetFmtAttr( aTmp );
}
- if( pNextFmt && USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( pNextFmt ))
+
+ if ( m_pNextFmt &&
+ USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( m_pNextFmt ) )
{
- aChain.SetNext( pNextFmt );
- SwFmtChain aTmp( pNextFmt->GetChain() );
- aTmp.SetPrev( pFlyFmt );
- pNextFmt->SetFmtAttr( aTmp );
+ aChain.SetNext( m_pNextFmt );
+ SwFmtChain aTmp( m_pNextFmt->GetChain() );
+ aTmp.SetPrev( m_pFlyFmt );
+ m_pNextFmt->SetFmtAttr( aTmp );
}
- if( aChain.GetNext() || aChain.GetPrev() )
- pFlyFmt->SetFmtAttr( aChain );
+ if ( aChain.GetNext() || aChain.GetPrev() )
+ {
+ m_pFlyFmt->SetFmtAttr( aChain );
+ }
}
}
// -> #i27615#
-SwHstryChgCharFmt::SwHstryChgCharFmt(const SfxItemSet & rSet,
- const String & _sFmt)
- : SwHstryHint(HSTRY_CHGCHARFMT), aOldSet(rSet), sFmt(_sFmt)
+SwHistoryChangeCharFmt::SwHistoryChangeCharFmt(const SfxItemSet & rSet,
+ const String & sFmt)
+ : SwHistoryHint(HSTRY_CHGCHARFMT)
+ , m_OldSet(rSet), m_Fmt(sFmt)
{
}
-void SwHstryChgCharFmt::SetInDoc(SwDoc * pDoc, BOOL )
+void SwHistoryChangeCharFmt::SetInDoc(SwDoc * pDoc, bool )
{
- SwCharFmt * pCharFmt = pDoc->FindCharFmtByName(sFmt);
+ SwCharFmt * pCharFmt = pDoc->FindCharFmtByName(m_Fmt);
if (pCharFmt)
- pCharFmt->SetFmtAttr(aOldSet);
+ {
+ pCharFmt->SetFmtAttr(m_OldSet);
+ }
}
// <- #i27615#
@@ -919,7 +993,8 @@ void SwHstryChgCharFmt::SetInDoc(SwDoc * pDoc, BOOL )
SwHistory::SwHistory( USHORT nInitSz, USHORT nGrowSz )
- : SwpHstry( (BYTE)nInitSz, (BYTE)nGrowSz ), nEndDiff( 0 )
+ : m_SwpHstry( (BYTE)nInitSz, (BYTE)nGrowSz )
+ , m_nEndDiff( 0 )
{}
@@ -944,98 +1019,106 @@ void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue,
ULONG nNodeIdx )
// <--
{
- ASSERT( !nEndDiff, "nach REDO wurde die History noch nicht geloescht" );
+ ASSERT( !m_nEndDiff, "History was not deleted after REDO" );
USHORT nWhich = pNewValue->Which();
if( (nWhich >= POOLATTR_END) || (nWhich == RES_TXTATR_FIELD) )
return;
- // kein default Attribut ??
- SwHstryHint * pHt;
-#ifdef JP_NEWCORE
- if( pOldValue && pOldValue->GetFmt() &&
- ( !pNewValue->GetFmt() || pOldValue->GetFmt()==pNewValue->GetFmt()) )
-#else
- if( pOldValue && pOldValue != GetDfltAttr( pOldValue->Which() ) )
-#endif
- pHt = new SwSetFmtHint( (SfxPoolItem*)pOldValue, nNodeIdx );
+ // no default Attribute?
+ SwHistoryHint * pHt;
+ if ( pOldValue && pOldValue != GetDfltAttr( pOldValue->Which() ) )
+ {
+ pHt = new SwHistorySetFmt( pOldValue, nNodeIdx );
+ }
else
- pHt = new SwResetFmtHint( (SfxPoolItem*)pNewValue, nNodeIdx );
- Insert( pHt, Count() );
+ {
+ pHt = new SwHistoryResetFmt( pNewValue, nNodeIdx );
+ }
+ m_SwpHstry.Insert( pHt, Count() );
}
-void SwHistory::Add( const SwTxtAttr* pHint, ULONG nNodeIdx, BOOL bNewAttr )
+void SwHistory::Add( SwTxtAttr* pHint, ULONG nNodeIdx, bool bNewAttr )
{
+ ASSERT( !m_nEndDiff, "History was not deleted after REDO" );
- ASSERT( !nEndDiff, "nach REDO wurde die History noch nicht geloescht" );
-
- SwHstryHint * pHt;
+ SwHistoryHint * pHt;
USHORT nAttrWhich = pHint->Which();
if( !bNewAttr )
{
switch ( nAttrWhich )
{
- case RES_TXTATR_FTN:
- pHt = new SwSetFtnHint( (SwTxtFtn*)pHint, nNodeIdx );
- break;
- case RES_TXTATR_FLYCNT:
- pHt = new SwHstryTxtFlyCnt( (SwTxtFlyCnt*)pHint );
- break;
- case RES_TXTATR_FIELD:
- pHt = new SwSetTxtFldHint( (SwTxtFld*)pHint, nNodeIdx );
- break;
- case RES_TXTATR_TOXMARK:
- pHt = new SwSetTOXMarkHint( (SwTxtTOXMark*)pHint, nNodeIdx );
- break;
- case RES_TXTATR_REFMARK:
- pHt = new SwSetRefMarkHint( (SwTxtRefMark*)pHint, nNodeIdx );
- break;
- default:
- pHt = new SwSetTxtHint((SwTxtAttr*)pHint, nNodeIdx );
+ case RES_TXTATR_FTN:
+ pHt = new SwHistorySetFootnote(
+ static_cast<SwTxtFtn*>(pHint), nNodeIdx );
+ break;
+ case RES_TXTATR_FLYCNT:
+ pHt = new SwHistoryTxtFlyCnt( static_cast<SwTxtFlyCnt*>(pHint)
+ ->GetFlyCnt().GetFrmFmt() );
+ break;
+ case RES_TXTATR_FIELD:
+ pHt = new SwHistorySetTxtFld(
+ static_cast<SwTxtFld*>(pHint), nNodeIdx );
+ break;
+ case RES_TXTATR_TOXMARK:
+ pHt = new SwHistorySetTOXMark(
+ static_cast<SwTxtTOXMark*>(pHint), nNodeIdx );
+ break;
+ case RES_TXTATR_REFMARK:
+ pHt = new SwHistorySetRefMark(
+ static_cast<SwTxtRefMark*>(pHint), nNodeIdx );
+ break;
+ default:
+ pHt = new SwHistorySetTxt(
+ static_cast<SwTxtAttr*>(pHint), nNodeIdx );
}
}
else
{
- pHt = new SwResetTxtHint( pHint->Which(), *pHint->GetStart(),
+ pHt = new SwHistoryResetTxt( pHint->Which(), *pHint->GetStart(),
*pHint->GetAnyEnd(), nNodeIdx );
}
- Insert( pHt, Count() );
+ m_SwpHstry.Insert( pHt, Count() );
}
-void SwHistory::Add( const SwFmtColl* pColl, ULONG nNodeIdx, BYTE nWhichNd )
+void SwHistory::Add( SwFmtColl* pColl, ULONG nNodeIdx, BYTE nWhichNd )
{
- ASSERT( !nEndDiff, "nach REDO wurde die History noch nicht geloescht" );
- SwHstryHint * pHt = new SwChgFmtColl( pColl, nNodeIdx, nWhichNd );
- Insert( pHt, Count() );
+ ASSERT( !m_nEndDiff, "History was not deleted after REDO" );
+
+ SwHistoryHint * pHt =
+ new SwHistoryChangeFmtColl( pColl, nNodeIdx, nWhichNd );
+ m_SwpHstry.Insert( pHt, Count() );
}
void SwHistory::Add(const ::sw::mark::IMark& rBkmk, bool bSavePos, bool bSaveOtherPos)
{
- ASSERT(!nEndDiff, "nach REDO wurde die History noch nicht geloescht");
- SwHstryHint * pHt = new SwHstryBookmark(rBkmk, bSavePos, bSaveOtherPos);
- Insert(pHt, Count());
+ ASSERT( !m_nEndDiff, "History was not deleted after REDO" );
+
+ SwHistoryHint * pHt = new SwHistoryBookmark(rBkmk, bSavePos, bSaveOtherPos);
+ m_SwpHstry.Insert( pHt, Count() );
}
-void SwHistory::Add( const SwFrmFmt& rFmt )
+void SwHistory::Add( SwFrmFmt& rFmt )
{
- SwHstryHint * pHt = new SwHstryChgFlyAnchor( rFmt );
- Insert( pHt, Count() );
+ SwHistoryHint * pHt = new SwHistoryChangeFlyAnchor( rFmt );
+ m_SwpHstry.Insert( pHt, Count() );
}
-void SwHistory::Add( const SwFlyFrmFmt& rFmt, USHORT& rSetPos )
+void SwHistory::Add( SwFlyFrmFmt& rFmt, USHORT& rSetPos )
{
- ASSERT( !nEndDiff, "nach REDO wurde die History noch nicht geloescht" );
- SwHstryHint * pHint;
+ ASSERT( !m_nEndDiff, "History was not deleted after REDO" );
+
+ SwHistoryHint * pHint;
const USHORT nWh = rFmt.Which();
if( RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh )
{
- pHint = new SwHstryTxtFlyCnt( (SwFlyFrmFmt*)&rFmt );
- Insert( pHint, Count() );
+ pHint = new SwHistoryTxtFlyCnt( &rFmt );
+ m_SwpHstry.Insert( pHint, Count() );
const SwFmtChain* pChainItem;
if( SFX_ITEM_SET == rFmt.GetItemState( RES_CHAIN, FALSE,
@@ -1043,8 +1126,9 @@ void SwHistory::Add( const SwFlyFrmFmt& rFmt, USHORT& rSetPos )
{
if( pChainItem->GetNext() || pChainItem->GetPrev() )
{
- SwHstryHint * pHt = new SwHstryChgFlyChain( rFmt, *pChainItem );
- Insert( pHt, rSetPos++ );
+ SwHistoryHint * pHt =
+ new SwHistoryChangeFlyChain( rFmt, *pChainItem );
+ m_SwpHstry.Insert( pHt, rSetPos++ );
if ( pChainItem->GetNext() )
{
SwFmtChain aTmp( pChainItem->GetNext()->GetChain() );
@@ -1058,23 +1142,22 @@ void SwHistory::Add( const SwFlyFrmFmt& rFmt, USHORT& rSetPos )
pChainItem->GetPrev()->SetFmtAttr( aTmp );
}
}
- ((SwFlyFrmFmt&)rFmt).ResetFmtAttr( RES_CHAIN );
+ rFmt.ResetFmtAttr( RES_CHAIN );
}
}
}
void SwHistory::Add( const SwTxtFtn& rFtn )
{
- SwHstryHint *pHt = new SwSetFtnHint( rFtn );
- Insert( pHt, Count() );
+ SwHistoryHint *pHt = new SwHistorySetFootnote( rFtn );
+ m_SwpHstry.Insert( pHt, Count() );
}
// #i27615#
void SwHistory::Add(const SfxItemSet & rSet, const SwCharFmt & rFmt)
{
- SwHstryHint * pHt = new SwHstryChgCharFmt(rSet, rFmt.GetName());
-
- Insert(pHt, Count());
+ SwHistoryHint * pHt = new SwHistoryChangeCharFmt(rSet, rFmt.GetName());
+ m_SwpHstry.Insert(pHt, Count());
}
/*************************************************************************
@@ -1088,69 +1171,80 @@ void SwHistory::Add(const SfxItemSet & rSet, const SwCharFmt & rFmt)
*************************************************************************/
-BOOL SwHistory::Rollback( SwDoc* pDoc, USHORT nStart )
+bool SwHistory::Rollback( SwDoc* pDoc, USHORT nStart )
{
- if( !Count() )
- return FALSE;
+ if ( !Count() )
+ return false;
- SwHstryHint * pHHt;
+ SwHistoryHint * pHHt;
USHORT i;
- for( i = Count(); i > nStart ; )
+ for ( i = Count(); i > nStart ; )
{
- pHHt = operator[]( --i );
- pHHt->SetInDoc( pDoc, FALSE );
+ pHHt = m_SwpHstry[ --i ];
+ pHHt->SetInDoc( pDoc, false );
delete pHHt;
}
- SwpHstry::Remove( nStart, Count() - nStart );
- nEndDiff = 0;
- return TRUE;
+ m_SwpHstry.Remove( nStart, Count() - nStart );
+ m_nEndDiff = 0;
+ return true;
}
-BOOL SwHistory::TmpRollback( SwDoc* pDoc, USHORT nStart, BOOL bToFirst )
+bool SwHistory::TmpRollback( SwDoc* pDoc, USHORT nStart, bool bToFirst )
{
- USHORT nEnd = Count() - nEndDiff;
- if( !Count() || !nEnd || nStart >= nEnd )
- return FALSE;
+ USHORT nEnd = Count() - m_nEndDiff;
+ if ( !Count() || !nEnd || nStart >= nEnd )
+ return false;
- SwHstryHint * pHHt;
- if( bToFirst )
- for( ; nEnd > nStart; ++nEndDiff )
+ SwHistoryHint * pHHt;
+ if ( bToFirst )
+ {
+ for ( ; nEnd > nStart; ++m_nEndDiff )
{
- pHHt = operator[]( --nEnd );
- pHHt->SetInDoc( pDoc, TRUE );
+ pHHt = m_SwpHstry[ --nEnd ];
+ pHHt->SetInDoc( pDoc, true );
}
+ }
else
- for( ; nStart < nEnd; ++nEndDiff, ++nStart )
+ {
+ for ( ; nStart < nEnd; ++m_nEndDiff, ++nStart )
{
- pHHt = operator[]( nStart );
- pHHt->SetInDoc( pDoc, TRUE );
+ pHHt = m_SwpHstry[ nStart ];
+ pHHt->SetInDoc( pDoc, true );
}
- return TRUE;
+ }
+ return true;
}
void SwHistory::Delete( USHORT nStart )
{
- for( USHORT n = Count(); n > nStart; )
- SwpHstry::DeleteAndDestroy( --n, 1 );
- nEndDiff = 0;
+ for ( USHORT n = Count(); n > nStart; )
+ {
+ m_SwpHstry.DeleteAndDestroy( --n, 1 );
+ }
+ m_nEndDiff = 0;
}
USHORT SwHistory::SetTmpEnd( USHORT nNewTmpEnd )
{
- ASSERT( nNewTmpEnd <= Count(), "das temp. Ende ist zu gross" );
+ ASSERT( nNewTmpEnd <= Count(), "SwHistory::SetTmpEnd: out of bounds" );
- USHORT nOld = Count() - nEndDiff;
- nEndDiff = Count() - nNewTmpEnd;
+ USHORT nOld = Count() - m_nEndDiff;
+ m_nEndDiff = Count() - nNewTmpEnd;
- // rufe bei allen SwHstryFlyCnt das Redo vom UndoObject auf. Dadurch
- // werden die Formate der Fly gesichert !!
- for( USHORT n = nOld; n < nNewTmpEnd; n++ )
- if( HSTRY_FLYCNT == (*this)[ n ]->Which() )
- ((SwHstryTxtFlyCnt*)(*this)[ n ])->GetUDelLFmt()->Redo();
+ // for every SwHistoryFlyCnt, call the Redo of its UndoObject.
+ // this saves the formats of the flys!
+ for ( USHORT n = nOld; n < nNewTmpEnd; n++ )
+ {
+ if ( HSTRY_FLYCNT == (*this)[ n ]->Which() )
+ {
+ static_cast<SwHistoryTxtFlyCnt*>((*this)[ n ])
+ ->GetUDelLFmt()->Redo();
+ }
+ }
return nOld;
}
@@ -1173,21 +1267,21 @@ void SwHistory::CopyFmtAttr( const SfxItemSet& rSet, ULONG nNodeIdx )
}
}
-void SwHistory::CopyAttr( const SwpHints* pHts, ULONG nNodeIdx,
- xub_StrLen nStt, xub_StrLen nEnd, BOOL bFields )
+void SwHistory::CopyAttr( SwpHints* pHts, ULONG nNodeIdx,
+ xub_StrLen nStart, xub_StrLen nEnd, bool bFields )
{
if( !pHts )
return;
- // kopiere alle Attribute aus dem TextNode die
- // im Bereich von Position nStt bis Len liegen
- const SwTxtAttr* pHt;
+ // copy all attributes of the TextNode in the area from nStart to nEnd
+ SwTxtAttr* pHt;
xub_StrLen nAttrStt;
const xub_StrLen * pEndIdx;
for( USHORT n = 0; n < pHts->Count(); n++ )
{
// BP: nAttrStt muss auch bei !pEndIdx gesetzt werden
- nAttrStt = *(pHt = (*pHts)[n])->GetStart();
+ pHt = pHts->GetTextHint(n);
+ nAttrStt = *pHt->GetStart();
// JP: ???? wieso nAttrStt >= nEnd
// if( 0 != ( pEndIdx = pHt->GetEnd() ) && nAttrStt >= nEnd )
if( 0 != ( pEndIdx = pHt->GetEnd() ) && nAttrStt > nEnd )
@@ -1212,17 +1306,21 @@ void SwHistory::CopyAttr( const SwpHints* pHts, ULONG nNodeIdx,
if( bNextAttr )
continue;
- // alle Attribute, die irgendwie in diesem Bereich liegen speichern
- if( nStt <= nAttrStt )
+ // save all attributes that are somehow in this area
+ if ( nStart <= nAttrStt )
{
- if( nEnd > nAttrStt
+ if ( nEnd > nAttrStt
// JP: ???? wieso nAttrStt >= nEnd
// || (nEnd == nAttrStt && (!pEndIdx || nEnd == pEndIdx->GetIndex()))
)
- Add( pHt, nNodeIdx, FALSE );
+ {
+ Add( pHt, nNodeIdx, false );
+ }
+ }
+ else if ( pEndIdx && nStart < *pEndIdx )
+ {
+ Add( pHt, nNodeIdx, false );
}
- else if( pEndIdx && nStt < *pEndIdx )
- Add( pHt, nNodeIdx, FALSE );
}
}
@@ -1232,74 +1330,79 @@ void SwHistory::CopyAttr( const SwpHints* pHts, ULONG nNodeIdx,
// Klasse zum Registrieren der History am Node, Format, HintsArray, ...
SwRegHistory::SwRegHistory( SwHistory* pHst )
- : SwClient( 0 ),
- pHstry( pHst ),
- nNodeIdx( ULONG_MAX )
+ : SwClient( 0 )
+ , m_pHistory( pHst )
+ , m_nNodeIndex( ULONG_MAX )
{
- if( pHst )
- _MakeSetWhichIds();
+ _MakeSetWhichIds();
}
SwRegHistory::SwRegHistory( SwModify* pRegIn, const SwNode& rNd,
SwHistory* pHst )
- : SwClient( pRegIn ),
- pHstry( pHst ),
- nNodeIdx( rNd.GetIndex() )
+ : SwClient( pRegIn )
+ , m_pHistory( pHst )
+ , m_nNodeIndex( rNd.GetIndex() )
{
- if( pHst )
- _MakeSetWhichIds();
+ _MakeSetWhichIds();
}
SwRegHistory::SwRegHistory( const SwNode& rNd, SwHistory* pHst )
- : SwClient( 0 ),
- pHstry( pHst ),
- nNodeIdx( rNd.GetIndex() )
+ : SwClient( 0 )
+ , m_pHistory( pHst )
+ , m_nNodeIndex( rNd.GetIndex() )
{
- if( pHstry )
- _MakeSetWhichIds();
+ _MakeSetWhichIds();
}
void SwRegHistory::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
{
- // Attribut erfragen ?? ( mal sehen )
- if( pHstry && ( pOld || pNew ) )
+ if ( m_pHistory && ( pOld || pNew ) )
{
- if( pNew->Which() < POOLATTR_END )
- pHstry->Add( pOld, pNew, nNodeIdx );
- else if( RES_ATTRSET_CHG == pNew->Which() )
+ if ( pNew->Which() < POOLATTR_END )
{
- SwHstryHint* pNewHstr;
- const SfxItemSet& rSet = *((SwAttrSetChg*)pOld)->GetChgSet();
- if( 1 < rSet.Count() )
- pNewHstr = new SwHstrySetAttrSet( rSet, nNodeIdx,
- aSetWhichIds );
+ m_pHistory->Add( pOld, pNew, m_nNodeIndex );
+ }
+ else if ( RES_ATTRSET_CHG == pNew->Which() )
+ {
+ SwHistoryHint* pNewHstr;
+ const SfxItemSet& rSet =
+ *static_cast<SwAttrSetChg*>(pOld)->GetChgSet();
+ if ( 1 < rSet.Count() )
+ {
+ pNewHstr =
+ new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet );
+ }
else
{
const SfxPoolItem* pItem = SfxItemIter( rSet ).FirstItem();
- if( aSetWhichIds.Seek_Entry( pItem->Which() ) )
- pNewHstr = new SwSetFmtHint( pItem, nNodeIdx );
+ if ( m_WhichIdSet.Seek_Entry( pItem->Which() ) )
+ {
+ pNewHstr = new SwHistorySetFmt( pItem, m_nNodeIndex );
+ }
else
- pNewHstr = new SwResetFmtHint( pItem, nNodeIdx );
+ {
+ pNewHstr = new SwHistoryResetFmt( pItem, m_nNodeIndex );
+ }
}
- pHstry->Insert( pNewHstr, pHstry->Count() );
+ m_pHistory->m_SwpHstry.Insert( pNewHstr, m_pHistory->Count() );
}
}
}
-void SwRegHistory::Add( SwTxtAttr* pHt, const BOOL bNew )
+void SwRegHistory::AddHint( SwTxtAttr* pHt, const bool bNew )
{
- pHstry->Add( pHt, nNodeIdx, bNew );
+ m_pHistory->Add( pHt, m_nNodeIndex, bNew );
}
SwRegHistory::SwRegHistory( SwTxtNode* pTxtNode, const SfxItemSet& rSet,
xub_StrLen nStart, xub_StrLen nEnd, USHORT nFlags,
SwHistory* pHst )
- : SwClient( pTxtNode ),
- pHstry( pHst ),
- nNodeIdx( pTxtNode->GetIndex() )
+ : SwClient( pTxtNode )
+ , m_pHistory( pHst )
+ , m_nNodeIndex( pTxtNode->GetIndex() )
{
if( !rSet.Count() )
return;
@@ -1322,45 +1425,57 @@ SwRegHistory::SwRegHistory( SwTxtNode* pTxtNode, const SfxItemSet& rSet,
if( pHst && bInsert )
{
- SwHstryHint* pNewHstr = new SwHstryResetAttrSet( rSet,
+ SwHistoryHint* pNewHstr = new SwHistoryResetAttrSet( rSet,
pTxtNode->GetIndex(), nStart, nEnd );
// der NodeIndex kann verschoben sein !!
- pHst->Insert( pNewHstr, pHst->Count() );
+ pHst->m_SwpHstry.Insert( pNewHstr, pHst->Count() );
}
}
void SwRegHistory::RegisterInModify( SwModify* pRegIn, const SwNode& rNd )
{
- if( pHstry && pRegIn )
+ if ( m_pHistory && pRegIn )
{
pRegIn->Add( this );
- nNodeIdx = rNd.GetIndex();
+ m_nNodeIndex = rNd.GetIndex();
_MakeSetWhichIds();
}
- else if( aSetWhichIds.Count() )
- aSetWhichIds.Remove( 0, aSetWhichIds.Count() );
+ else if ( m_WhichIdSet.Count() )
+ {
+ m_WhichIdSet.Remove( 0, m_WhichIdSet.Count() );
+ }
}
void SwRegHistory::_MakeSetWhichIds()
{
- if( aSetWhichIds.Count() )
- aSetWhichIds.Remove( 0, aSetWhichIds.Count() );
+ if (!m_pHistory) return;
+
+ if ( m_WhichIdSet.Count() )
+ {
+ m_WhichIdSet.Remove( 0, m_WhichIdSet.Count() );
+ }
if( GetRegisteredIn() )
{
const SfxItemSet* pSet = 0;
if( GetRegisteredIn()->ISA( SwCntntNode ) )
- pSet = ((SwCntntNode*)GetRegisteredIn())->GetpSwAttrSet();
- else if( GetRegisteredIn()->ISA( SwFmt ) )
- pSet = &((SwFmt*)GetRegisteredIn())->GetAttrSet();
+ {
+ pSet = static_cast<SwCntntNode*>(
+ const_cast<SwModify*>(GetRegisteredIn()))->GetpSwAttrSet();
+ }
+ else if ( GetRegisteredIn()->ISA( SwFmt ) )
+ {
+ pSet = &static_cast<SwFmt*>(
+ const_cast<SwModify*>(GetRegisteredIn()))->GetAttrSet();
+ }
if( pSet && pSet->Count() )
{
SfxItemIter aIter( *pSet );
USHORT nW = aIter.FirstItem()->Which();
while( TRUE )
{
- aSetWhichIds.Insert( nW );
+ m_WhichIdSet.Insert( nW );
if( aIter.IsAtEnd() )
break;
nW = aIter.NextItem()->Which();
@@ -1368,3 +1483,4 @@ void SwRegHistory::_MakeSetWhichIds()
}
}
}
+
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 444b8f148c0c..f26f1cdf18f4 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -37,9 +37,7 @@
#define _SVSTDARR_USHORTSSORT
#include <hintids.hxx>
#include <svx/svdmodel.hxx>
-#ifndef _SVX_TSTPITEM_HXX //autogen
#include <svx/tstpitem.hxx>
-#endif
#include <svx/svdpage.hxx>
#include <svtools/itemiter.hxx>
@@ -66,38 +64,48 @@
#include <ftninfo.hxx>
#include <redline.hxx>
#include <section.hxx>
+#include <charfmt.hxx>
+
+
inline SwDoc& SwUndoIter::GetDoc() const
{ return *pAktPam->GetDoc(); }
// -----------------------------------------------------
-_UndoFmtAttr::_UndoFmtAttr( SwFmt& rFmt, BOOL bSvDrwPt )
- : SwClient( &rFmt ), pUndo( 0 ), bSaveDrawPt( bSvDrwPt )
+SwUndoFmtAttrHelper::SwUndoFmtAttrHelper( SwFmt& rFmt, bool bSvDrwPt )
+ : SwClient( &rFmt )
+ , m_pUndo( 0 )
+ , m_bSaveDrawPt( bSvDrwPt )
{
}
-void _UndoFmtAttr::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+void SwUndoFmtAttrHelper::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
{
if( pOld && pNew )
{
if( POOLATTR_END >= pOld->Which() )
{
- if( pUndo )
- pUndo->PutAttr( *pOld );
+ if ( GetUndo() )
+ {
+ m_pUndo->PutAttr( *pOld );
+ }
else
- pUndo = new SwUndoFmtAttr( *pOld, *(SwFmt*)pRegisteredIn,
- bSaveDrawPt );
+ {
+ m_pUndo.reset( new SwUndoFmtAttr( *pOld,
+ *static_cast<SwFmt*>(pRegisteredIn), m_bSaveDrawPt ) );
+ }
}
- else if( RES_ATTRSET_CHG == pOld->Which() )
+ else if ( RES_ATTRSET_CHG == pOld->Which() )
{
- if( pUndo )
+ if ( GetUndo() )
{
- SfxItemIter aIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
+ SfxItemIter aIter(
+ *(static_cast<SwAttrSetChg*>(pOld))->GetChgSet() );
const SfxPoolItem* pItem = aIter.GetCurItem();
- while( pItem )
+ while ( pItem )
{
- pUndo->PutAttr( *pItem );
+ m_pUndo->PutAttr( *pItem );
if( aIter.IsAtEnd() )
break;
pItem = aIter.NextItem();
@@ -105,8 +113,9 @@ void _UndoFmtAttr::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
}
else
{
- pUndo = new SwUndoFmtAttr( *((SwAttrSetChg*)pOld)->GetChgSet(),
- *(SwFmt*)pRegisteredIn, bSaveDrawPt );
+ m_pUndo.reset( new SwUndoFmtAttr(
+ *static_cast<SwAttrSetChg*>(pOld)->GetChgSet(),
+ *static_cast<SwFmt*>(pRegisteredIn), m_bSaveDrawPt ) );
}
}
else
@@ -116,91 +125,77 @@ void _UndoFmtAttr::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
SwClient::Modify( pOld, pNew );
}
-// --> OD 2007-07-11 #i56253#
-struct TxtNodeNumberingAttrs
-{
- TxtNodeNumberingAttrs( ULONG nTxtNodeIdx,
- int nNumLvl,
- bool bIsRestart,
- SwNumberTree::tSwNumTreeNumber nRestartVal,
- bool bIsCounted )
- : mnTxtNodeIdx( nTxtNodeIdx ),
- mnNumLvl( nNumLvl ),
- mbIsRestart( bIsRestart ),
- mnRestartVal( nRestartVal ),
- mbIsCounted( bIsCounted )
- {}
-
- ULONG mnTxtNodeIdx;
- int mnNumLvl;
- bool mbIsRestart;
- SwNumberTree::tSwNumTreeNumber mnRestartVal;
- bool mbIsCounted;
-};
-// <--
+// -----------------------------------------------------
SwUndoFmtAttr::SwUndoFmtAttr( const SfxItemSet& rOldSet,
SwFmt& rChgFmt,
- BOOL bSvDrwPt )
- : SwUndo( UNDO_INSFMTATTR ),
- pFmt( &rChgFmt ),
+ bool bSaveDrawPt )
+ : SwUndo( UNDO_INSFMTATTR )
+ , m_pFmt( &rChgFmt )
// --> OD 2007-07-11 #i56253#
- pOldSet( 0 ),
+ , m_pOldSet( new SfxItemSet( rOldSet ) )
// <--
- nNode( 0 ),
- nFmtWhich( rChgFmt.Which() ),
- bSaveDrawPt( bSvDrwPt )
+ , m_nNodeIndex( 0 )
+ , m_nFmtWhich( rChgFmt.Which() )
+ , m_bSaveDrawPt( bSaveDrawPt )
{
- pOldSet = new SfxItemSet( rOldSet );
Init();
}
SwUndoFmtAttr::SwUndoFmtAttr( const SfxPoolItem& rItem, SwFmt& rChgFmt,
- BOOL bSvDrwPt )
- : SwUndo( UNDO_INSFMTATTR ),
- pFmt( &rChgFmt ),
- nNode( 0 ),
- nFmtWhich( rChgFmt.Which() ),
- bSaveDrawPt( bSvDrwPt )
+ bool bSaveDrawPt )
+ : SwUndo( UNDO_INSFMTATTR )
+ , m_pFmt( &rChgFmt )
+ , m_pOldSet( m_pFmt->GetAttrSet().Clone( FALSE ) )
+ , m_nNodeIndex( 0 )
+ , m_nFmtWhich( rChgFmt.Which() )
+ , m_bSaveDrawPt( bSaveDrawPt )
{
- pOldSet = pFmt->GetAttrSet().Clone( FALSE );
- pOldSet->Put( rItem );
+ m_pOldSet->Put( rItem );
Init();
}
void SwUndoFmtAttr::Init()
{
- // Ankerwechsel gesondert behandeln
- if( SFX_ITEM_SET == pOldSet->GetItemState( RES_ANCHOR, FALSE ))
- SaveFlyAnchor( bSaveDrawPt );
- else if( RES_FRMFMT == nFmtWhich )
+ // treat change of anchor specially
+ if ( SFX_ITEM_SET == m_pOldSet->GetItemState( RES_ANCHOR, FALSE ))
+ {
+ SaveFlyAnchor( m_bSaveDrawPt );
+ }
+ else if ( RES_FRMFMT == m_nFmtWhich )
{
- SwDoc* pDoc = pFmt->GetDoc();
- if( USHRT_MAX !=
- pDoc->GetTblFrmFmts()->GetPos( (const SwFrmFmtPtr)pFmt ))
+ SwDoc* pDoc = m_pFmt->GetDoc();
+ if (USHRT_MAX != pDoc->GetTblFrmFmts()->GetPos(
+ static_cast<const SwFrmFmtPtr>(m_pFmt)))
+ {
+ // Table Format: save table position, table formats are volatile!
+ SwTable * pTbl = static_cast<SwTable*>(
+ SwClientIter( *m_pFmt ).First( TYPE( SwTable )) );
+ if ( pTbl )
+ {
+ m_nNodeIndex = pTbl->GetTabSortBoxes()[ 0 ]->GetSttNd()
+ ->FindTableNode()->GetIndex();
+ }
+ }
+ else if (USHRT_MAX != pDoc->GetSections().GetPos(
+ static_cast<const SwSectionFmtPtr>(m_pFmt)))
{
- // TabellenFormat -> Tabellen Index Position merken, TabellenFormate
- // sind fluechtig!
- SwClient* pTbl = SwClientIter( *pFmt ).First( TYPE( SwTable ));
- if( pTbl )
- nNode = ((SwTable*)pTbl)->GetTabSortBoxes()[ 0 ]->
- GetSttNd()->FindTableNode()->GetIndex();
+ m_nNodeIndex = m_pFmt->GetCntnt().GetCntntIdx()->GetIndex();
}
- else if( USHRT_MAX !=
- pDoc->GetSections().GetPos( (const SwSectionFmtPtr)pFmt ))
- nNode = pFmt->GetCntnt().GetCntntIdx()->GetIndex();
- else if( 0 != dynamic_cast< SwTableBoxFmt* >( pFmt ) )
+ else if ( 0 != dynamic_cast< SwTableBoxFmt* >( m_pFmt ) )
{
- SwClient* pTblBox = SwClientIter( *pFmt ).First( TYPE( SwTableBox ));
- if( pTblBox )
- nNode = static_cast< SwTableBox* >(pTblBox)->GetSttIdx();
+ SwTableBox* pTblBox = static_cast< SwTableBox* >(
+ SwClientIter( *m_pFmt ).First( TYPE( SwTableBox )));
+ if ( pTblBox )
+ {
+ m_nNodeIndex = pTblBox->GetSttIdx();
+ }
}
}
}
SwUndoFmtAttr::~SwUndoFmtAttr()
{
- delete pOldSet;
}
void SwUndoFmtAttr::Undo( SwUndoIter& rUndoIter)
@@ -208,14 +203,14 @@ void SwUndoFmtAttr::Undo( SwUndoIter& rUndoIter)
// OD 2004-10-26 #i35443#
// Important note: <Undo(..)> also called by <ReDo(..)>
- if( !pOldSet || !pFmt || !IsFmtInDoc( &rUndoIter.GetDoc() ))
+ if ( !m_pOldSet.get() || !m_pFmt || !IsFmtInDoc( &rUndoIter.GetDoc() ))
return;
// --> OD 2004-10-26 #i35443# - If anchor attribute has been successfull
// restored, all other attributes are also restored.
// Thus, keep track of its restoration
bool bAnchorAttrRestored( false );
- if ( SFX_ITEM_SET == pOldSet->GetItemState( RES_ANCHOR, FALSE ))
+ if ( SFX_ITEM_SET == m_pOldSet->GetItemState( RES_ANCHOR, FALSE ))
{
bAnchorAttrRestored = RestoreFlyAnchor( rUndoIter );
if ( bAnchorAttrRestored )
@@ -228,105 +223,115 @@ void SwUndoFmtAttr::Undo( SwUndoIter& rUndoIter)
{
// Anchor attribute not restored due to invalid anchor position.
// Thus, delete anchor attribute.
- pOldSet->ClearItem( RES_ANCHOR );
+ m_pOldSet->ClearItem( RES_ANCHOR );
}
}
if ( !bAnchorAttrRestored )
// <--
{
- _UndoFmtAttr aTmp( *pFmt, bSaveDrawPt );
- pFmt->SetFmtAttr( *pOldSet );
- if( aTmp.pUndo )
+ SwUndoFmtAttrHelper aTmp( *m_pFmt, m_bSaveDrawPt );
+ m_pFmt->SetFmtAttr( *m_pOldSet );
+ if ( aTmp.GetUndo() )
{
- delete pOldSet;
- pOldSet = aTmp.pUndo->pOldSet;
- aTmp.pUndo->pOldSet = 0; // den Pointer auf 0 setzen (nicht
- // doppelt loeschen) !!
- delete aTmp.pUndo; // Undo-Object wieder loeschen
+ // transfer ownership of helper object's old set
+ m_pOldSet = aTmp.GetUndo()->m_pOldSet;
}
else
- pOldSet->ClearItem();
+ {
+ m_pOldSet->ClearItem();
+ }
- if( RES_FLYFRMFMT == nFmtWhich || RES_DRAWFRMFMT == nFmtWhich )
- rUndoIter.pSelFmt = (SwFrmFmt*)pFmt;
+ if ( RES_FLYFRMFMT == m_nFmtWhich || RES_DRAWFRMFMT == m_nFmtWhich )
+ {
+ rUndoIter.pSelFmt = static_cast<SwFrmFmt*>(m_pFmt);
+ }
}
}
-int SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
+bool SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
{
- // suche im Dokument nach dem Format. Ist es nicht mehr vorhanden
- // so wird das Attribut nicht mehr gesetzt !
+ // search for the Format in the Document; if it does not exist any more,
+ // the attribute is not restored!
USHORT nPos = USHRT_MAX;
- switch( nFmtWhich )
+ switch ( m_nFmtWhich )
{
- case RES_TXTFMTCOLL:
- nPos = pDoc->GetTxtFmtColls()->GetPos(
- (const SwTxtFmtCollPtr)pFmt );
- break;
+ case RES_TXTFMTCOLL:
+ nPos = pDoc->GetTxtFmtColls()->GetPos(
+ static_cast<const SwTxtFmtCollPtr>(m_pFmt) );
+ break;
- case RES_GRFFMTCOLL:
- nPos = pDoc->GetGrfFmtColls()->GetPos(
- (const SwGrfFmtCollPtr)pFmt );
- break;
- case RES_CHRFMT:
- nPos = pDoc->GetCharFmts()->GetPos(
- (const SwCharFmtPtr)pFmt );
- break;
+ case RES_GRFFMTCOLL:
+ nPos = pDoc->GetGrfFmtColls()->GetPos(
+ static_cast<const SwGrfFmtCollPtr>(m_pFmt) );
+ break;
- case RES_FRMFMT:
- if( nNode && nNode < pDoc->GetNodes().Count() )
- {
- SwNode* pNd = pDoc->GetNodes()[ nNode ];
- if( pNd->IsTableNode() )
- {
- pFmt = ((SwTableNode*)pNd)->GetTable().GetFrmFmt();
- nPos = 0;
- break;
- }
- else if( pNd->IsSectionNode() )
- {
- pFmt = ((SwSectionNode*)pNd)->GetSection().GetFmt();
- nPos = 0;
- break;
- }
- else if( pNd->IsStartNode() && SwTableBoxStartNode ==
- static_cast< SwStartNode* >(pNd)->GetStartNodeType() )
+ case RES_CHRFMT:
+ nPos = pDoc->GetCharFmts()->GetPos(
+ static_cast<SwCharFmtPtr>(m_pFmt) );
+ break;
+
+ case RES_FRMFMT:
+ if ( m_nNodeIndex && (m_nNodeIndex < pDoc->GetNodes().Count()) )
{
- SwTableNode* pTblNode = pNd->FindTableNode();
- if( pTblNode )
+ SwNode* pNd = pDoc->GetNodes()[ m_nNodeIndex ];
+ if ( pNd->IsTableNode() )
+ {
+ m_pFmt =
+ static_cast<SwTableNode*>(pNd)->GetTable().GetFrmFmt();
+ nPos = 0;
+ break;
+ }
+ else if ( pNd->IsSectionNode() )
+ {
+ m_pFmt =
+ static_cast<SwSectionNode*>(pNd)->GetSection().GetFmt();
+ nPos = 0;
+ break;
+ }
+ else if ( pNd->IsStartNode() && (SwTableBoxStartNode ==
+ static_cast< SwStartNode* >(pNd)->GetStartNodeType()) )
{
- SwTableBox* pBox = pTblNode->GetTable().GetTblBox( nNode );
- if( pBox )
+ SwTableNode* pTblNode = pNd->FindTableNode();
+ if ( pTblNode )
{
- pFmt = pBox->GetFrmFmt();
- nPos = 0;
- break;
+ SwTableBox* pBox =
+ pTblNode->GetTable().GetTblBox( m_nNodeIndex );
+ if ( pBox )
+ {
+ m_pFmt = pBox->GetFrmFmt();
+ nPos = 0;
+ break;
+ }
}
}
}
- }
- // kein break!
- case RES_DRAWFRMFMT:
- case RES_FLYFRMFMT:
- if( USHRT_MAX == ( nPos = pDoc->GetSpzFrmFmts()->GetPos(
- (const SwFrmFmtPtr)pFmt )) )
- nPos = pDoc->GetFrmFmts()->GetPos(
- (const SwFrmFmtPtr)pFmt );
- break;
+ // no break!
+ case RES_DRAWFRMFMT:
+ case RES_FLYFRMFMT:
+ nPos = pDoc->GetSpzFrmFmts()->GetPos(
+ static_cast<const SwFrmFmtPtr>(m_pFmt) );
+ if ( USHRT_MAX == nPos )
+ {
+ nPos = pDoc->GetFrmFmts()->GetPos(
+ static_cast<const SwFrmFmtPtr>(m_pFmt) );
+ }
+ break;
}
- // Format nicht mehr vorhanden, zurueck
- if( USHRT_MAX == nPos )
- pFmt = 0;
+ if ( USHRT_MAX == nPos )
+ {
+ // Format does not exist; reset
+ m_pFmt = 0;
+ }
- return 0 != pFmt;
+ return 0 != m_pFmt;
}
// prueft, ob es noch im Doc ist!
SwFmt* SwUndoFmtAttr::GetFmt( SwDoc& rDoc )
{
- return pFmt && IsFmtInDoc( &rDoc ) ? pFmt : 0;
+ return m_pFmt && IsFmtInDoc( &rDoc ) ? m_pFmt : 0;
}
void SwUndoFmtAttr::Redo( SwUndoIter& rUndoIter)
@@ -339,23 +344,29 @@ void SwUndoFmtAttr::Redo( SwUndoIter& rUndoIter)
void SwUndoFmtAttr::Repeat( SwUndoIter& rUndoIter)
{
- if( !pOldSet )
+ if ( !m_pOldSet.get() )
return;
- SwUndoFmtAttr* pLast;
- if( UNDO_INSFMTATTR == rUndoIter.GetLastUndoId() &&
- ( pLast = ((SwUndoFmtAttr*)rUndoIter.pLastUndoObj))->pOldSet &&
- pLast->pFmt )
- return;
+ if ( UNDO_INSFMTATTR == rUndoIter.GetLastUndoId())
+ {
+ SwUndoFmtAttr* pLast
+ = static_cast<SwUndoFmtAttr*>(rUndoIter.pLastUndoObj);
+ if (pLast->m_pOldSet.get() && pLast->m_pFmt)
+ {
+ return;
+ }
+ }
- switch( nFmtWhich )
+ switch ( m_nFmtWhich )
{
case RES_GRFFMTCOLL:
{
SwNoTxtNode * pNd = rUndoIter.pAktPam->GetNode()->GetNoTxtNode();
if( pNd )
- rUndoIter.GetDoc().SetAttr( pFmt->GetAttrSet(),
+ {
+ rUndoIter.GetDoc().SetAttr( m_pFmt->GetAttrSet(),
*pNd->GetFmtColl() );
+ }
}
break;
@@ -363,8 +374,10 @@ void SwUndoFmtAttr::Repeat( SwUndoIter& rUndoIter)
{
SwTxtNode * pNd = rUndoIter.pAktPam->GetNode()->GetTxtNode();
if( pNd )
- rUndoIter.GetDoc().SetAttr( pFmt->GetAttrSet(),
+ {
+ rUndoIter.GetDoc().SetAttr( m_pFmt->GetAttrSet(),
*pNd->GetFmtColl() );
+ }
}
break;
@@ -381,15 +394,18 @@ void SwUndoFmtAttr::Repeat( SwUndoIter& rUndoIter)
if( pFly )
{
// Bug 43672: es duerfen nicht alle Attribute gesetzt werden!
- if( SFX_ITEM_SET == pFmt->GetAttrSet().GetItemState( RES_CNTNT ))
+ if (SFX_ITEM_SET ==
+ m_pFmt->GetAttrSet().GetItemState( RES_CNTNT ))
{
- SfxItemSet aTmpSet( pFmt->GetAttrSet() );
+ SfxItemSet aTmpSet( m_pFmt->GetAttrSet() );
aTmpSet.ClearItem( RES_CNTNT );
if( aTmpSet.Count() )
rUndoIter.GetDoc().SetAttr( aTmpSet, *pFly );
}
else
- rUndoIter.GetDoc().SetAttr( pFmt->GetAttrSet(), *pFly );
+ {
+ rUndoIter.GetDoc().SetAttr( m_pFmt->GetAttrSet(), *pFly );
+ }
}
break;
}
@@ -402,30 +418,34 @@ SwRewriter SwUndoFmtAttr::GetRewriter() const
{
SwRewriter aRewriter;
- if (pFmt)
- aRewriter.AddRule(UNDO_ARG1, pFmt->GetName());
+ if (m_pFmt)
+ {
+ aRewriter.AddRule(UNDO_ARG1, m_pFmt->GetName());
+ }
return aRewriter;
}
void SwUndoFmtAttr::PutAttr( const SfxPoolItem& rItem )
{
- pOldSet->Put( rItem );
- if( RES_ANCHOR == rItem.Which() )
- SaveFlyAnchor( bSaveDrawPt );
+ m_pOldSet->Put( rItem );
+ if ( RES_ANCHOR == rItem.Which() )
+ {
+ SaveFlyAnchor( m_bSaveDrawPt );
+ }
}
-void SwUndoFmtAttr::SaveFlyAnchor( BOOL bSvDrwPt )
+void SwUndoFmtAttr::SaveFlyAnchor( bool bSvDrwPt )
{
// das Format ist gueltig, sonst wuerde man gar bis hier kommen
if( bSvDrwPt )
{
- if( RES_DRAWFRMFMT == pFmt->Which() )
+ if ( RES_DRAWFRMFMT == m_pFmt->Which() )
{
- Point aPt( ((SwFrmFmt*)pFmt)->FindSdrObject()->GetRelativePos() );
- // den alten Wert als zwischenspeichern. Attribut dafuer benutzen,
- // dadurch bleibt der SwUndoFmtAttr klein.
- pOldSet->Put( SwFmtFrmSize( ATT_VAR_SIZE, aPt.X(), aPt.Y() ) );
+ Point aPt( static_cast<SwFrmFmt*>(m_pFmt)->FindSdrObject()
+ ->GetRelativePos() );
+ // store old value as attribute, to keep SwUndoFmtAttr small
+ m_pOldSet->Put( SwFmtFrmSize( ATT_VAR_SIZE, aPt.X(), aPt.Y() ) );
}
/* else
{
@@ -434,8 +454,8 @@ void SwUndoFmtAttr::SaveFlyAnchor( BOOL bSvDrwPt )
}
*/ }
- const SwFmtAnchor& rAnchor = (SwFmtAnchor&)pOldSet->Get(
- RES_ANCHOR, FALSE );
+ const SwFmtAnchor& rAnchor =
+ static_cast<const SwFmtAnchor&>( m_pOldSet->Get( RES_ANCHOR, FALSE ) );
if( !rAnchor.GetCntntAnchor() )
return;
@@ -447,14 +467,14 @@ void SwUndoFmtAttr::SaveFlyAnchor( BOOL bSvDrwPt )
nCntnt = rAnchor.GetCntntAnchor()->nContent.GetIndex();
case FLY_AT_CNTNT:
case FLY_AT_FLY:
- nNode = rAnchor.GetCntntAnchor()->nNode.GetIndex();
+ m_nNodeIndex = rAnchor.GetCntntAnchor()->nNode.GetIndex();
break;
default:
return;
}
SwFmtAnchor aAnchor( rAnchor.GetAnchorId(), nCntnt );
- pOldSet->Put( aAnchor );
+ m_pOldSet->Put( aAnchor );
}
// --> OD 2004-10-26 #i35443# - Add return value, type <bool>.
@@ -464,18 +484,19 @@ void SwUndoFmtAttr::SaveFlyAnchor( BOOL bSvDrwPt )
bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
{
SwDoc* pDoc = &rIter.GetDoc();
- SwFlyFrmFmt* pFrmFmt = (SwFlyFrmFmt*)pFmt;
- const SwFmtAnchor& rAnchor = (SwFmtAnchor&)pOldSet->Get(
- RES_ANCHOR, FALSE );
+ SwFlyFrmFmt* pFrmFmt = static_cast<SwFlyFrmFmt*>(m_pFmt);
+ const SwFmtAnchor& rAnchor =
+ static_cast<const SwFmtAnchor&>( m_pOldSet->Get( RES_ANCHOR, FALSE ) );
SwFmtAnchor aNewAnchor( rAnchor.GetAnchorId() );
if( FLY_PAGE != rAnchor.GetAnchorId() )
{
- SwNode* pNd = pDoc->GetNodes()[ nNode ];
+ SwNode* pNd = pDoc->GetNodes()[ m_nNodeIndex ];
- if( FLY_AT_FLY == rAnchor.GetAnchorId() ? ( !pNd->IsStartNode() ||
- SwFlyStartNode != ((SwStartNode*)pNd)->GetStartNodeType() ) :
- !pNd->IsTxtNode() )
+ if ( (FLY_AT_FLY == rAnchor.GetAnchorId())
+ ? ( !pNd->IsStartNode() || (SwFlyStartNode !=
+ static_cast<SwStartNode*>(pNd)->GetStartNodeType()) )
+ : !pNd->IsTxtNode() )
{
// --> OD 2004-10-26 #i35443# - invalid position.
// Thus, anchor attribute not restored
@@ -488,7 +509,8 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
{
aPos.nContent.Assign( (SwTxtNode*)pNd, rAnchor.GetPageNum() );
- if( aPos.nContent.GetIndex() > ((SwTxtNode*)pNd)->GetTxt().Len() )
+ if ( aPos.nContent.GetIndex() >
+ static_cast<SwTxtNode*>(pNd)->GetTxt().Len() )
{
// --> OD 2004-10-26 #i35443# - invalid position.
// Thus, anchor attribute not restored
@@ -507,11 +529,11 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
if( RES_DRAWFRMFMT == pFrmFmt->Which() )
{
// den alten zwischengespeicherten Wert herausholen.
- const SwFmtFrmSize& rOldSize = (const SwFmtFrmSize&)
- pOldSet->Get( RES_FRM_SIZE );
+ const SwFmtFrmSize& rOldSize = static_cast<const SwFmtFrmSize&>(
+ m_pOldSet->Get( RES_FRM_SIZE ) );
aDrawSavePt.X() = rOldSize.GetWidth();
aDrawSavePt.Y() = rOldSize.GetHeight();
- pOldSet->ClearItem( RES_FRM_SIZE );
+ m_pOldSet->ClearItem( RES_FRM_SIZE );
// den akt. wieder zwischenspeichern
aDrawOldPt = pFrmFmt->FindSdrObject()->GetRelativePos();
@@ -519,7 +541,9 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
// pCont->DisconnectFromLayout();
}
else
- pFrmFmt->DelFrms(); // Frms vernichten.
+ {
+ pFrmFmt->DelFrms(); // delete Frms
+ }
}
const SwFmtAnchor &rOldAnch = pFrmFmt->GetAnchor();
@@ -543,7 +567,7 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFrmFmt,
"Wrong TxtFlyCnt-Hint." );
#endif
- ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt();
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt();
//Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet
//werden.
@@ -551,25 +575,25 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
}
{
- pOldSet->Put( aNewAnchor );
- _UndoFmtAttr aTmp( *pFmt, bSaveDrawPt );
- pFmt->SetFmtAttr( *pOldSet );
- if( aTmp.pUndo )
+ m_pOldSet->Put( aNewAnchor );
+ SwUndoFmtAttrHelper aTmp( *m_pFmt, m_bSaveDrawPt );
+ m_pFmt->SetFmtAttr( *m_pOldSet );
+ if ( aTmp.GetUndo() )
{
- delete pOldSet;
- nNode = aTmp.pUndo->nNode;
- pOldSet = aTmp.pUndo->pOldSet;
- aTmp.pUndo->pOldSet = 0; // den Pointer auf 0 setzen (nicht
- // doppelt loeschen) !!
- delete aTmp.pUndo; // Undo-Object wieder loeschen
+ m_nNodeIndex = aTmp.GetUndo()->m_nNodeIndex;
+ // transfer ownership of helper object's old set
+ m_pOldSet = aTmp.GetUndo()->m_pOldSet;
}
else
- pOldSet->ClearItem();
+ {
+ m_pOldSet->ClearItem();
+ }
}
- if( RES_DRAWFRMFMT == pFrmFmt->Which() )
+ if ( RES_DRAWFRMFMT == pFrmFmt->Which() )
{
- SwDrawContact *pCont = (SwDrawContact*)pFrmFmt->FindContactObj();
+ SwDrawContact *pCont =
+ static_cast<SwDrawContact*>(pFrmFmt->FindContactObj());
// das Draw-Model hat auch noch ein Undo-Object fuer die
// richtige Position vorbereitet; dieses ist aber relativ.
// Darum verhinder hier, das durch setzen des Ankers das
@@ -586,7 +610,8 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
pObj->SetRelativePos( aDrawSavePt );
// den alten Wert wieder zwischenspeichern.
- pOldSet->Put( SwFmtFrmSize( ATT_VAR_SIZE, aDrawOldPt.X(), aDrawOldPt.Y() ) );
+ m_pOldSet->Put(
+ SwFmtFrmSize( ATT_VAR_SIZE, aDrawOldPt.X(), aDrawOldPt.Y() ) );
}
if( FLY_IN_CNTNT == aNewAnchor.GetAnchorId() )
@@ -608,73 +633,75 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter )
// <--
}
+// -----------------------------------------------------
+
// --> OD 2008-02-12 #newlistlevelattrs#
SwUndoFmtResetAttr::SwUndoFmtResetAttr( SwFmt& rChangedFormat,
const USHORT nWhichId )
- : SwUndo( UNDO_RESETATTR ),
- mpChangedFormat( &rChangedFormat ),
- mnWhichId( nWhichId ),
- mpOldItem( 0 )
+ : SwUndo( UNDO_RESETATTR )
+ , m_pChangedFormat( &rChangedFormat )
+ , m_nWhichId( nWhichId )
+ , m_pOldItem( 0 )
{
const SfxPoolItem* pItem = 0;
- if ( rChangedFormat.GetItemState( nWhichId, FALSE, &pItem ) == SFX_ITEM_SET )
+ if (rChangedFormat.GetItemState( nWhichId, FALSE, &pItem ) == SFX_ITEM_SET)
{
- mpOldItem = pItem->Clone();
+ m_pOldItem.reset( pItem->Clone() );
}
}
SwUndoFmtResetAttr::~SwUndoFmtResetAttr()
{
- delete mpOldItem;
}
void SwUndoFmtResetAttr::Undo( SwUndoIter& )
{
- if ( mpOldItem )
+ if ( m_pOldItem.get() )
{
- mpChangedFormat->SetFmtAttr( *mpOldItem );
+ m_pChangedFormat->SetFmtAttr( *m_pOldItem );
}
}
void SwUndoFmtResetAttr::Redo( SwUndoIter& )
{
- if ( mpOldItem )
+ if ( m_pOldItem.get() )
{
- mpChangedFormat->ResetFmtAttr( mnWhichId );
+ m_pChangedFormat->ResetFmtAttr( m_nWhichId );
}
}
// <--
-/* */
+// -----------------------------------------------------
-SwUndoRstAttr::SwUndoRstAttr( const SwPaM& rRange, USHORT nFmt )
- : SwUndo( UNDO_RESETATTR ), SwUndRng( rRange ),
- pHistory( new SwHistory ), nFmtId( nFmt )
+SwUndoResetAttr::SwUndoResetAttr( const SwPaM& rRange, USHORT nFmtId )
+ : SwUndo( UNDO_RESETATTR ), SwUndRng( rRange )
+ , m_pHistory( new SwHistory )
+ , m_nFormatId( nFmtId )
{
}
-SwUndoRstAttr::SwUndoRstAttr( const SwDoc& , const SwPosition& rPos,
- USHORT nWhich )
- : SwUndo( UNDO_RESETATTR ), pHistory( new SwHistory ), nFmtId( nWhich )
+SwUndoResetAttr::SwUndoResetAttr( const SwPosition& rPos, USHORT nFmtId )
+ : SwUndo( UNDO_RESETATTR )
+ , m_pHistory( new SwHistory )
+ , m_nFormatId( nFmtId )
{
nSttNode = nEndNode = rPos.nNode.GetIndex();
nSttCntnt = nEndCntnt = rPos.nContent.GetIndex();
}
-SwUndoRstAttr::~SwUndoRstAttr()
+SwUndoResetAttr::~SwUndoResetAttr()
{
- delete pHistory;
}
-void SwUndoRstAttr::Undo( SwUndoIter& rUndoIter )
+void SwUndoResetAttr::Undo( SwUndoIter& rUndoIter )
{
- // die alten Werte wieder zurueck
+ // reset old values
SwDoc& rDoc = rUndoIter.GetDoc();
- pHistory->TmpRollback( &rDoc, 0 );
- pHistory->SetTmpEnd( pHistory->Count() );
+ m_pHistory->TmpRollback( &rDoc, 0 );
+ m_pHistory->SetTmpEnd( m_pHistory->Count() );
- if( RES_CONDTXTFMTCOLL == nFmtId && nSttNode == nEndNode &&
- nSttCntnt == nEndCntnt )
+ if ((RES_CONDTXTFMTCOLL == m_nFormatId) &&
+ (nSttNode == nEndNode) && (nSttCntnt == nEndCntnt))
{
SwTxtNode* pTNd = rDoc.GetNodes()[ nSttNode ]->GetTxtNode();
if( pTNd )
@@ -688,15 +715,15 @@ void SwUndoRstAttr::Undo( SwUndoIter& rUndoIter )
SetPaM( rUndoIter );
}
-void SwUndoRstAttr::Redo( SwUndoIter& rUndoIter )
+void SwUndoResetAttr::Redo( SwUndoIter& rUndoIter )
{
// setze Attribut in dem Bereich:
SetPaM( rUndoIter );
SwDoc& rDoc = rUndoIter.GetDoc();
rUndoIter.pLastUndoObj = 0;
- SvUShortsSort* pIdArr = aIds.Count() ? &aIds : 0;
+ SvUShortsSort* pIdArr = m_Ids.Count() ? &m_Ids : 0;
- switch( nFmtId )
+ switch ( m_nFormatId )
{
case RES_CHRFMT:
rUndoIter.GetDoc().RstTxtAttrs( *rUndoIter.pAktPam );
@@ -709,7 +736,7 @@ void SwUndoRstAttr::Redo( SwUndoIter& rUndoIter )
break;
case RES_TXTATR_TOXMARK:
- // Sonderbehandlung fuer TOXMarks
+ // special treatment for TOXMarks
{
SwTOXMarks aArr;
SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode );
@@ -721,17 +748,19 @@ void SwUndoRstAttr::Redo( SwUndoIter& rUndoIter )
{
if( 1 < nCnt )
{
- // dann den richtigen suchen
- SwHstryHint* pHHint = (*GetHistory())[ 0 ];
+ // search for the right one
+ SwHistoryHint* pHHint = (GetHistory())[ 0 ];
if( pHHint && HSTRY_SETTOXMARKHNT == pHHint->Which() )
{
while( nCnt )
- if( ((SwSetTOXMarkHint*)pHHint)->IsEqual(
- *aArr[ --nCnt ] ) )
+ {
+ if ( static_cast<SwHistorySetTOXMark*>(pHHint)
+ ->IsEqual( *aArr[ --nCnt ] ) )
{
++nCnt;
break;
}
+ }
}
else
nCnt = 0;
@@ -746,15 +775,18 @@ void SwUndoRstAttr::Redo( SwUndoIter& rUndoIter )
rUndoIter.pLastUndoObj = 0;
}
-void SwUndoRstAttr::Repeat( SwUndoIter& rUndoIter )
+void SwUndoResetAttr::Repeat( SwUndoIter& rUndoIter )
{
- if( RES_FMT_BEGIN > nFmtId ||
- ( UNDO_RESETATTR == rUndoIter.GetLastUndoId() &&
- nFmtId == ((SwUndoRstAttr*)rUndoIter.pLastUndoObj)->nFmtId ))
+ if ( (RES_FMT_BEGIN > m_nFormatId) ||
+ ( (UNDO_RESETATTR == rUndoIter.GetLastUndoId()) &&
+ (m_nFormatId == static_cast<SwUndoResetAttr*>(rUndoIter.pLastUndoObj)
+ ->m_nFormatId) ) )
+ {
return;
+ }
- SvUShortsSort* pIdArr = aIds.Count() ? &aIds : 0;
- switch( nFmtId )
+ SvUShortsSort* pIdArr = m_Ids.Count() ? &m_Ids : 0;
+ switch ( m_nFormatId )
{
case RES_CHRFMT:
rUndoIter.GetDoc().RstTxtAttrs( *rUndoIter.pAktPam );
@@ -770,59 +802,69 @@ void SwUndoRstAttr::Repeat( SwUndoIter& rUndoIter )
}
-void SwUndoRstAttr::SetAttrs( const SvUShortsSort& rArr )
+void SwUndoResetAttr::SetAttrs( const SvUShortsSort& rArr )
{
- if( aIds.Count() )
- aIds.Remove( 0, aIds.Count() );
- aIds.Insert( &rArr );
+ if ( m_Ids.Count() )
+ {
+ m_Ids.Remove( 0, m_Ids.Count() );
+ }
+ m_Ids.Insert( &rArr );
}
// -----------------------------------------------------
-
SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr,
USHORT nFlags )
- : SwUndo( UNDO_INSATTR ), SwUndRng( rRange ),
- aSet( rRange.GetDoc()->GetAttrPool(), rAttr.Which(), rAttr.Which() ),
- pHistory( new SwHistory ),
- pRedlData( 0 ), pRedlSaveData( 0 ),
- nNdIdx( ULONG_MAX ), nInsFlags( nFlags )
+ : SwUndo( UNDO_INSATTR ), SwUndRng( rRange )
+ , m_AttrSet( rRange.GetDoc()->GetAttrPool(), rAttr.Which(), rAttr.Which() )
+ , m_pHistory( new SwHistory )
+ , m_pRedlineData( 0 )
+ , m_pRedlineSaveData( 0 )
+ , m_nNodeIndex( ULONG_MAX )
+ , m_nInsertFlags( nFlags )
{
- aSet.Put( rAttr );
+ m_AttrSet.Put( rAttr );
}
SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxItemSet& rSet,
USHORT nFlags )
- : SwUndo( UNDO_INSATTR ), SwUndRng( rRange ), aSet( rSet ),
- pHistory( new SwHistory ),
- pRedlData( 0 ), pRedlSaveData( 0 ),
- nNdIdx( ULONG_MAX ), nInsFlags( nFlags )
+ : SwUndo( UNDO_INSATTR ), SwUndRng( rRange )
+ , m_AttrSet( rSet )
+ , m_pHistory( new SwHistory )
+ , m_pRedlineData( 0 )
+ , m_pRedlineSaveData( 0 )
+ , m_nNodeIndex( ULONG_MAX )
+ , m_nInsertFlags( nFlags )
{
}
SwUndoAttr::~SwUndoAttr()
{
- delete pHistory;
- delete pRedlData;
- delete pRedlSaveData;
}
void SwUndoAttr::SaveRedlineData( const SwPaM& rPam, BOOL bIsCntnt )
{
SwDoc* pDoc = rPam.GetDoc();
- if( pDoc->IsRedlineOn() )
- pRedlData = new SwRedlineData( bIsCntnt ? nsRedlineType_t::REDLINE_INSERT
- : nsRedlineType_t::REDLINE_FORMAT,
- pDoc->GetRedlineAuthor() );
+ if ( pDoc->IsRedlineOn() )
+ {
+ m_pRedlineData.reset( new SwRedlineData( bIsCntnt
+ ? nsRedlineType_t::REDLINE_INSERT
+ : nsRedlineType_t::REDLINE_FORMAT,
+ pDoc->GetRedlineAuthor() ) );
+ }
- pRedlSaveData = new SwRedlineSaveDatas;
- if( !FillSaveDataForFmt( rPam, *pRedlSaveData ))
- delete pRedlSaveData, pRedlSaveData = 0;
+ m_pRedlineSaveData.reset( new SwRedlineSaveDatas );
+ if ( !FillSaveDataForFmt( rPam, *m_pRedlineSaveData ))
+ {
+ m_pRedlineSaveData.reset(0);
+ }
SetRedlineMode( pDoc->GetRedlineMode() );
- if( bIsCntnt )
- nNdIdx = rPam.GetPoint()->nNode.GetIndex();
+ if ( bIsCntnt )
+ {
+ m_nNodeIndex = rPam.GetPoint()->nNode.GetIndex();
+ }
}
void SwUndoAttr::Undo( SwUndoIter& rUndoIter )
@@ -834,10 +876,10 @@ void SwUndoAttr::Undo( SwUndoIter& rUndoIter )
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ) )
{
SwPaM& rPam = *rUndoIter.pAktPam;
- if( ULONG_MAX != nNdIdx )
+ if ( ULONG_MAX != m_nNodeIndex )
{
rPam.DeleteMark();
- rPam.GetPoint()->nNode = nNdIdx;
+ rPam.GetPoint()->nNode = m_nNodeIndex;
rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), nSttCntnt );
rPam.SetMark();
rPam.GetPoint()->nContent++;
@@ -848,20 +890,22 @@ void SwUndoAttr::Undo( SwUndoIter& rUndoIter )
// alle Format-Redlines entfernen, werden ggfs. neu gesetzt
SetPaM( rUndoIter );
pDoc->DeleteRedline( rPam, false, nsRedlineType_t::REDLINE_FORMAT );
- if( pRedlSaveData )
- SetSaveData( *pDoc, *pRedlSaveData );
+ if ( m_pRedlineSaveData.get() )
+ {
+ SetSaveData( *pDoc, *m_pRedlineSaveData );
+ }
}
}
- BOOL bToLast = 1 == aSet.Count() &&
- RES_TXTATR_FIELD <= *aSet.GetRanges() &&
- *aSet.GetRanges() <= RES_TXTATR_HARDBLANK;
+ const bool bToLast = (1 == m_AttrSet.Count())
+ && (RES_TXTATR_FIELD <= *m_AttrSet.GetRanges())
+ && (*m_AttrSet.GetRanges() <= RES_TXTATR_HARDBLANK);
- // die alten Werte wieder zurueck
- pHistory->TmpRollback( pDoc, 0, !bToLast );
- pHistory->SetTmpEnd( pHistory->Count() );
+ // restore old values
+ m_pHistory->TmpRollback( pDoc, 0, !bToLast );
+ m_pHistory->SetTmpEnd( m_pHistory->Count() );
- // setze noch den Cursor auf den Undo-Bereich
+ // set cursor onto Undo area
SetPaM( rUndoIter );
}
@@ -889,22 +933,30 @@ int lcl_HasEqualItems( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )
void SwUndoAttr::Repeat( SwUndoIter& rUndoIter )
{
- SwUndoAttr* pLast;
- if( UNDO_INSATTR == rUndoIter.GetLastUndoId() &&
- ( pLast = ((SwUndoAttr*)rUndoIter.pLastUndoObj))->aSet.Count() ==
- aSet.Count() && pLast->nInsFlags == nInsFlags &&
- lcl_HasEqualItems( aSet, pLast->aSet ))
- return;
+ if ( UNDO_INSATTR == rUndoIter.GetLastUndoId() )
+ {
+ SwUndoAttr* pLast = static_cast<SwUndoAttr*>(rUndoIter.pLastUndoObj);
+ if ((pLast->m_AttrSet.Count() == m_AttrSet.Count()) &&
+ (pLast->m_nInsertFlags == m_nInsertFlags ) &&
+ lcl_HasEqualItems( m_AttrSet, pLast->m_AttrSet ))
+ {
+ return;
+ }
+ }
- // RefMarks sind nicht repeatfaehig
- if( SFX_ITEM_SET != aSet.GetItemState( RES_TXTATR_REFMARK, FALSE ) )
- rUndoIter.GetDoc().Insert( *rUndoIter.pAktPam, aSet, nInsFlags );
- else if( 1 < aSet.Count() )
+ // RefMarks are not repeat capable
+ if ( SFX_ITEM_SET != m_AttrSet.GetItemState( RES_TXTATR_REFMARK, FALSE ) )
{
- SfxItemSet aTmpSet( aSet );
+ rUndoIter.GetDoc().Insert( *rUndoIter.pAktPam,
+ m_AttrSet, m_nInsertFlags );
+ }
+ else if ( 1 < m_AttrSet.Count() )
+ {
+ SfxItemSet aTmpSet( m_AttrSet );
aTmpSet.ClearItem( RES_TXTATR_REFMARK );
- rUndoIter.GetDoc().Insert( *rUndoIter.pAktPam, aTmpSet, nInsFlags );
+ rUndoIter.GetDoc().Insert( *rUndoIter.pAktPam,
+ aTmpSet, m_nInsertFlags );
}
rUndoIter.pLastUndoObj = this;
}
@@ -916,26 +968,35 @@ void SwUndoAttr::Redo( SwUndoIter& rUndoIter )
SwPaM& rPam = *rUndoIter.pAktPam;
SwDoc& rDoc = rUndoIter.GetDoc();
- if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ) )
+ if ( m_pRedlineData.get() &&
+ IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ) )
{
RedlineMode_t eOld = rDoc.GetRedlineMode();
- rDoc.SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
- rDoc.Insert( rPam, aSet, nInsFlags );
+ rDoc.SetRedlineMode_intern(static_cast<RedlineMode_t>(
+ eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
+ rDoc.Insert( rPam, m_AttrSet, m_nInsertFlags );
- if( ULONG_MAX != nNdIdx )
+ if ( ULONG_MAX != m_nNodeIndex )
{
rPam.SetMark();
- if( rPam.Move( fnMoveBackward ) )
- rDoc.AppendRedline( new SwRedline( *pRedlData, rPam ), true);
+ if ( rPam.Move( fnMoveBackward ) )
+ {
+ rDoc.AppendRedline( new SwRedline( *m_pRedlineData, rPam ),
+ true);
+ }
rPam.DeleteMark();
}
else
- rDoc.AppendRedline( new SwRedline( *pRedlData, rPam ), true);
+ {
+ rDoc.AppendRedline( new SwRedline( *m_pRedlineData, rPam ), true);
+ }
rDoc.SetRedlineMode_intern( eOld );
}
else
- rDoc.Insert( rPam, aSet, nInsFlags );
+ {
+ rDoc.Insert( rPam, m_AttrSet, m_nInsertFlags );
+ }
rUndoIter.pLastUndoObj = 0;
}
@@ -943,38 +1004,52 @@ void SwUndoAttr::Redo( SwUndoIter& rUndoIter )
void SwUndoAttr::RemoveIdx( SwDoc& rDoc )
{
- if( SFX_ITEM_SET != aSet.GetItemState( RES_TXTATR_FTN, FALSE ))
+ if ( SFX_ITEM_SET != m_AttrSet.GetItemState( RES_TXTATR_FTN, FALSE ))
return ;
- SwHstryHint* pHstHnt;
+ SwHistoryHint* pHstHnt;
SwNodes& rNds = rDoc.GetNodes();
- for( USHORT n = 0; n < pHistory->Count(); ++n )
+ for ( USHORT n = 0; n < m_pHistory->Count(); ++n )
{
xub_StrLen nCntnt = 0;
ULONG nNode = 0;
- switch( ( pHstHnt = (*pHistory)[ n ] )->Which() )
+ pHstHnt = (*m_pHistory)[ n ];
+ switch ( pHstHnt->Which() )
{
- case HSTRY_RESETTXTHNT:
- if( RES_TXTATR_FTN == ((SwResetTxtHint*)pHstHnt)->GetWhich() )
- {
- nNode = ((SwResetTxtHint*)pHstHnt)->GetNode();
- nCntnt = ((SwResetTxtHint*)pHstHnt)->GetCntnt();
- }
- break;
- case HSTRY_RESETATTRSET:
- if( STRING_MAXLEN != ( nCntnt =
- ((SwHstryResetAttrSet*)pHstHnt)->GetCntnt() ))
- {
- const SvUShorts& rArr = ((SwHstryResetAttrSet*)pHstHnt)->GetArr();
- for( USHORT i = rArr.Count(); i; )
- if( RES_TXTATR_FTN == rArr[ --i ] )
+ case HSTRY_RESETTXTHNT:
+ {
+ SwHistoryResetTxt * pHistoryHint
+ = static_cast<SwHistoryResetTxt*>(pHstHnt);
+ if ( RES_TXTATR_FTN == pHistoryHint->GetWhich() )
{
- nNode = ((SwHstryResetAttrSet*)pHstHnt)->GetNode();
- break;
+ nNode = pHistoryHint->GetNode();
+ nCntnt = pHistoryHint->GetCntnt();
}
- }
- break;
- default: break;
+ }
+ break;
+
+ case HSTRY_RESETATTRSET:
+ {
+ SwHistoryResetAttrSet * pHistoryHint
+ = static_cast<SwHistoryResetAttrSet*>(pHstHnt);
+ nCntnt = pHistoryHint->GetCntnt();
+ if ( STRING_MAXLEN != nCntnt )
+ {
+ const SvUShorts& rArr = pHistoryHint->GetArr();
+ for ( USHORT i = rArr.Count(); i; )
+ {
+ if ( RES_TXTATR_FTN == rArr[ --i ] )
+ {
+ nNode = pHistoryHint->GetNode();
+ break;
+ }
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
}
if( nNode )
@@ -987,7 +1062,7 @@ void SwUndoAttr::RemoveIdx( SwDoc& rDoc )
if( pTxtHt )
{
// ok, dann hole mal die Werte
- SwTxtFtn* pFtn = (SwTxtFtn*)pTxtHt;
+ SwTxtFtn* pFtn = static_cast<SwTxtFtn*>(pTxtHt);
RemoveIdxFromSection( rDoc, pFtn->GetStartNode()->GetIndex() );
return ;
}
@@ -996,55 +1071,54 @@ void SwUndoAttr::RemoveIdx( SwDoc& rDoc )
}
}
-/* */
+// -----------------------------------------------------
SwUndoDefaultAttr::SwUndoDefaultAttr( const SfxItemSet& rSet )
- : SwUndo( UNDO_SETDEFTATTR ), pOldSet( 0 ), pTabStop( 0 )
+ : SwUndo( UNDO_SETDEFTATTR )
+ , m_pOldSet( 0 )
+ , m_pTabStop( 0 )
{
const SfxPoolItem* pItem;
if( SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_TABSTOP, FALSE, &pItem ) )
{
- pTabStop = (SvxTabStopItem*)pItem->Clone(); // gesondert merken, aendert sich !!!
- if( 1 != rSet.Count() ) // gibts noch mehr Attribute ?
- pOldSet = new SfxItemSet( rSet );
+ // store separately, because it may change!
+ m_pTabStop.reset( static_cast<SvxTabStopItem*>(pItem->Clone()) );
+ if ( 1 != rSet.Count() ) // are there more attributes?
+ {
+ m_pOldSet.reset( new SfxItemSet( rSet ) );
+ }
}
else
- pOldSet = new SfxItemSet( rSet );
+ {
+ m_pOldSet.reset( new SfxItemSet( rSet ) );
+ }
}
SwUndoDefaultAttr::~SwUndoDefaultAttr()
{
- if( pOldSet )
- delete pOldSet;
- if( pTabStop )
- delete pTabStop;
}
void SwUndoDefaultAttr::Undo( SwUndoIter& rUndoIter)
{
SwDoc& rDoc = rUndoIter.GetDoc();
- if( pOldSet )
+ if ( m_pOldSet.get() )
{
- _UndoFmtAttr aTmp( *(SwTxtFmtColl*)rDoc.GetDfltTxtFmtColl() );
- rDoc.SetDefault( *pOldSet );
- delete pOldSet;
- if( aTmp.pUndo )
+ SwUndoFmtAttrHelper aTmp(
+ *const_cast<SwTxtFmtColl*>(rDoc.GetDfltTxtFmtColl()) );
+ rDoc.SetDefault( *m_pOldSet );
+ m_pOldSet.reset( 0 );
+ if ( aTmp.GetUndo() )
{
- pOldSet = aTmp.pUndo->pOldSet;
- aTmp.pUndo->pOldSet = 0; // den Pointer auf 0 setzen (nicht
- // doppelt loeschen) !!
- delete aTmp.pUndo; // Undo-Object wieder loeschen
+ // transfer ownership of helper object's old set
+ m_pOldSet = aTmp.GetUndo()->m_pOldSet;
}
- else
- pOldSet = 0;
}
- if( pTabStop )
+ if ( m_pTabStop.get() )
{
- SvxTabStopItem* pOld = (SvxTabStopItem*)rDoc.GetDefault(
- RES_PARATR_TABSTOP ).Clone();
- rDoc.SetDefault( *pTabStop );
- delete pTabStop;
- pTabStop = pOld;
+ SvxTabStopItem* pOld = static_cast<SvxTabStopItem*>(
+ rDoc.GetDefault( RES_PARATR_TABSTOP ).Clone() );
+ rDoc.SetDefault( *m_pTabStop );
+ m_pTabStop.reset( pOld );
}
}
@@ -1053,19 +1127,19 @@ void SwUndoDefaultAttr::Redo( SwUndoIter& rUndoIter)
Undo( rUndoIter );
}
-/* */
+// -----------------------------------------------------
-SwUndoMoveLeftMargin::SwUndoMoveLeftMargin( const SwPaM& rPam, BOOL bFlag,
- BOOL bMod )
- : SwUndo( bFlag ? UNDO_INC_LEFTMARGIN : UNDO_DEC_LEFTMARGIN ),
- SwUndRng( rPam ), bModulus( bMod )
+SwUndoMoveLeftMargin::SwUndoMoveLeftMargin(
+ const SwPaM& rPam, BOOL bFlag, BOOL bMod )
+ : SwUndo( bFlag ? UNDO_INC_LEFTMARGIN : UNDO_DEC_LEFTMARGIN )
+ , SwUndRng( rPam )
+ , m_pHistory( new SwHistory )
+ , m_bModulus( bMod )
{
- pHistory = new SwHistory;
}
SwUndoMoveLeftMargin::~SwUndoMoveLeftMargin()
{
- delete pHistory;
}
void SwUndoMoveLeftMargin::Undo( SwUndoIter& rIter )
@@ -1074,9 +1148,9 @@ void SwUndoMoveLeftMargin::Undo( SwUndoIter& rIter )
BOOL bUndo = pDoc->DoesUndo();
pDoc->DoUndo( FALSE );
- // die alten Werte wieder zurueck
- pHistory->TmpRollback( pDoc, 0 );
- pHistory->SetTmpEnd( pHistory->Count() );
+ // restore old values
+ m_pHistory->TmpRollback( pDoc, 0 );
+ m_pHistory->SetTmpEnd( m_pHistory->Count() );
pDoc->DoUndo( bUndo );
SetPaM( rIter );
@@ -1086,32 +1160,36 @@ void SwUndoMoveLeftMargin::Redo( SwUndoIter& rIter )
{
SwDoc* pDoc = &rIter.GetDoc();
SetPaM( rIter );
- pDoc->MoveLeftMargin( *rIter.pAktPam, GetId() == UNDO_INC_LEFTMARGIN, bModulus );
+ pDoc->MoveLeftMargin( *rIter.pAktPam, GetId() == UNDO_INC_LEFTMARGIN,
+ m_bModulus );
}
void SwUndoMoveLeftMargin::Repeat( SwUndoIter& rIter )
{
SwDoc* pDoc = &rIter.GetDoc();
- pDoc->MoveLeftMargin( *rIter.pAktPam, GetId() == UNDO_INC_LEFTMARGIN, bModulus );
+ pDoc->MoveLeftMargin( *rIter.pAktPam, GetId() == UNDO_INC_LEFTMARGIN,
+ m_bModulus );
rIter.pLastUndoObj = this;
}
-/* */
+// -----------------------------------------------------
-SwUndoChgFtn::SwUndoChgFtn( const SwPaM& rRange, const String& rTxt,
- USHORT nNum, BOOL bIsEndNote )
- : SwUndo( UNDO_CHGFTN ), SwUndRng( rRange ),
- pHistory( new SwHistory() ),
- sTxt( rTxt ), nNo( nNum ), bEndNote( bIsEndNote )
+SwUndoChangeFootNote::SwUndoChangeFootNote(
+ const SwPaM& rRange, const String& rTxt,
+ USHORT nNum, bool bIsEndNote )
+ : SwUndo( UNDO_CHGFTN ), SwUndRng( rRange )
+ , m_pHistory( new SwHistory() )
+ , m_Text( rTxt )
+ , m_nNumber( nNum )
+ , m_bEndNote( bIsEndNote )
{
}
-SwUndoChgFtn::~SwUndoChgFtn()
+SwUndoChangeFootNote::~SwUndoChangeFootNote()
{
- delete pHistory;
}
-void SwUndoChgFtn::Undo( SwUndoIter& rIter )
+void SwUndoChangeFootNote::Undo( SwUndoIter& rIter )
{
SwDoc& rDoc = rIter.GetDoc();
SetPaM( rIter );
@@ -1119,8 +1197,8 @@ void SwUndoChgFtn::Undo( SwUndoIter& rIter )
BOOL bUndo = rDoc.DoesUndo();
rDoc.DoUndo( FALSE );
- pHistory->TmpRollback( &rDoc, 0 );
- pHistory->SetTmpEnd( pHistory->Count() );
+ m_pHistory->TmpRollback( &rDoc, 0 );
+ m_pHistory->SetTmpEnd( m_pHistory->Count() );
rDoc.GetFtnIdxs().UpdateAllFtn();
@@ -1128,89 +1206,85 @@ void SwUndoChgFtn::Undo( SwUndoIter& rIter )
rDoc.DoUndo( bUndo );
}
-void SwUndoChgFtn::Redo( SwUndoIter& rIter )
+void SwUndoChangeFootNote::Redo( SwUndoIter& rIter )
{
SetPaM( rIter );
- rIter.GetDoc().SetCurFtn( *rIter.pAktPam, sTxt, nNo, bEndNote );
+ rIter.GetDoc().SetCurFtn( *rIter.pAktPam, m_Text, m_nNumber, m_bEndNote );
SetPaM( rIter );
}
-void SwUndoChgFtn::Repeat( SwUndoIter& rIter )
+void SwUndoChangeFootNote::Repeat( SwUndoIter& rIter )
{
SwDoc& rDoc = rIter.GetDoc();
- rDoc.SetCurFtn( *rIter.pAktPam, sTxt, nNo, bEndNote );
+ rDoc.SetCurFtn( *rIter.pAktPam, m_Text, m_nNumber, m_bEndNote );
rIter.pLastUndoObj = this;
}
-/* */
+// -----------------------------------------------------
-SwUndoFtnInfo::SwUndoFtnInfo( const SwFtnInfo &rInfo ) :
- SwUndo( UNDO_FTNINFO ),
- pFtnInfo( new SwFtnInfo( rInfo ) )
+SwUndoFootNoteInfo::SwUndoFootNoteInfo( const SwFtnInfo &rInfo )
+ : SwUndo( UNDO_FTNINFO )
+ , m_pFootNoteInfo( new SwFtnInfo( rInfo ) )
{
}
-SwUndoFtnInfo::~SwUndoFtnInfo()
+SwUndoFootNoteInfo::~SwUndoFootNoteInfo()
{
- delete pFtnInfo;
}
-void SwUndoFtnInfo::Undo( SwUndoIter &rIter )
+void SwUndoFootNoteInfo::Undo( SwUndoIter &rIter )
{
SwDoc &rDoc = rIter.GetDoc();
SwFtnInfo *pInf = new SwFtnInfo( rDoc.GetFtnInfo() );
- rDoc.SetFtnInfo( *pFtnInfo );
- delete pFtnInfo;
- pFtnInfo = pInf;
+ rDoc.SetFtnInfo( *m_pFootNoteInfo );
+ m_pFootNoteInfo.reset( pInf );
}
-void SwUndoFtnInfo::Redo( SwUndoIter &rIter )
+void SwUndoFootNoteInfo::Redo( SwUndoIter &rIter )
{
SwDoc &rDoc = rIter.GetDoc();
SwFtnInfo *pInf = new SwFtnInfo( rDoc.GetFtnInfo() );
- rDoc.SetFtnInfo( *pFtnInfo );
- delete pFtnInfo;
- pFtnInfo = pInf;
+ rDoc.SetFtnInfo( *m_pFootNoteInfo );
+ m_pFootNoteInfo.reset( pInf );
}
-/* */
-SwUndoEndNoteInfo::SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo ) :
- SwUndo( UNDO_FTNINFO ),
- pEndNoteInfo( new SwEndNoteInfo( rInfo ) )
+// -----------------------------------------------------
+
+SwUndoEndNoteInfo::SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo )
+ : SwUndo( UNDO_FTNINFO )
+ , m_pEndNoteInfo( new SwEndNoteInfo( rInfo ) )
{
}
SwUndoEndNoteInfo::~SwUndoEndNoteInfo()
{
- delete pEndNoteInfo;
}
void SwUndoEndNoteInfo::Undo( SwUndoIter &rIter )
{
SwDoc &rDoc = rIter.GetDoc();
SwEndNoteInfo *pInf = new SwEndNoteInfo( rDoc.GetEndNoteInfo() );
- rDoc.SetEndNoteInfo( *pEndNoteInfo );
- delete pEndNoteInfo;
- pEndNoteInfo = pInf;
+ rDoc.SetEndNoteInfo( *m_pEndNoteInfo );
+ m_pEndNoteInfo.reset( pInf );
}
void SwUndoEndNoteInfo::Redo( SwUndoIter &rIter )
{
SwDoc &rDoc = rIter.GetDoc();
SwEndNoteInfo *pInf = new SwEndNoteInfo( rDoc.GetEndNoteInfo() );
- rDoc.SetEndNoteInfo( *pEndNoteInfo );
- delete pEndNoteInfo;
- pEndNoteInfo = pInf;
+ rDoc.SetEndNoteInfo( *m_pEndNoteInfo );
+ m_pEndNoteInfo.reset( pInf );
}
-/* */
+// -----------------------------------------------------
SwUndoDontExpandFmt::SwUndoDontExpandFmt( const SwPosition& rPos )
- : SwUndo( UNDO_DONTEXPAND ),
- nNode( rPos.nNode.GetIndex() ), nCntnt( rPos.nContent.GetIndex() )
+ : SwUndo( UNDO_DONTEXPAND )
+ , m_nNodeIndex( rPos.nNode.GetIndex() )
+ , m_nContentIndex( rPos.nContent.GetIndex() )
{
}
@@ -1220,8 +1294,8 @@ void SwUndoDontExpandFmt::Undo( SwUndoIter& rIter )
SwDoc* pDoc = pPam->GetDoc();
SwPosition& rPos = *pPam->GetPoint();
- rPos.nNode = nNode;
- rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), nCntnt );
+ rPos.nNode = m_nNodeIndex;
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), m_nContentIndex);
pDoc->DontExpandFmt( rPos, FALSE );
}
@@ -1232,8 +1306,8 @@ void SwUndoDontExpandFmt::Redo( SwUndoIter& rIter )
SwDoc* pDoc = pPam->GetDoc();
SwPosition& rPos = *pPam->GetPoint();
- rPos.nNode = nNode;
- rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), nCntnt );
+ rPos.nNode = m_nNodeIndex;
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), m_nContentIndex);
pDoc->DontExpandFmt( rPos );
}
@@ -1244,5 +1318,3 @@ void SwUndoDontExpandFmt::Repeat( SwUndoIter& rIter )
pDoc->DontExpandFmt( *pPam->GetPoint() );
}
-
-
diff --git a/sw/source/core/undo/unbkmk.cxx b/sw/source/core/undo/unbkmk.cxx
index 86a7797fe494..f49cea5ac7d3 100644
--- a/sw/source/core/undo/unbkmk.cxx
+++ b/sw/source/core/undo/unbkmk.cxx
@@ -43,51 +43,54 @@
#include "SwRewriter.hxx"
+
inline SwDoc& SwUndoIter::GetDoc() const { return *pAktPam->GetDoc(); }
-SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId, const ::sw::mark::IMark& rBkmk )
+SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId,
+ const ::sw::mark::IMark& rBkmk )
: SwUndo( nUndoId )
+ , m_pHistoryBookmark(new SwHistoryBookmark(rBkmk, true, rBkmk.IsExpanded()))
{
- pHBookmark = new SwHstryBookmark(rBkmk, true, rBkmk.IsExpanded());
}
-
-
SwUndoBookmark::~SwUndoBookmark()
{
- delete pHBookmark;
}
-
void SwUndoBookmark::SetInDoc( SwDoc* pDoc )
{
- pHBookmark->SetInDoc( pDoc, FALSE );
+ m_pHistoryBookmark->SetInDoc( pDoc, false );
}
void SwUndoBookmark::ResetInDoc( SwDoc* pDoc )
{
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
- for(IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getMarksBegin();
- ppBkmk != pMarkAccess->getMarksEnd();
- ppBkmk++)
- if( pHBookmark->IsEqualBookmark( **ppBkmk ))
+ for (IDocumentMarkAccess::const_iterator_t ppBkmk =
+ pMarkAccess->getMarksBegin();
+ ppBkmk != pMarkAccess->getMarksEnd();
+ ++ppBkmk)
+ {
+ if ( m_pHistoryBookmark->IsEqualBookmark( **ppBkmk ) )
{
- pMarkAccess->deleteMark( ppBkmk );
- break;
+ pMarkAccess->deleteMark( ppBkmk );
+ break;
}
+ }
}
SwRewriter SwUndoBookmark::GetRewriter() const
{
SwRewriter aResult;
- aResult.AddRule(UNDO_ARG1, pHBookmark->GetName());
+ aResult.AddRule(UNDO_ARG1, m_pHistoryBookmark->GetName());
return aResult;
}
+//----------------------------------------------------------------------
+
SwUndoDelBookmark::SwUndoDelBookmark( const ::sw::mark::IMark& rBkmk )
: SwUndoBookmark( UNDO_DELBOOKMARK, rBkmk )
{
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index e3ad5aa726f3..0ed447d8204f 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -371,11 +371,10 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
xub_StrLen nLen = bOneNode ? nEndCntnt - nSttCntnt
: pSttTxtNd->GetTxt().Len() - nSttCntnt;
SwRegHistory aRHst( *pSttTxtNd, pHistory );
- // immer alle TextAttribute sichern; ist fuers Undo mit voll-
- // staendiger Attributierung am besten, wegen den evt.
- // Ueberlappenden Bereichen von An/Aus.
+ // always save all text atttibutes because of possibly overlapping
+ // areas of on/off
pHistory->CopyAttr( pSttTxtNd->GetpSwpHints(), nNdIdx,
- 0, pSttTxtNd->GetTxt().Len(), TRUE );
+ 0, pSttTxtNd->GetTxt().Len(), true );
if( !bOneNode && pSttTxtNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pSttTxtNd->GetpSwAttrSet(), nNdIdx );
@@ -383,6 +382,7 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
nLen = ( bOneNode ? pEnd->nContent.GetIndex() : pSttTxtNd->GetTxt().Len() )
- pStt->nContent.GetIndex();
+
// loesche jetzt noch den Text (alle Attribut-Aenderungen kommen in
// die Undo-History
pSttStr = (String*)new String( pSttTxtNd->GetTxt().Copy( nSttCntnt, nLen ));
@@ -390,6 +390,13 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
if( pSttTxtNd->GetpSwpHints() )
pSttTxtNd->GetpSwpHints()->DeRegister();
+ // METADATA: store
+ bool emptied( pSttStr->Len() && !pSttTxtNd->Len() );
+ if (!bOneNode || emptied) // merging may overwrite xmlids...
+ {
+ m_pMetadataUndoStart = pSttTxtNd->CreateUndo( emptied );
+ }
+
if( bOneNode )
return FALSE; // keine Nodes mehr verschieben
}
@@ -402,15 +409,15 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
nNdIdx = pEnd->nNode.GetIndex();
SwRegHistory aRHst( *pEndTxtNd, pHistory );
- // immer alle TextAttribute sichern; ist fuers Undo mit voll-
- // staendiger Attributierung am besten, wegen den evt.
- // Ueberlappenden Bereichen von An/Aus.
+ // always save all text atttibutes because of possibly overlapping
+ // areas of on/off
pHistory->CopyAttr( pEndTxtNd->GetpSwpHints(), nNdIdx, 0,
- pEndTxtNd->GetTxt().Len(), TRUE );
+ pEndTxtNd->GetTxt().Len(), true );
if( pEndTxtNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pEndTxtNd->GetpSwAttrSet(), nNdIdx );
+
// loesche jetzt noch den Text (alle Attribut-Aenderungen kommen in
// die Undo-History
pEndStr = (String*)new String( pEndTxtNd->GetTxt().Copy( 0,
@@ -418,6 +425,10 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
pEndTxtNd->Erase( aEndIdx, pEnd->nContent.GetIndex() );
if( pEndTxtNd->GetpSwpHints() )
pEndTxtNd->GetpSwpHints()->DeRegister();
+
+ // METADATA: store
+ bool emptied( pEndStr->Len() && !pEndTxtNd->Len() );
+ m_pMetadataUndoEnd = pEndTxtNd->CreateUndo( emptied );
}
// sind es nur zwei Nodes, dann ist schon alles erledigt.
@@ -698,8 +709,12 @@ void SwUndoDelete::Undo( SwUndoIter& rUndoIter )
lcl_ReAnchorAtCntntFlyFrames( *pDoc->GetSpzFrmFmts(), aPos, nOldIdx );
pTxtNd = aPos.nNode.GetNode().GetTxtNode();
}
- if( pTxtNd ) // Robust
+ if( pTxtNd )
+ {
pTxtNd->Insert( *pEndStr, aPos.nContent, INS_NOHINTEXPAND );
+ // METADATA: restore
+ pTxtNd->RestoreMetadata(m_pMetadataUndoEnd);
+ }
}
else if( pSttStr && bNodeMove )
{
@@ -757,7 +772,7 @@ void SwUndoDelete::Undo( SwUndoIter& rUndoIter )
}
else
{
- aPos = aCopyIndex;
+ aPos = SwPosition( aCopyIndex );
nMoveIndex = aPos.nNode.GetIndex() + nReplaceDummy + 1;
}
SwNodeIndex aMvIdx( pDoc->GetNodes(), nMoveIndex );
@@ -790,12 +805,14 @@ void SwUndoDelete::Undo( SwUndoIter& rUndoIter )
// -> im StartNode steht noch der Rest vom Join => loeschen
aPos.nContent.Assign( pTxtNd, nSttCntnt );
pTxtNd->Insert( *pSttStr, aPos.nContent, INS_NOHINTEXPAND );
+ // METADATA: restore
+ pTxtNd->RestoreMetadata(m_pMetadataUndoStart);
}
}
if( pHistory )
{
- pHistory->TmpRollback( pDoc, nSetPos, FALSE );
+ pHistory->TmpRollback( pDoc, nSetPos, false );
if( nSetPos ) // es gab Fussnoten/FlyFrames
{
// gibts ausser diesen noch andere ?
diff --git a/sw/source/core/undo/undo.hrc b/sw/source/core/undo/undo.hrc
index afd06130c042..87e49ec0d377 100644
--- a/sw/source/core/undo/undo.hrc
+++ b/sw/source/core/undo/undo.hrc
@@ -153,9 +153,11 @@
#define STR_UNDO_ROW_DELETE (CORE_REPEAT_END +64)
#define STR_UNDO_PAGEDESC_RENAME (CORE_REPEAT_END +65)
#define STR_NUMDOWN (CORE_REPEAT_END +66)
+#define STR_UNDO_FLYFRMFMT_TITLE (CORE_REPEAT_END +67)
+#define STR_UNDO_FLYFRMFMT_DESCRITPTION (CORE_REPEAT_END +68)
// !!!!!! umsetzen !!!!!!!!!!! umsetzen !!!!!!!!!!! umsetzen !!!!
-#define CORE_UNDO_END STR_NUMDOWN// !!!! umsetzen !!!
+#define CORE_UNDO_END STR_UNDO_FLYFRMFMT_DESCRITPTION// !!!! umsetzen !!!
// UI-Undo Klammerungen
#define UI_UNDO_BEGIN (CORE_UNDO_END + 1)
diff --git a/sw/source/core/undo/undo.src b/sw/source/core/undo/undo.src
index 6d184240e5fc..6437d9f60306 100644
--- a/sw/source/core/undo/undo.src
+++ b/sw/source/core/undo/undo.src
@@ -650,3 +650,11 @@ String STR_PARAGRAPH_UNDO
{
Text[ en-US ] = "paragraph";
};
+String STR_UNDO_FLYFRMFMT_TITLE
+{
+ Text[ en-US ] = "Change object title of $1";
+};
+String STR_UNDO_FLYFRMFMT_DESCRITPTION
+{
+ Text[ en-US ] = "Change object description of $1";
+};
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 11611d179407..cac772598a70 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -540,7 +540,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
SwTxtAttr* pFtnHnt = pTxtNd->GetTxtAttr( nFtnSttIdx );
ASSERT( pFtnHnt, "kein FtnAttribut" );
SwIndex aIdx( pTxtNd, nFtnSttIdx );
- pHistory->Add( pFtnHnt, pTxtNd->GetIndex(), FALSE );
+ pHistory->Add( pFtnHnt, pTxtNd->GetIndex(), false );
pTxtNd->Erase( aIdx, 1 );
}
@@ -563,7 +563,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
SwTxtAttr* pFtnHnt = pTxtNd->GetTxtAttr( nFtnSttIdx );
ASSERT( pFtnHnt, "kein FtnAttribut" );
SwIndex aIdx( pTxtNd, nFtnSttIdx );
- pHistory->Add( pFtnHnt, pTxtNd->GetIndex(), FALSE );
+ pHistory->Add( pFtnHnt, pTxtNd->GetIndex(), false );
pTxtNd->Erase( aIdx, 1 );
}
}
@@ -600,7 +600,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
SwTxtNode* pTxtNd = pDoc->GetNodes()[ pAPos->nNode]->GetTxtNode();
SwTxtAttr* pFlyHnt = pTxtNd->GetTxtAttr( pAPos->nContent.GetIndex());
ASSERT( pFlyHnt, "kein FlyAttribut" );
- pHistory->Add( pFlyHnt, 0, FALSE );
+ pHistory->Add( pFlyHnt, 0, false );
// n wieder zurueck, damit nicht ein Format uebesprungen wird !
n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1;
}
@@ -734,28 +734,43 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
}
else
{
- bool bMaybe = false;
- if( *pStt <= pBkmk->GetMarkPos() && pBkmk->GetMarkPos() <= *pEnd )
+ // --> OD 2009-08-06 #i92125#
+ bool bKeepCrossRefBkmk( false );
{
- if( pBkmk->GetMarkPos() == *pEnd ||
- ( *pStt == pBkmk->GetMarkPos() && pBkmk->IsExpanded() ) )
- bMaybe = true;
- else
- bSavePos = true;
+ if ( rMark.nNode == rPoint.nNode &&
+ ( IDocumentMarkAccess::GetType(*pBkmk) ==
+ IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK ||
+ IDocumentMarkAccess::GetType(*pBkmk) ==
+ IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
+ {
+ bKeepCrossRefBkmk = true;
+ }
}
- if( pBkmk->IsExpanded() &&
- *pStt <= pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() <= *pEnd )
+ if ( !bKeepCrossRefBkmk )
{
- if( bSavePos || bSaveOtherPos ||
- ( pBkmk->GetOtherMarkPos() < *pEnd && pBkmk->GetOtherMarkPos() > *pStt ) )
+ bool bMaybe = false;
+ if ( *pStt <= pBkmk->GetMarkPos() && pBkmk->GetMarkPos() <= *pEnd )
{
- if( bMaybe )
+ if( pBkmk->GetMarkPos() == *pEnd ||
+ ( *pStt == pBkmk->GetMarkPos() && pBkmk->IsExpanded() ) )
+ bMaybe = true;
+ else
bSavePos = true;
- bSaveOtherPos = true;
+ }
+ if( pBkmk->IsExpanded() &&
+ *pStt <= pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() <= *pEnd )
+ {
+ if( bSavePos || bSaveOtherPos ||
+ ( pBkmk->GetOtherMarkPos() < *pEnd && pBkmk->GetOtherMarkPos() > *pStt ) )
+ {
+ if( bMaybe )
+ bSavePos = true;
+ bSaveOtherPos = true;
+ }
}
}
- // delete cross-reference bookmark at <pStt>, if only part of
- // <pEnd> text node content is deleted.
+ // <--
+
// --> OD 2007-10-17 #i81002#
const bool bDifferentTxtNodesAtMarkAndPoint(
rMark.nNode != rPoint.nNode &&
@@ -765,6 +780,8 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
if( !bSavePos && !bSaveOtherPos && bDifferentTxtNodesAtMarkAndPoint &&
dynamic_cast< const ::sw::mark::CrossRefBookmark* >(pBkmk))
{
+ // delete cross-reference bookmark at <pStt>, if only part of
+ // <pEnd> text node content is deleted.
if( pStt->nNode == pBkmk->GetMarkPos().nNode &&
pEnd->nContent.GetIndex() !=
pEnd->nNode.GetNode().GetTxtNode()->Len() )
diff --git a/sw/source/core/undo/undoflystrattr.cxx b/sw/source/core/undo/undoflystrattr.cxx
new file mode 100644
index 000000000000..767f300a53b0
--- /dev/null
+++ b/sw/source/core/undo/undoflystrattr.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SwUndoPageDesc.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <undoflystrattr.hxx>
+#include <frmfmt.hxx>
+
+SwUndoFlyStrAttr::SwUndoFlyStrAttr( SwFlyFrmFmt& rFlyFrmFmt,
+ const SwUndoId eUndoId,
+ const String& sOldStr,
+ const String& sNewStr )
+ : SwUndo( eUndoId ),
+ mrFlyFrmFmt( rFlyFrmFmt ),
+ msOldStr( sOldStr ),
+ msNewStr( sNewStr )
+{
+ ASSERT( eUndoId == UNDO_FLYFRMFMT_TITLE ||
+ eUndoId == UNDO_FLYFRMFMT_DESCRIPTION,
+ "<SwUndoFlyStrAttr::SwUndoFlyStrAttr(..)> - unexpected undo id --> Undo will not work" );
+}
+
+SwUndoFlyStrAttr::~SwUndoFlyStrAttr()
+{
+}
+
+void SwUndoFlyStrAttr::Undo( SwUndoIter& )
+{
+ switch ( GetId() )
+ {
+ case UNDO_FLYFRMFMT_TITLE:
+ {
+ mrFlyFrmFmt.SetObjTitle( msOldStr, true );
+ }
+ break;
+ case UNDO_FLYFRMFMT_DESCRIPTION:
+ {
+ mrFlyFrmFmt.SetObjDescription( msOldStr, true );
+ }
+ break;
+ default:
+ {
+ }
+ }
+}
+
+void SwUndoFlyStrAttr::Redo( SwUndoIter& )
+{
+ switch ( GetId() )
+ {
+ case UNDO_FLYFRMFMT_TITLE:
+ {
+ mrFlyFrmFmt.SetObjTitle( msNewStr, true );
+ }
+ break;
+ case UNDO_FLYFRMFMT_DESCRIPTION:
+ {
+ mrFlyFrmFmt.SetObjDescription( msNewStr, true );
+ }
+ break;
+ default:
+ {
+ }
+ }
+}
+
+void SwUndoFlyStrAttr::Repeat( SwUndoIter& )
+{
+ // no repeat
+}
+
+SwRewriter SwUndoFlyStrAttr::GetRewriter() const
+{
+ SwRewriter aResult;
+
+ aResult.AddRule( UNDO_ARG1, mrFlyFrmFmt.GetName() );
+
+ return aResult;
+}
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 41a9ef71647c..1335844c7ff9 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -66,11 +66,14 @@ using namespace ::com::sun::star;
class _UnReplaceData : private SwUndoSaveCntnt
{
- String sOld, sIns;
- ULONG nSttNd, nEndNd, nOffset;
- xub_StrLen nSttCnt, nEndCnt, nSetPos, nSelEnd;
- BOOL bSplitNext : 1;
- BOOL bRegExp : 1;
+ String m_sOld, m_sIns;
+ ULONG m_nSttNd, m_nEndNd, m_nOffset;
+ xub_StrLen m_nSttCnt, m_nEndCnt, m_nSetPos, m_nSelEnd;
+ BOOL m_bSplitNext : 1;
+ BOOL m_bRegExp : 1;
+ // metadata references for paragraph and following para (if m_bSplitNext)
+ ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
+ ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
public:
_UnReplaceData( const SwPaM& rPam, const String& rIns, BOOL bRegExp );
@@ -80,8 +83,8 @@ public:
void Redo( SwUndoIter& rIter );
void SetEnd( const SwPaM& rPam );
- const String & GetOld() const { return sOld; }
- const String & GetIns() const { return sIns; }
+ const String & GetOld() const { return m_sOld; }
+ const String & GetIns() const { return m_sIns; }
};
@@ -626,20 +629,18 @@ void SwUndoReplace::SetEntryEnd( const SwPaM& rPam )
_UnReplaceData::_UnReplaceData( const SwPaM& rPam, const String& rIns,
BOOL bRgExp )
- : sIns( rIns ), nOffset( 0 )
+ : m_sIns( rIns ), m_nOffset( 0 )
{
- bRegExp = bRgExp;
+ m_bRegExp = bRgExp;
- const SwPosition *pStt = rPam.Start(),
- *pEnd = rPam.GetPoint() == pStt
- ? rPam.GetMark()
- : rPam.GetPoint();
+ const SwPosition * pStt( rPam.Start() );
+ const SwPosition * pEnd( rPam.End() );
- nSttNd = nEndNd = pStt->nNode.GetIndex();
- nSttCnt = pStt->nContent.GetIndex();
- nSelEnd = nEndCnt = pEnd->nContent.GetIndex();
+ m_nSttNd = m_nEndNd = pStt->nNode.GetIndex();
+ m_nSttCnt = pStt->nContent.GetIndex();
+ m_nSelEnd = m_nEndCnt = pEnd->nContent.GetIndex();
- bSplitNext = nSttNd != pEnd->nNode.GetIndex();
+ m_bSplitNext = m_nSttNd != pEnd->nNode.GetIndex();
SwTxtNode* pNd = pStt->nNode.GetNode().GetTxtNode();
ASSERT( pNd, "wo ist der TextNode" );
@@ -647,16 +648,18 @@ _UnReplaceData::_UnReplaceData( const SwPaM& rPam, const String& rIns,
pHistory = new SwHistory;
DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() );
- nSetPos = pHistory->Count();
+ m_nSetPos = pHistory->Count();
ULONG nNewPos = pStt->nNode.GetIndex();
- nOffset = nSttNd - nNewPos;
+ m_nOffset = m_nSttNd - nNewPos;
- if( pNd->GetpSwpHints() )
+ if ( pNd->GetpSwpHints() )
+ {
pHistory->CopyAttr( pNd->GetpSwpHints(), nNewPos, 0,
- pNd->GetTxt().Len(), TRUE );
+ pNd->GetTxt().Len(), true );
+ }
- if( bSplitNext )
+ if ( m_bSplitNext )
{
if( pNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pNd->GetpSwAttrSet(), nNewPos );
@@ -665,17 +668,21 @@ _UnReplaceData::_UnReplaceData( const SwPaM& rPam, const String& rIns,
SwTxtNode* pNext = pEnd->nNode.GetNode().GetTxtNode();
ULONG nTmp = pNext->GetIndex();
pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0,
- pNext->GetTxt().Len(), TRUE );
+ pNext->GetTxt().Len(), true );
if( pNext->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pNext->GetpSwAttrSet(), nTmp );
pHistory->Add( pNext->GetTxtColl(),nTmp, ND_TEXTNODE );
+ // METADATA: store
+ m_pMetadataUndoStart = pNd ->CreateUndo();
+ m_pMetadataUndoEnd = pNext->CreateUndo();
}
if( !pHistory->Count() )
delete pHistory, pHistory = 0;
- xub_StrLen nECnt = bSplitNext ? pNd->GetTxt().Len() : pEnd->nContent.GetIndex();
- sOld = pNd->GetTxt().Copy( nSttCnt, nECnt - nSttCnt );
+ xub_StrLen nECnt = m_bSplitNext ? pNd->GetTxt().Len()
+ : pEnd->nContent.GetIndex();
+ m_sOld = pNd->GetTxt().Copy( m_nSttCnt, nECnt - m_nSttCnt );
}
_UnReplaceData::~_UnReplaceData()
@@ -688,72 +695,68 @@ void _UnReplaceData::Undo( SwUndoIter& rIter )
SwPaM& rPam = *rIter.pAktPam;
rPam.DeleteMark();
- SwTxtNode* pNd = pDoc->GetNodes()[ nSttNd - nOffset ]->GetTxtNode();
+ SwTxtNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTxtNode();
ASSERT( pNd, "Wo ist der TextNode geblieben?" )
SwAutoCorrExceptWord* pACEWord = pDoc->GetAutoCorrExceptWord();
if( pACEWord )
{
- if( 1 == sIns.Len() && 1 == sOld.Len() )
+ if( 1 == m_sIns.Len() && 1 == m_sOld.Len() )
{
- SwPosition aPos( *pNd ); aPos.nContent.Assign( pNd, nSttCnt );
- pACEWord->CheckChar( aPos, sOld.GetChar( 0 ) );
+ SwPosition aPos( *pNd ); aPos.nContent.Assign( pNd, m_nSttCnt );
+ pACEWord->CheckChar( aPos, m_sOld.GetChar( 0 ) );
}
pDoc->SetAutoCorrExceptWord( 0 );
}
- SwIndex aIdx( pNd, nSttCnt );
- if( nSttNd == nEndNd )
+ SwIndex aIdx( pNd, m_nSttCnt );
+ if( m_nSttNd == m_nEndNd )
{
- pNd->Erase( aIdx, sIns.Len() );
-/* if( bSplitNext )
- {
- SwPosition aPos( *pNd, aIdx );
- pDoc->SplitNode( aPos, FALSE );
- pNd = pDoc->GetNodes()[ nSttNd - nOffset ]->GetTxtNode();
- aIdx.Assign( pNd, nSttCnt );
- }
-*/ }
+ pNd->Erase( aIdx, m_sIns.Len() );
+ }
else
{
rPam.GetPoint()->nNode = *pNd;
- rPam.GetPoint()->nContent.Assign( pNd, nSttCnt );
+ rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
rPam.SetMark();
- rPam.GetPoint()->nNode = nEndNd - nOffset;
- rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), nEndCnt );
+ rPam.GetPoint()->nNode = m_nEndNd - m_nOffset;
+ rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), m_nEndCnt );
pDoc->DeleteAndJoin( rPam );
rPam.DeleteMark();
pNd = rPam.GetNode()->GetTxtNode();
ASSERT( pNd, "Wo ist der TextNode geblieben?" );
- aIdx.Assign( pNd, nSttCnt );
+ aIdx.Assign( pNd, m_nSttCnt );
}
- if( bSplitNext )
+ if( m_bSplitNext )
{
SwPosition aPos( *pNd, aIdx );
pDoc->SplitNode( aPos, false );
- pNd = pDoc->GetNodes()[ nSttNd - nOffset ]->GetTxtNode();
- aIdx.Assign( pNd, nSttCnt );
+ pNd->RestoreMetadata(m_pMetadataUndoEnd);
+ pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTxtNode();
+ aIdx.Assign( pNd, m_nSttCnt );
+ // METADATA: restore
+ pNd->RestoreMetadata(m_pMetadataUndoStart);
}
- if( sOld.Len() )
- pNd->Insert( sOld, aIdx );
+ if( m_sOld.Len() )
+ pNd->Insert( m_sOld, aIdx );
if( pHistory )
{
if( pNd->GetpSwpHints() )
pNd->ClearSwpHintsArr( true );
- pHistory->TmpRollback( pDoc, nSetPos, FALSE );
- if( nSetPos ) // es gab Fussnoten/FlyFrames
+ pHistory->TmpRollback( pDoc, m_nSetPos, false );
+ if ( m_nSetPos ) // there were footnotes/FlyFrames
{
// gibts ausser diesen noch andere ?
- if( nSetPos < pHistory->Count() )
+ if( m_nSetPos < pHistory->Count() )
{
// dann sicher die Attribute anderen Attribute
SwHistory aHstr;
- aHstr.Move( 0, pHistory, nSetPos );
+ aHstr.Move( 0, pHistory, m_nSetPos );
pHistory->Rollback( pDoc );
pHistory->Move( 0, &aHstr );
}
@@ -765,7 +768,7 @@ void _UnReplaceData::Undo( SwUndoIter& rIter )
}
}
- rPam.GetPoint()->nNode = nSttNd;
+ rPam.GetPoint()->nNode = m_nSttNd;
rPam.GetPoint()->nContent = aIdx;
}
@@ -777,18 +780,18 @@ void _UnReplaceData::Redo( SwUndoIter& rIter )
SwPaM& rPam = *rIter.pAktPam;
rPam.DeleteMark();
- rPam.GetPoint()->nNode = nSttNd;
+ rPam.GetPoint()->nNode = m_nSttNd;
SwTxtNode* pNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
ASSERT( pNd, "Wo ist der TextNode geblieben?" )
- rPam.GetPoint()->nContent.Assign( pNd, nSttCnt );
+ rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
rPam.SetMark();
- if( bSplitNext )
+ if( m_bSplitNext )
{
- rPam.GetPoint()->nNode = nSttNd + 1;
+ rPam.GetPoint()->nNode = m_nSttNd + 1;
pNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
}
- rPam.GetPoint()->nContent.Assign( pNd, nSelEnd );
+ rPam.GetPoint()->nContent.Assign( pNd, m_nSelEnd );
if( pHistory )
{
@@ -796,7 +799,7 @@ void _UnReplaceData::Redo( SwUndoIter& rIter )
SwHistory aHst;
pHistory = &aHst;
DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() );
- nSetPos = pHistory->Count();
+ m_nSetPos = pHistory->Count();
pHistory = pSave;
pHistory->Move( 0, &aHst );
@@ -805,12 +808,12 @@ void _UnReplaceData::Redo( SwUndoIter& rIter )
{
pHistory = new SwHistory;
DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() );
- nSetPos = pHistory->Count();
- if( !nSetPos )
+ m_nSetPos = pHistory->Count();
+ if( !m_nSetPos )
delete pHistory, pHistory = 0;
}
- rDoc.Replace( rPam, sIns, bRegExp );
+ rDoc.Replace( rPam, m_sIns, m_bRegExp );
rPam.DeleteMark();
rDoc.DoUndo( bUndo );
}
@@ -821,8 +824,8 @@ void _UnReplaceData::SetEnd( const SwPaM& rPam )
{
// es wurden mehrere Absaetze eingefuegt
const SwPosition* pEnd = rPam.End();
- nEndNd = nOffset + pEnd->nNode.GetIndex();
- nEndCnt = pEnd->nContent.GetIndex();
+ m_nEndNd = m_nOffset + pEnd->nNode.GetIndex();
+ m_nEndCnt = pEnd->nContent.GetIndex();
}
}
@@ -1087,10 +1090,12 @@ void SwUndoInsertLabel::SetFlys( SwFrmFmt& rOldFly, SfxItemSet& rChgSet,
{
if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
{
- _UndoFmtAttr aTmp( rOldFly, FALSE );
+ SwUndoFmtAttrHelper aTmp( rOldFly, false );
rOldFly.SetFmtAttr( rChgSet );
- if( aTmp.pUndo )
- OBJECT.pUndoAttr = aTmp.pUndo;
+ if ( aTmp.GetUndo() )
+ {
+ OBJECT.pUndoAttr = aTmp.ReleaseUndo();
+ }
OBJECT.pUndoFly = new SwUndoInsLayFmt( &rNewFly,0,0 );
}
}
diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx
index 067f6fda63c1..269f8de3cd63 100644
--- a/sw/source/core/undo/unmove.cxx
+++ b/sw/source/core/undo/unmove.cxx
@@ -62,18 +62,22 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos )
if( pTxtNd )
{
pHistory->Add( pTxtNd->GetTxtColl(), nSttNode, ND_TEXTNODE );
- if( pTxtNd->GetpSwpHints() )
+ if ( pTxtNd->GetpSwpHints() )
+ {
pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nSttNode,
- 0, pTxtNd->GetTxt().Len(), FALSE );
+ 0, pTxtNd->GetTxt().Len(), false );
+ }
if( pTxtNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pTxtNd->GetpSwAttrSet(), nSttNode );
}
if( pEndTxtNd && pEndTxtNd != pTxtNd )
{
pHistory->Add( pEndTxtNd->GetTxtColl(), nEndNode, ND_TEXTNODE );
- if( pEndTxtNd->GetpSwpHints() )
+ if ( pEndTxtNd->GetpSwpHints() )
+ {
pHistory->CopyAttr( pEndTxtNd->GetpSwpHints(), nEndNode,
- 0, pEndTxtNd->GetTxt().Len(), FALSE );
+ 0, pEndTxtNd->GetTxt().Len(), false );
+ }
if( pEndTxtNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pEndTxtNd->GetpSwAttrSet(), nEndNode );
}
@@ -81,9 +85,11 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos )
if( 0 != (pTxtNd = rRange.GetDoc()->GetNodes()[ rMvPos.nNode ]->GetTxtNode() ))
{
pHistory->Add( pTxtNd->GetTxtColl(), nMvDestNode, ND_TEXTNODE );
- if( pTxtNd->GetpSwpHints() )
+ if ( pTxtNd->GetpSwpHints() )
+ {
pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nMvDestNode,
- 0, pTxtNd->GetTxt().Len(), FALSE );
+ 0, pTxtNd->GetTxt().Len(), false );
+ }
if( pTxtNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pTxtNd->GetpSwAttrSet(), nMvDestNode );
}
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index a1d126e751cf..e01c2debaf56 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -97,7 +97,7 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos,
pHistory = new SwHistory;
SwRegHistory aRHst( *pTxtNd, pHistory );
pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nSttNode, 0,
- nTxtNdLen, FALSE );
+ nTxtNdLen, false );
rPos.nContent++;
bInsChar = FALSE;
}
@@ -254,7 +254,7 @@ void SwUndoOverwrite::Undo( SwUndoIter& rUndoIter )
{
if( pTxtNd->GetpSwpHints() )
pTxtNd->ClearSwpHintsArr( false );
- pHistory->TmpRollback( pDoc, 0, FALSE );
+ pHistory->TmpRollback( pDoc, 0, false );
}
if( pAktPam->GetMark()->nContent.GetIndex() != nSttCntnt )
@@ -420,7 +420,7 @@ void SwUndoTransliterate::Repeat( SwUndoIter& rUndoIter )
rUndoIter.pLastUndoObj = this;
}
-void SwUndoTransliterate::AddChanges( const SwTxtNode& rTNd,
+void SwUndoTransliterate::AddChanges( SwTxtNode& rTNd,
xub_StrLen nStart, xub_StrLen nLen,
uno::Sequence <sal_Int32>& rOffsets )
{
@@ -485,7 +485,7 @@ void SwUndoTransliterate::AddChanges( const SwTxtNode& rTNd,
pNew->pHistory = new SwHistory;
SwRegHistory aRHst( rTNd, pNew->pHistory );
pNew->pHistory->CopyAttr( rTNd.GetpSwpHints(),
- pNew->nNdIdx, 0, rTNd.GetTxt().Len(), FALSE );
+ pNew->nNdIdx, 0, rTNd.GetTxt().Len(), false );
}
break;
}
@@ -511,7 +511,7 @@ void _UndoTransliterate_Data::SetChangeAtNode( SwDoc& rDoc )
{
if( pTNd->GetpSwpHints() )
pTNd->ClearSwpHintsArr( false );
- pHistory->TmpRollback( &rDoc, 0, FALSE );
+ pHistory->TmpRollback( &rDoc, 0, false );
pHistory->SetTmpEnd( pHistory->Count() );
}
}
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index 36f5f549562b..f26643a09352 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -167,8 +167,10 @@ void SwUndoInsSection::Undo( SwUndoIter& rUndoIter )
if( bSplitAtEnd )
Join( rDoc, nEndNode );
- if( pHistory )
- pHistory->TmpRollback( &rDoc, 0, FALSE );
+ if ( pHistory )
+ {
+ pHistory->TmpRollback( &rDoc, 0, false );
+ }
if( bUpdateFtn )
rDoc.GetFtnIdxs().UpdateFtn( aIdx );
@@ -265,7 +267,7 @@ void SwUndoInsSection::SaveSplitNode( SwTxtNode* pTxtNd, BOOL bAtStt )
if( !pHistory )
pHistory = new SwHistory;
pHistory->CopyAttr( pTxtNd->GetpSwpHints(), pTxtNd->GetIndex(), 0,
- pTxtNd->GetTxt().Len(), FALSE );
+ pTxtNd->GetTxt().Len(), false );
}
if( bAtStt )
diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx
index 96b0daf6a5df..31d2243c6b6c 100644
--- a/sw/source/core/undo/unspnd.cxx
+++ b/sw/source/core/undo/unspnd.cxx
@@ -66,7 +66,7 @@ SwUndoSplitNode::SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos,
{
pHistory = new SwHistory;
pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nNode, 0,
- pTxtNd->GetTxt().Len(), FALSE );
+ pTxtNd->GetTxt().Len(), false );
if( !pHistory->Count() )
DELETEZ( pHistory );
}
@@ -155,7 +155,7 @@ void SwUndoSplitNode::Undo( SwUndoIter& rUndoIter )
rPam.GetPoint()->nContent = pTNd->GetTxt().Len();
pDoc->RstTxtAttrs( rPam, TRUE );
- pHistory->TmpRollback( pDoc, 0, FALSE );
+ pHistory->TmpRollback( pDoc, 0, false );
}
}
}
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index c96067b13bfd..51735c70b217 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -63,9 +63,7 @@
#include <node2lay.hxx>
#include <tblrwcl.hxx>
#include <fmtanchr.hxx>
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
#include <unochart.hxx>
#ifndef DBG_UTIL
@@ -215,13 +213,16 @@ So we need to remember not only the start node position but the end node positio
struct SwTblToTxtSave
{
- ULONG nNode;
- ULONG nEndNd;
- xub_StrLen nCntnt;
- SwHistory* pHstry;
+ ULONG m_nSttNd;
+ ULONG m_nEndNd;
+ xub_StrLen m_nCntnt;
+ SwHistory* m_pHstry;
+ // metadata references for first and last paragraph in cell
+ ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
+ ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
SwTblToTxtSave( SwDoc& rDoc, ULONG nNd, ULONG nEndIdx, xub_StrLen nCntnt );
- ~SwTblToTxtSave() { delete pHstry; }
+ ~SwTblToTxtSave() { delete m_pHstry; }
};
SV_IMPL_PTRARR( SfxItemSets, SfxItemSetPtr )
@@ -387,26 +388,41 @@ SwRewriter SwUndoInsTbl::GetRewriter() const
// -----------------------------------------------------
SwTblToTxtSave::SwTblToTxtSave( SwDoc& rDoc, ULONG nNd, ULONG nEndIdx, xub_StrLen nCnt )
- : nNode( nNd ), nEndNd( nEndIdx), nCntnt( nCnt ), pHstry( 0 )
+ : m_nSttNd( nNd ), m_nEndNd( nEndIdx), m_nCntnt( nCnt ), m_pHstry( 0 )
{
// Attributierung des gejointen Node merken.
- if( USHRT_MAX != nCnt )
- ++nNd;
-
SwTxtNode* pNd = rDoc.GetNodes()[ nNd ]->GetTxtNode();
if( pNd )
{
- pHstry = new SwHistory;
+ m_pHstry = new SwHistory;
- pHstry->Add( pNd->GetTxtColl(), nNd, ND_TEXTNODE );
- if( pNd->GetpSwpHints() )
- pHstry->CopyAttr( pNd->GetpSwpHints(), nNd, 0,
- pNd->GetTxt().Len(), FALSE );
+ m_pHstry->Add( pNd->GetTxtColl(), nNd, ND_TEXTNODE );
+ if ( pNd->GetpSwpHints() )
+ {
+ m_pHstry->CopyAttr( pNd->GetpSwpHints(), nNd, 0,
+ pNd->GetTxt().Len(), false );
+ }
if( pNd->HasSwAttrSet() )
- pHstry->CopyFmtAttr( *pNd->GetpSwAttrSet(), nNd );
+ m_pHstry->CopyFmtAttr( *pNd->GetpSwAttrSet(), nNd );
- if( !pHstry->Count() )
- delete pHstry, pHstry = 0;
+ if( !m_pHstry->Count() )
+ delete m_pHstry, m_pHstry = 0;
+
+ // METADATA: store
+ m_pMetadataUndoStart = pNd->CreateUndo();
+ }
+
+ // we also need to store the metadata reference of the _last_ paragraph
+ // we subtract 1 to account for the removed cell start/end node pair
+ // (after SectionUp, the end of the range points to the node after the cell)
+ if ( nEndIdx - 1 > nNd )
+ {
+ SwTxtNode* pLastNode( rDoc.GetNodes()[ nEndIdx - 1 ]->GetTxtNode() );
+ if( pLastNode )
+ {
+ // METADATA: store
+ m_pMetadataUndoEnd = pLastNode->CreateUndo();
+ }
}
}
@@ -433,7 +449,7 @@ SwUndoTblToTxt::SwUndoTblToTxt( const SwTable& rTbl, sal_Unicode cCh )
for( USHORT n = 0; n < rFrmFmtTbl.Count(); ++n )
{
const SwPosition* pAPos;
- const SwFrmFmt* pFmt = rFrmFmtTbl[ n ];
+ SwFrmFmt* pFmt = rFrmFmtTbl[ n ];
const SwFmtAnchor* pAnchor = &pFmt->GetAnchor();
if( 0 != ( pAPos = pAnchor->GetCntntAnchor()) &&
( FLY_AUTO_CNTNT == pAnchor->GetAnchorId() ||
@@ -562,22 +578,24 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd,
for( USHORT n = rSavedData.Count(); n; )
{
SwTblToTxtSave* pSave = rSavedData[ --n ];
- aSttIdx = pSave->nNode;
+ // if the start node was merged with last from prev. cell,
+ // subtract 1 from index to get the merged paragraph, and split that
+ aSttIdx = pSave->m_nSttNd - ( ( USHRT_MAX != pSave->m_nCntnt ) ? 1 : 0);
SwTxtNode* pTxtNd = aSttIdx.GetNode().GetTxtNode();
- if( USHRT_MAX != pSave->nCntnt )
+ if( USHRT_MAX != pSave->m_nCntnt )
{
// an der ContentPosition splitten, das vorherige Zeichen
// loeschen (ist der Trenner!)
ASSERT( pTxtNd, "Wo ist der TextNode geblieben?" );
- SwIndex aCntPos( pTxtNd, pSave->nCntnt - 1 );
+ SwIndex aCntPos( pTxtNd, pSave->m_nCntnt - 1 );
pTxtNd->Erase( aCntPos, 1 );
SwCntntNode* pNewNd = pTxtNd->SplitCntntNode(
SwPosition( aSttIdx, aCntPos ));
if( aBkmkArr.Count() )
- _RestoreCntntIdx( aBkmkArr, *pNewNd, pSave->nCntnt,
- pSave->nCntnt + 1 );
+ _RestoreCntntIdx( aBkmkArr, *pNewNd, pSave->m_nCntnt,
+ pSave->m_nCntnt + 1 );
}
else
{
@@ -590,6 +608,8 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd,
if( pTxtNd )
{
+ // METADATA: restore
+ pTxtNd->GetTxtNode()->RestoreMetadata(pSave->m_pMetadataUndoStart);
if( pTxtNd->HasSwAttrSet() )
pTxtNd->ResetAllAttr();
@@ -597,14 +617,25 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd,
pTxtNd->ClearSwpHintsArr( false );
}
- if( pSave->pHstry )
+ if( pSave->m_pHstry )
{
- USHORT nTmpEnd = pSave->pHstry->GetTmpEnd();
- pSave->pHstry->TmpRollback( GetDoc(), 0 );
- pSave->pHstry->SetTmpEnd( nTmpEnd );
+ USHORT nTmpEnd = pSave->m_pHstry->GetTmpEnd();
+ pSave->m_pHstry->TmpRollback( GetDoc(), 0 );
+ pSave->m_pHstry->SetTmpEnd( nTmpEnd );
+ }
+
+ // METADATA: restore
+ // end points to node after cell
+ if ( pSave->m_nEndNd - 1 > pSave->m_nSttNd )
+ {
+ SwTxtNode* pLastNode = (*this)[ pSave->m_nEndNd - 1 ]->GetTxtNode();
+ if (pLastNode)
+ {
+ pLastNode->RestoreMetadata(pSave->m_pMetadataUndoEnd);
+ }
}
- aEndIdx = pSave->nEndNd;
+ aEndIdx = pSave->m_nEndNd;
SwStartNode* pSttNd = new SwStartNode( aSttIdx, ND_STARTNODE,
SwTableBoxStartNode );
pSttNd->pStartOfSection = pTblNd;
@@ -2229,11 +2260,10 @@ SwUndoTblNumFmt::SwUndoTblNumFmt( const SwTableBox& rBox,
pHistory = new SwHistory;
SwRegHistory aRHst( *rBox.GetSttNd(), pHistory );
- // immer alle TextAttribute sichern; ist fuers Undo mit voll-
- // staendiger Attributierung am besten, wegen den evt.
- // Ueberlappenden Bereichen von An/Aus.
+ // always save all text atttibutes because of possibly overlapping
+ // areas of on/off
pHistory->CopyAttr( pTNd->GetpSwpHints(), nNdPos, 0,
- pTNd->GetTxt().Len(), TRUE );
+ pTNd->GetTxt().Len(), true );
if( pTNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pTNd->GetpSwAttrSet(), nNdPos );
@@ -2827,7 +2857,8 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox,
}
else if( !rJoin ) // If the old part is empty and joined, we are finished
{ // if it is not joined, we have to delete this empty paragraph
- aCellEnd = SwNodeIndex( *rBox.GetSttNd()->EndOfSectionNode() );
+ aCellEnd = SwPosition(
+ SwNodeIndex( *rBox.GetSttNd()->EndOfSectionNode() ));
SwPaM aTmpPam( aDeleteStart, aCellEnd );
pUndo = new SwUndoDelete( aTmpPam, TRUE );
}
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 73e6151869b5..581e2185907e 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -59,7 +59,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
{
pTxtFmtColl = pTxtNd->GetTxtColl();
pHistory->CopyAttr( pTxtNd->GetpSwpHints(), nSttNode,
- 0, pTxtNd->GetTxt().Len(), FALSE );
+ 0, pTxtNd->GetTxt().Len(), false );
if( pTxtNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pTxtNd->GetpSwAttrSet(), nSttNode );
@@ -264,7 +264,7 @@ void SwUndoInserts::Undo( SwUndoIter& rUndoIter )
pTxtFmtColl = (SwTxtFmtColl*)pTxtNode->ChgFmtColl( pTxtFmtColl );
pHistory->SetTmpEnd( nSetPos );
- pHistory->TmpRollback( pDoc, 0, FALSE );
+ pHistory->TmpRollback( pDoc, 0, false );
}
}
@@ -288,7 +288,7 @@ void SwUndoInserts::Redo( SwUndoIter& rUndoIter )
pSavTxtFmtColl = ((SwTxtNode*)pCNd)->GetTxtColl();
pHistory->SetTmpEnd( nSetPos );
- pHistory->TmpRollback( pDoc, 0, FALSE );
+ pHistory->TmpRollback( pDoc, 0, false );
// alte Anfangs-Position fuers Rollback zurueckholen
if( ( nSttNode != nEndNode || nSttCntnt != nEndCntnt ) && pPos )
@@ -346,7 +346,7 @@ void SwUndoInserts::Repeat( SwUndoIter& rUndoIter )
SwPaM aPam( *rUndoIter.pAktPam->GetPoint() );
SetPaM( aPam );
- aPam.GetDoc()->Copy( aPam, *rUndoIter.pAktPam->GetPoint() );
+ aPam.GetDoc()->Copy( aPam, *rUndoIter.pAktPam->GetPoint(), false );
rUndoIter.pLastUndoObj = this;
}
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index d58f7f86cab3..a922c5334f3e 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -286,7 +286,7 @@ uno::Reference< beans::XPropertySetInfo > SwXBookmark::getPropertySetInfo(void)
static uno::Reference< beans::XPropertySetInfo > aRef;
if(!aRef.is())
{
- uno::Reference< beans::XPropertySetInfo > xInfo = aSwMapProvider.GetPropertySet(PROPERTY_MAP_BOOKMARK)->getPropertySetInfo();
+ aRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_BOOKMARK)->getPropertySetInfo();
}
return aRef;
}
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index b89163f60a3e..b09f4196d396 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -35,12 +35,8 @@
#include <algorithm>
-#ifndef _COM_SUN_STAR_CHART_DATAROWSOURCE_HPP_
#include <com/sun/star/chart/ChartDataRowSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CHART_DATAROWSOURCE_HPP_
#include <com/sun/star/chart2/data/LabelOrigin.hpp>
-#endif
#include <cppuhelper/interfacecontainer.hxx>
#include <vos/mutex.hxx>
#include <osl/mutex.hxx>
@@ -283,11 +279,9 @@ static String GetCellRangeName( SwFrmFmt &rTblFmt, SwUnoCrsr &rTblCrsr )
//!! see also SwXTextTableCursor::getRangeName
- SwUnoTableCrsr* pUnoTblCrsr = rTblCrsr;
-#if OSL_DEBUG_LEVEL > 1
+ SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(&rTblCrsr);
if (!pUnoTblCrsr)
return String();
-#endif
pUnoTblCrsr->MakeBoxSels();
const SwStartNode* pStart;
@@ -491,7 +485,8 @@ static void GetFormatAndCreateCursorFromRangeRep(
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pCrsr->MakeBoxSels();
if (ppUnoCrsr)
@@ -2064,9 +2059,8 @@ SwChartDataSequence::SwChartDataSequence(
// check if it can properly convert into a SwUnoTableCrsr
// which is required for some functions
- SwUnoTableCrsr* pUnoTblCrsr = *pTblCrsr;
- if (!pUnoTblCrsr)
- pUnoTblCrsr = *pTblCrsr;
+ SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
+ DBG_ASSERT(pUnoTblCrsr, "SwChartDataSequence: cursor not SwUnoTableCrsr");
#endif
}
@@ -2115,9 +2109,8 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
// check if it can properly convert into a SwUnoTableCrsr
// which is required for some functions
- SwUnoTableCrsr* pUnoTblCrsr = *pTblCrsr;
- if (!pUnoTblCrsr)
- pUnoTblCrsr = *pTblCrsr;
+ SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
+ DBG_ASSERT(pUnoTblCrsr, "SwChartDataSequence: cursor not SwUnoTableCrsr");
#endif
}
@@ -2779,7 +2772,7 @@ bool SwChartDataSequence::ExtendTo( bool bExtendCol,
{
bool bChanged = false;
- SwUnoTableCrsr* pUnoTblCrsr = *pTblCrsr;
+ SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
//pUnoTblCrsr->MakeBoxSels();
const SwStartNode *pStartNd = 0;
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index b17cf48f5d9f..4890f8c62920 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -806,10 +806,10 @@ XTextTable* SwXTextTables::GetObject( SwFrmFmt& rFmt )
******************************************************************/
namespace
{
- template<FlyCntType T> struct SwXFrameEnumeration_traits {};
+ template<FlyCntType T> struct UnoFrameWrap_traits {};
template<>
- struct SwXFrameEnumeration_traits<FLYCNTTYPE_FRM>
+ struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
{
typedef SwXTextFrame core_frame_t;
typedef XTextFrame uno_frame_t;
@@ -817,7 +817,7 @@ namespace
};
template<>
- struct SwXFrameEnumeration_traits<FLYCNTTYPE_GRF>
+ struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
{
typedef SwXTextGraphicObject core_frame_t;
typedef XTextContent uno_frame_t;
@@ -825,7 +825,7 @@ namespace
};
template<>
- struct SwXFrameEnumeration_traits<FLYCNTTYPE_OLE>
+ struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
{
typedef SwXTextEmbeddedObject core_frame_t;
typedef XEmbeddedObjectSupplier uno_frame_t;
@@ -833,6 +833,33 @@ namespace
};
template<FlyCntType T>
+ static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt)
+ {
+ SwXFrame* pFrm = static_cast<SwXFrame*>(SwClientIter(*pFmt).First(TYPE(SwXFrame)));
+ if(!pFrm)
+ pFrm = new typename UnoFrameWrap_traits<T>::core_frame_t(*pFmt);
+ Reference< typename UnoFrameWrap_traits<T>::uno_frame_t > xFrm =
+ static_cast< typename UnoFrameWrap_traits<T>::core_frame_t* >(pFrm);
+ return uno::makeAny(xFrm);
+ }
+
+ // runtime adapter for lcl_UnoWrapFrame
+ static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt, FlyCntType eType) throw(uno::RuntimeException())
+ {
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFmt);
+ case FLYCNTTYPE_GRF:
+ return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFmt);
+ case FLYCNTTYPE_OLE:
+ return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFmt);
+ default:
+ throw uno::RuntimeException();
+ }
+ }
+
+ template<FlyCntType T>
class SwXFrameEnumeration : public SwSimpleEnumerationBaseClass
{
private:
@@ -844,12 +871,12 @@ namespace
SwXFrameEnumeration(const SwDoc* const pDoc);
//XEnumeration
- virtual BOOL SAL_CALL hasMoreElements(void) throw( RuntimeException );
+ virtual sal_Bool SAL_CALL hasMoreElements(void) throw( RuntimeException );
virtual Any SAL_CALL nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException );
//XServiceInfo
virtual OUString SAL_CALL getImplementationName(void) throw( RuntimeException );
- virtual BOOL SAL_CALL supportsService(const OUString& ServiceName) throw( RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( RuntimeException );
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( RuntimeException );
};
}
@@ -860,31 +887,25 @@ SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc)
{
vos::OGuard aGuard(Application::GetSolarMutex());
const SwSpzFrmFmts* const pFmts = pDoc->GetSpzFrmFmts();
- const USHORT nSize = pFmts->Count();
+ if(!pFmts->Count())
+ return;
+ const SwFrmFmt* const pFmtsEnd = (*pFmts)[pFmts->Count()];
::std::insert_iterator<frmcontainer_t> pInserter = ::std::insert_iterator<frmcontainer_t>(m_aFrames, m_aFrames.begin());
- for( USHORT i=0; i < nSize; ++i )
+ for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
{
- SwFrmFmt* pFmt = (*pFmts)[i];
if(pFmt->Which() != RES_FLYFRMFMT)
continue;
const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
if(!pIdx || !pIdx->GetNodes().IsDocNodes())
continue;
const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
- if(SwXFrameEnumeration_traits<T>::filter(pNd))
- {
- SwXFrame* pFrm = (SwXFrame*)SwClientIter( *pFmt ).First( TYPE( SwXFrame ));
- if( !pFrm )
- pFrm = new typename SwXFrameEnumeration_traits<T>::core_frame_t(*pFmt);
- Reference< typename SwXFrameEnumeration_traits<T>::uno_frame_t > xFrm =
- static_cast< typename SwXFrameEnumeration_traits<T>::core_frame_t* >(pFrm);
- *pInserter++ = uno::makeAny(xFrm);
- }
+ if(UnoFrameWrap_traits<T>::filter(pNd))
+ *pInserter++ = lcl_UnoWrapFrame<T>(pFmt);
}
}
template<FlyCntType T>
-BOOL SwXFrameEnumeration<T>::hasMoreElements(void) throw( RuntimeException )
+sal_Bool SwXFrameEnumeration<T>::hasMoreElements(void) throw( RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
return !m_aFrames.empty();
@@ -908,7 +929,7 @@ OUString SwXFrameEnumeration<T>::getImplementationName(void) throw( RuntimeExcep
}
template<FlyCntType T>
-BOOL SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName) throw( RuntimeException )
+sal_Bool SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.container.XEnumeration") == ServiceName;
}
@@ -971,52 +992,48 @@ sal_Int32 SwXFrames::getCount(void) throw(uno::RuntimeException)
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
- const Reference<XEnumeration> xEnum = createEnumeration();
- sal_Int32 nCount = 0;
- while(xEnum->hasMoreElements())
- {
- xEnum->nextElement();
- ++nCount;
- }
- return nCount;
+ return GetDoc()->GetFlyCount(eType);
}
uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
throw(IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!IsValid()) throw uno::RuntimeException();
- if(nIndex < 0 || nIndex >= USHRT_MAX) throw IndexOutOfBoundsException();
- const Reference<XEnumeration> xEnum = createEnumeration();
- while(xEnum->hasMoreElements())
- {
- uno::Any aCurrent = xEnum->nextElement();
- if(nIndex-- == 0)
- return aCurrent;
- }
- throw IndexOutOfBoundsException();
+ if(!IsValid())
+ throw uno::RuntimeException();
+ if(nIndex < 0 || nIndex >= USHRT_MAX)
+ throw IndexOutOfBoundsException();
+ SwFrmFmt* pFmt = GetDoc()->GetFlyNum(static_cast<sal_uInt16>(nIndex), eType);
+ if(!pFmt)
+ throw IndexOutOfBoundsException();
+ return lcl_UnoWrapFrame(pFmt, eType);
}
uno::Any SwXFrames::getByName(const OUString& rName)
throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!IsValid()) throw uno::RuntimeException();
- const Reference<XEnumeration> xEnum = createEnumeration();
- while(xEnum->hasMoreElements())
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwFrmFmt* pFmt;
+ switch(eType)
{
- uno::Any aCurrent = xEnum->nextElement();
- Reference<container::XNamed> xNamed;
- aCurrent >>= xNamed;
- if(xNamed.is() && xNamed->getName() == rName)
- return aCurrent;
+ case FLYCNTTYPE_GRF:
+ pFmt = GetDoc()->FindFlyByName(rName, ND_GRFNODE);
+ case FLYCNTTYPE_OLE:
+ pFmt = GetDoc()->FindFlyByName(rName, ND_OLENODE);
+ default:
+ pFmt = GetDoc()->FindFlyByName(rName, ND_TEXTNODE);
}
- throw NoSuchElementException();
+ if(!pFmt)
+ throw NoSuchElementException();
+ return lcl_UnoWrapFrame(const_cast<SwFrmFmt*>(pFmt), eType);
}
uno::Sequence<OUString> SwXFrames::getElementNames(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!IsValid()) throw uno::RuntimeException();
+ if(!IsValid())
+ throw uno::RuntimeException();
const Reference<XEnumeration> xEnum = createEnumeration();
::std::vector<OUString> vNames;
while(xEnum->hasMoreElements())
@@ -1032,16 +1049,17 @@ uno::Sequence<OUString> SwXFrames::getElementNames(void) throw( uno::RuntimeExce
sal_Bool SwXFrames::hasByName(const OUString& rName) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!IsValid()) throw uno::RuntimeException();
- const Reference<XEnumeration> xEnum = createEnumeration();
- while(xEnum->hasMoreElements())
+ if(!IsValid())
+ throw uno::RuntimeException();
+ switch(eType)
{
- Reference<XNamed> xNamed;
- xEnum->nextElement() >>= xNamed;
- if(xNamed.is() && xNamed->getName() == rName)
- return true;
+ case FLYCNTTYPE_GRF:
+ return GetDoc()->FindFlyByName(rName, ND_GRFNODE) != NULL;
+ case FLYCNTTYPE_OLE:
+ return GetDoc()->FindFlyByName(rName, ND_OLENODE) != NULL;
+ default:
+ return GetDoc()->FindFlyByName(rName, ND_TEXTNODE) != NULL;
}
- return false;
}
uno::Type SAL_CALL SwXFrames::getElementType() throw(uno::RuntimeException)
@@ -1063,8 +1081,9 @@ uno::Type SAL_CALL SwXFrames::getElementType() throw(uno::RuntimeException)
sal_Bool SwXFrames::hasElements(void) throw(uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(IsValid()) throw uno::RuntimeException();
- return createEnumeration()->hasMoreElements();
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetFlyCount(eType) > 0;
}
SwXFrame* SwXFrames::GetObject(SwFrmFmt& rFmt, FlyCntType eType)
@@ -1650,9 +1669,9 @@ Sequence< OUString > SwXFootnotes::getSupportedServiceNames(void) throw( Runtime
/*-- 14.01.99 09:03:52---------------------------------------------------
-----------------------------------------------------------------------*/
-SwXFootnotes::SwXFootnotes(sal_Bool bEnd, SwDoc* _pDoc) :
- SwUnoCollection(_pDoc),
- bEndnote(bEnd)
+SwXFootnotes::SwXFootnotes(sal_Bool bEnd, SwDoc* _pDoc)
+ : SwUnoCollection(_pDoc)
+ , m_bEndnote(bEnd)
{
}
/*-- 14.01.99 09:03:52---------------------------------------------------
@@ -1676,7 +1695,7 @@ sal_Int32 SwXFootnotes::getCount(void) throw( uno::RuntimeException )
{
pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
- if ( rFtn.IsEndNote() != bEndnote )
+ if ( rFtn.IsEndNote() != m_bEndnote )
continue;
nCount++;
}
@@ -1700,7 +1719,7 @@ uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
{
pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
- if( rFtn.IsEndNote() != bEndnote )
+ if ( rFtn.IsEndNote() != m_bEndnote )
continue;
if(nCount == nIndex)
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 0d3b493af2f5..0db5039f6a31 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -585,9 +585,9 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
if(pSwNum)
{
+ SwDoc* pDoc = rPam.GetDoc();
if(pSwNum->GetNumRule())
{
- SwDoc* pDoc = rPam.GetDoc();
SwNumRule aRule(*pSwNum->GetNumRule());
const String* pNewCharStyles = pSwNum->GetNewCharStyleNames();
const String* pBulletFontNames = pSwNum->GetBulletFontNames();
@@ -680,7 +680,6 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
}
else if(pSwNum->GetCreatedNumRuleName().Len())
{
- SwDoc* pDoc = rPam.GetDoc();
UnoActionContext aAction(pDoc);
SwNumRule* pRule = pDoc->FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
if(!pRule)
@@ -690,6 +689,17 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
pDoc->SetNumRule( rPam, *pRule, false );
// <--
}
+ // --> OD 2009-08-18 #i103817#
+ // outline numbering
+ else
+ {
+ UnoActionContext aAction(pDoc);
+ SwNumRule* pRule = pDoc->GetOutlineNumRule();
+ if(!pRule)
+ throw RuntimeException();
+ pDoc->SetNumRule( rPam, *pRule, false );
+ }
+ // <--
}
}
else if(rValue.getValueType() == ::getVoidCppuType())
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 00b5a0ab88ae..1a14b5441eb6 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1971,12 +1971,12 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An
if (NULL != pDoc)
{
- SwPosition * pPos = GetPosition();
-
- ASSERT(pPos, "no position");
- pDoc->PutValueToField( *pPos, rValue, pEntry->nWID);
-
- delete pPos;
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if(!pTxtFld)
+ throw uno::RuntimeException();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ pDoc->PutValueToField( aPosition, rValue, pEntry->nWID);
}
// <- #111840#
}
@@ -2172,12 +2172,11 @@ uno::Any SwXTextField::getPropertyValue(const OUString& rPropertyName)
xub_StrLen nHiddenStart;
xub_StrLen nHiddenEnd;
- SwPosition *pPos = pTxtFld->GetPosition();
- if (!pPos)
- throw uno::RuntimeException();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
- bHidden = SwScriptInfo::GetBoundsOfHiddenRange( rTxtNode,
- pPos->nContent.GetIndex(),
+ bHidden = SwScriptInfo::GetBoundsOfHiddenRange( pTxtFld->GetTxtNode(),
+ *pTxtFld->GetStart(),
nHiddenStart, nHiddenEnd );
}
@@ -2477,23 +2476,6 @@ const SwField* SwXTextField::GetField() const
return 0;
}
-// #111840#
-SwPosition * SwXTextField::GetPosition()
-{
- SwPosition * pResult = NULL;
- const SwFmtFld * pFmtFld2 = GetFldFmt();
-
- if (pFmtFld2)
- {
- const SwTxtFld * pTxtFld = pFmtFld2->GetTxtFld();
-
- if (pTxtFld)
- pResult = pTxtFld->GetPosition();
- }
-
- return pResult;
-}
-
/******************************************************************
*
******************************************************************/
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index f7b5fe716a59..7237cb59ed02 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1020,12 +1020,10 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
SwDoc* pDoc = pFmt->GetDoc();
- if( eType == FLYCNTTYPE_GRF &&
- (pEntry->nWID >= RES_GRFATR_BEGIN &&
- pEntry->nWID < RES_GRFATR_END)||
- pEntry->nWID == FN_PARAM_COUNTOUR_PP ||
- pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
- pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
+ if ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) ||
+ (FN_PARAM_COUNTOUR_PP == pEntry->nWID) ||
+ (FN_UNO_IS_AUTOMATIC_CONTOUR == pEntry->nWID) ||
+ (FN_UNO_IS_PIXEL_CONTOUR == pEntry->nWID) )
{
const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
if(pIdx)
@@ -1084,18 +1082,48 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
}
}
}
- else if( FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID && eType != FLYCNTTYPE_FRM )
+ // --> OD 2009-07-13 #i73249#
+ // Attribute AlternativeText was never published.
+ // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
+// else if( FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID && eType != FLYCNTTYPE_FRM )
+// {
+// const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+// if(pIdx)
+// {
+// SwNodeIndex aIdx(*pIdx, 1);
+// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+// OUString uTemp;
+// aValue >>= uTemp;
+// pNoTxt->SetAlternateText(uTemp);
+// }
+// }
+ // New attribute Title
+ else if( FN_UNO_TITLE == pEntry->nWID )
{
- const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
- if(pIdx)
- {
- SwNodeIndex aIdx(*pIdx, 1);
- SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
- OUString uTemp;
- aValue >>= uTemp;
- pNoTxt->SetAlternateText(uTemp);
- }
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ OUString uTemp;
+ aValue >>= uTemp;
+ const String sTitle(uTemp);
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), sTitle );
+ }
+ // New attribute Description
+ else if( FN_UNO_DESCRIPTION == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ OUString uTemp;
+ aValue >>= uTemp;
+ const String sDescription(uTemp);
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), sDescription );
}
+ // <--
else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
{
SwFrmFmt *pFrmFmt = lcl_GetFrmFmt( aValue, pFmt->GetDoc() );
@@ -1468,8 +1496,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
{
if( ((eType == FLYCNTTYPE_GRF) || (eType == FLYCNTTYPE_OLE)) &&
pEntry &&
- ((pEntry->nWID >= RES_GRFATR_BEGIN &&
- pEntry->nWID < RES_GRFATR_END )||
+ (isGRFATR(pEntry->nWID) ||
pEntry->nWID == FN_PARAM_COUNTOUR_PP ||
pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ))
@@ -1565,17 +1592,40 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
{
aAny <<= OUString(SwStyleNameMapper::GetProgName(pFmt->DerivedFrom()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_FRMFMT ) );
}
- else if(eType != FLYCNTTYPE_FRM &&
- FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
+ // --> OD 2009-07-13 #i73249#
+ // Attribute AlternativeText was never published.
+ // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
+// else if(eType != FLYCNTTYPE_FRM &&
+// FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
+// {
+// const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+// if(pIdx)
+// {
+// SwNodeIndex aIdx(*pIdx, 1);
+// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+// aAny <<= OUString(pNoTxt->GetAlternateText());
+// }
+// }
+ else if( FN_UNO_TITLE == pEntry->nWID )
{
- const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
- if(pIdx)
- {
- SwNodeIndex aIdx(*pIdx, 1);
- SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
- aAny <<= OUString(pNoTxt->GetAlternateText());
- }
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ aAny <<= OUString(pFlyFmt->GetObjTitle());
+ }
+ // New attribute Description
+ else if( FN_UNO_DESCRIPTION == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ aAny <<= OUString(pFlyFmt->GetObjDescription());
}
+ // <--
else if(eType == FLYCNTTYPE_GRF &&
(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ACTUAL_SIZE))))
{
@@ -1758,13 +1808,13 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
FN_UNO_GRAPHIC_FILTER == pEntry->nWID||
FN_UNO_ACTUAL_SIZE == pEntry->nWID||
FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
+ {
pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
else
{
- if(eType == FLYCNTTYPE_GRF &&
- pEntry &&
- (pEntry->nWID >= RES_GRFATR_BEGIN &&
- pEntry->nWID <= RES_GRFATR_END))
+ if ((eType == FLYCNTTYPE_GRF) &&
+ pEntry && isGRFATR(pEntry->nWID))
{
const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
if(pIdx)
@@ -1817,9 +1867,7 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
pEntry->nWID != FN_UNO_ANCHOR_TYPES &&
pEntry->nWID != FN_PARAM_LINK_DISPLAY_NAME)
{
- if( eType == FLYCNTTYPE_GRF &&
- (pEntry->nWID >= RES_GRFATR_BEGIN &&
- pEntry->nWID < RES_GRFATR_END))
+ if ( (eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) )
{
const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
if(pIdx)
@@ -1833,16 +1881,40 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
}
}
}
- else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID )
+ // --> OD 2009-07-13 #i73249#
+ // Attribute AlternativeText was never published.
+ // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
+// else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID )
+// {
+// const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+// if(pIdx)
+// {
+// SwNodeIndex aIdx(*pIdx, 1);
+// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+// pNoTxt->SetAlternateText(aEmptyStr);
+// }
+// }
+ // New attribute Title
+ else if( FN_UNO_TITLE == pEntry->nWID )
{
- const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
- if(pIdx)
- {
- SwNodeIndex aIdx(*pIdx, 1);
- SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
- pNoTxt->SetAlternateText(aEmptyStr);
- }
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), aEmptyStr );
}
+ // New attribute Description
+ else if( FN_UNO_DESCRIPTION == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), aEmptyStr );
+ }
+ // <--
else
{
SwDoc* pDoc = pFmt->GetDoc();
@@ -2199,9 +2271,9 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
const ::uno::Any* pAutoContour;
if(pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_AUTOMATIC_CONTOUR)), *pAutoContour);
- const ::uno::Any* pAltText;
- if(pProps->GetProperty(FN_UNO_ALTERNATIVE_TEXT, 0, pAltText))
- setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ALTERNATIVE_TEXT)), *pAltText);
+// const ::uno::Any* pAltText;
+// if(pProps->GetProperty(FN_UNO_ALTERNATIVE_TEXT, 0, pAltText))
+// setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ALTERNATIVE_TEXT)), *pAltText);
}
else
{
@@ -2310,6 +2382,20 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
const ::uno::Any* pReplacement;
if( pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement) )
setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_GRAPHIC)), *pReplacement);
+ // --> OD 2009-07-13 #i73249#
+ // new attribute Title
+ const ::uno::Any* pTitle;
+ if ( pProps->GetProperty(FN_UNO_TITLE, 0, pTitle) )
+ {
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_TITLE)), *pTitle);
+ }
+ // new attribute Description
+ const ::uno::Any* pDescription;
+ if ( pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription) )
+ {
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_DESCRIPTION)), *pDescription);
+ }
+ // <--
}
else
throw lang::IllegalArgumentException();
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 74b794bd9308..3730da041f90 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -309,6 +309,7 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
// OD 18.09.2003 #i18732# - add property
// OD 2004-05-05 #i28701# - add property 'WrapInfluenceOnObjPos'
+// OD 2009-07-13 #i73249# - add properties 'Title' and 'Description'
#define COMMON_FRAME_PROPERTIES \
{ SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ANCHOR_PAGENUM }, \
{ SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE}, \
@@ -369,6 +370,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
{ SW_PROP_NMID(UNO_NAME_Z_ORDER), FN_UNO_Z_ORDER, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0}, \
{ SW_PROP_NMID(UNO_NAME_IS_FOLLOWING_TEXT_FLOW), RES_FOLLOW_TEXT_FLOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, \
{ SW_PROP_NMID(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_WRAP_INFLUENCE}, \
+ { SW_PROP_NMID(UNO_NAME_TITLE), FN_UNO_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_DESCRIPTION), FN_UNO_DESCRIPTION, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \
{ SW_PROP_NMID(UNO_NAME_LAYOUT_SIZE), WID_LAYOUT_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0 },
@@ -1123,7 +1126,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_GRAPHIC_FILTER), FN_UNO_GRAPHIC_FILTER, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0 },
{ SW_PROP_NMID(UNO_NAME_GRAPHIC), FN_UNO_GRAPHIC, CPPU_E2T(CPPUTYPE_REFXGRAPHIC), 0, 0 },
{ SW_PROP_NMID(UNO_NAME_ACTUAL_SIZE), FN_UNO_ACTUAL_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PropertyAttribute::READONLY, CONVERT_TWIPS},
- { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+// { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
{ SW_PROP_NMID(UNO_NAME_CONTOUR_POLY_POLYGON), FN_PARAM_COUNTOUR_PP, CPPU_E2T(CPPUTYPE_PNTSEQSEQ), PropertyAttribute::MAYBEVOID, 0 },
{ SW_PROP_NMID(UNO_NAME_IS_PIXEL_CONTOUR), FN_UNO_IS_PIXEL_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
{ SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_CONTOUR), FN_UNO_IS_AUTOMATIC_CONTOUR , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
@@ -1158,7 +1161,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_GRAPHIC_URL), FN_UNO_REPLACEMENT_GRAPHIC_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0 },
{ SW_PROP_NMID(UNO_NAME_GRAPHIC), FN_UNO_REPLACEMENT_GRAPHIC, CPPU_E2T(CPPUTYPE_REFXGRAPHIC), PropertyAttribute::MAYBEVOID, 0 },
{ SW_PROP_NMID(UNO_NAME_COMPONENT),FN_UNO_COMPONENT, CPPU_E2T(CPPUTYPE_REFCOMPONENT), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+// { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
{0,0,0,0,0,0}
};
aMapEntriesArr[nPropertyId] = aEmbeddedPropertyMap_Impl;
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 00b907ad0674..9b2bebb67977 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -150,30 +150,6 @@ uno::Sequence< sal_Int8 > CreateUnoTunnelId()
Hilfsklassen
****************************************************************************/
-SwParaSelection::SwParaSelection(SwUnoCrsr* pCrsr) :
- pUnoCrsr(pCrsr)
-{
- if(pUnoCrsr->HasMark())
- pUnoCrsr->DeleteMark();
- // steht er schon am Anfang?
- if(pUnoCrsr->GetPoint()->nContent != 0)
- pUnoCrsr->MovePara(fnParaCurr, fnParaStart);
- // oder gleichzeitig am Ende?
- if(pUnoCrsr->GetPoint()->nContent != pUnoCrsr->GetCntntNode()->Len())
- {
- pUnoCrsr->SetMark();
- pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
- }
-}
-
-SwParaSelection::~SwParaSelection()
-{
- if(pUnoCrsr->GetPoint()->nContent != 0)
- {
- pUnoCrsr->DeleteMark();
- pUnoCrsr->MovePara(fnParaCurr, fnParaStart);
- }
-}
/* -----------------13.05.98 12:15-------------------
*
* --------------------------------------------------*/
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index e49e69ea5cdf..7a27bd597eb0 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -65,9 +65,7 @@
#include <fmtfld.hxx>
#include <fmtpdsc.hxx>
#include <pagedesc.hxx>
-#ifndef _POOLFMT_HRC
#include <poolfmt.hrc>
-#endif
#include <poolfmt.hxx>
#include <edimp.hxx>
#include <fchrfmt.hxx>
@@ -620,7 +618,8 @@ uno::Reference< XEnumeration > SwXTextCursor::createEnumeration(void) throw( Ru
*pNewCrsr->GetMark() = *pUnoCrsr->GetMark();
}
CursorType eSetType = eType == CURSOR_TBLTEXT ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION;
- SwXParagraphEnumeration *pEnum = new SwXParagraphEnumeration(pParentText, *pNewCrsr, eSetType);
+ SwXParagraphEnumeration *pEnum =
+ new SwXParagraphEnumeration(pParentText, pNewCrsr, eSetType);
uno::Reference< XEnumeration > xRet = pEnum;
if (eType == CURSOR_TBLTEXT)
{
@@ -1078,8 +1077,9 @@ uno::Reference< XTextContent > SAL_CALL SwXParagraphEnumeration::NextElement_Imp
}
else
{
- SwUnoCrsr* pNewCrsr = pUnoCrsr->GetDoc()->CreateUnoCrsr(*pStart, sal_False);
- aRef = (XTextContent*)new SwXParagraph((SwXText*)pText, pNewCrsr, nFirstContent, nLastContent);
+ aRef = new SwXParagraph(static_cast<SwXText*>(pText),
+ pStart->nNode.GetNode().GetTxtNode(),
+ nFirstContent, nLastContent);
}
}
}
@@ -1170,8 +1170,9 @@ Sequence< OUString > SwXTextRange::getSupportedServiceNames(void) throw( Runtime
return aRet;
}
-SwXTextRange::SwXTextRange(SwPaM& rPam, const uno::Reference< XText > & rxParent) :
- eRangePosition(RANGE_IN_TEXT),
+SwXTextRange::SwXTextRange(SwPaM& rPam,
+ const uno::Reference< XText > & rxParent, enum RangePosition eRange) :
+ eRangePosition(eRange),
pDoc(rPam.GetDoc()),
pBox(0),
pBoxStartNode(0),
@@ -1180,46 +1181,6 @@ SwXTextRange::SwXTextRange(SwPaM& rPam, const uno::Reference< XText > & rxParent
xParentText(rxParent),
pMark(NULL)
{
- //Bookmark an der anlegen
- _CreateNewBookmark(rPam);
-}
-
-SwXTextRange::SwXTextRange(SwFrmFmt& rFmt, SwPaM& rPam) :
- eRangePosition(RANGE_IN_FRAME),
- pDoc(rPam.GetDoc()),
- pBox(0),
- pBoxStartNode(0),
- aObjectDepend(this, &rFmt),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)),
- pMark(NULL)
-{
- //Bookmark an der anlegen
- _CreateNewBookmark(rPam);
-}
-
-SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt, SwTableBox& rTblBox, SwPaM& rPam) :
- eRangePosition(RANGE_IN_CELL),
- pDoc(rPam.GetDoc()),
- pBox(&rTblBox),
- pBoxStartNode(0),
- aObjectDepend(this, &rTblFmt),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)),
- pMark(NULL)
-{
- //Bookmark an der anlegen
- _CreateNewBookmark(rPam);
-}
-
-SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt, const SwStartNode& rStartNode, SwPaM& rPam) :
- eRangePosition(RANGE_IN_CELL),
- pDoc(rPam.GetDoc()),
- pBox(0),
- pBoxStartNode(&rStartNode),
- aObjectDepend(this, &rTblFmt),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)),
- pMark(NULL)
-{
- //Bookmark an der anlegen
_CreateNewBookmark(rPam);
}
@@ -1287,50 +1248,22 @@ void SwXTextRange::DeleteAndInsert(const String& rText)
uno::Reference< XText > SwXTextRange::getText(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(!xParentText.is())
+ if (!xParentText.is())
{
- if(eRangePosition == RANGE_IN_FRAME &&
- aObjectDepend.GetRegisteredIn())
- {
- SwFrmFmt* pFrmFmt = (SwFrmFmt*)aObjectDepend.GetRegisteredIn();
- SwXTextFrame* pxFrm = (SwXTextFrame*)SwClientIter( *pFrmFmt ).
- First( TYPE( SwXTextFrame ));
- if(pxFrm)
- ((SwXTextRange*)this)->xParentText = pxFrm;
- else
- ((SwXTextRange*)this)->xParentText = new SwXTextFrame(*pFrmFmt);
- ((SwModify*)aObjectDepend.GetRegisteredIn())->
- Remove(&((SwXTextRange*)this)->aObjectDepend);
-
- }
- else if(eRangePosition == RANGE_IN_CELL &&
- aObjectDepend.GetRegisteredIn())
- {
- const SwStartNode* pSttNd = pBoxStartNode ? pBoxStartNode : pBox->GetSttNd();
- const SwTableNode* pTblNode = pSttNd->FindTableNode();
- const SwFrmFmt* pTableFmt = pTblNode->GetTable().GetFrmFmt();
- ((SwXTextRange*)this)->xParentText =
- pBox ? SwXCell::CreateXCell((SwFrmFmt*)pTableFmt, pBox)
- : new SwXCell( (SwFrmFmt*)pTableFmt, *pBoxStartNode );
- ((SwModify*)aObjectDepend.GetRegisteredIn())->
- Remove(&((SwXTextRange*)this)->aObjectDepend);
- }
- else if(eRangePosition == RANGE_IS_TABLE &&
+ if (eRangePosition == RANGE_IS_TABLE &&
aObjectDepend.GetRegisteredIn() )
{
SwFrmFmt* pTblFmt = (SwFrmFmt*)aObjectDepend.GetRegisteredIn();
SwTable* pTable = SwTable::FindTable( pTblFmt );
SwTableNode* pTblNode = pTable->GetTableNode();
SwPosition aPosition( *pTblNode );
- uno::Reference< XTextRange > xRange = SwXTextRange::CreateTextRangeFromPosition(pDoc,
- aPosition, 0);
+ uno::Reference< XTextRange > xRange =
+ SwXTextRange::CreateTextRangeFromPosition(pDoc, aPosition, 0);
xParentText = xRange->getText();
}
else
{
- // jetzt noch alle Faelle finden, die nicht abgedeckt sind
- // (Body, Kopf-/Fusszeilen, Fussnotentext )
- DBG_WARNING("not implemented");
+ OSL_ENSURE(false, "SwXTextRange::getText: no text");
}
}
return xParentText;
@@ -1491,34 +1424,32 @@ sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill,
}
else
{
- SwDoc* pDoc = 0;
- const SwPaM* pUnoCrsr = 0;
if (pPara)
{
- pUnoCrsr = pPara->GetCrsr();
- if (pUnoCrsr)
- pDoc = pUnoCrsr->GetDoc();
+ const SwTxtNode * pTxtNode( pPara->GetTxtNode() );
+
+ if (pTxtNode) {
+ bRet = sal_True;
+ *rToFill.GetPoint() = SwPosition( *pTxtNode );
+ // set selection to the whole paragraph
+ rToFill.SetMark();
+ rToFill.GetMark()->nContent = pTxtNode->GetTxt().Len();
+ }
}
else
{
- pDoc = pCursor ? pCursor->GetDoc() : NULL;
+ const SwPaM* pUnoCrsr = 0;
+ SwDoc* pDoc = pCursor ? pCursor->GetDoc() : NULL;
+
if ( !pDoc )
pDoc = pPortion ? pPortion->GetCrsr()->GetDoc() : NULL;
pUnoCrsr = pCursor ? pCursor->GetPaM() : pPortion ? pPortion->GetCrsr() : 0;
- }
- if(pUnoCrsr && pDoc == rToFill.GetDoc())
+ if (pUnoCrsr && pDoc == rToFill.GetDoc())
{
DBG_ASSERT((SwPaM*)pUnoCrsr->GetNext() == pUnoCrsr, "was machen wir mit Ringen?" );
bRet = sal_True;
*rToFill.GetPoint() = *pUnoCrsr->GetPoint();
- if(pPara)
- {
- // set selection to the whole paragraph
- rToFill.SetMark();
- rToFill.GetMark()->nContent =
- pUnoCrsr->GetNode()->GetTxtNode()->GetTxt().Len();
- }
- else if(pUnoCrsr->HasMark())
+ if (pUnoCrsr->HasMark())
{
rToFill.SetMark();
*rToFill.GetMark() = *pUnoCrsr->GetMark();
@@ -1526,6 +1457,7 @@ sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill,
else
rToFill.DeleteMark();
}
+ }
}
return bRet;
}
@@ -1555,18 +1487,28 @@ sal_Bool lcl_IsStartNodeInFormat(sal_Bool bHeader, SwStartNode* pSttNode,
return bRet;
}
-uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(SwDoc* pDoc,
- const SwPosition& rPos, const SwPosition* pMark)
+uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(
+ SwDoc* pDoc, const SwPosition& rPos, const SwPosition* pMark)
{
- uno::Reference< XTextRange > aRet;
- SwUnoCrsr* pNewCrsr = pDoc->CreateUnoCrsr(rPos, sal_False);
+ uno::Reference< XText > xParentText( CreateParentXText(pDoc, rPos) );
+ std::auto_ptr<SwUnoCrsr> pNewCrsr( pDoc->CreateUnoCrsr(rPos, sal_False) );
if(pMark)
{
pNewCrsr->SetMark();
*pNewCrsr->GetMark() = *pMark;
}
- uno::Reference< XText > xParentText;
- //jetzt besorgen wir uns mal den Parent:
+ bool isCell( dynamic_cast<SwXCell*>(xParentText.get()) );
+ uno::Reference< XTextRange > xRet(
+ new SwXTextRange(*pNewCrsr, xParentText,
+ isCell ? RANGE_IN_CELL : RANGE_IN_TEXT) );
+ return xRet;
+
+}
+
+uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
+ const SwPosition& rPos)
+{
+ uno::Reference< XText > xParentText;
SwStartNode* pSttNode = rPos.nNode.GetNode().StartOfSectionNode();
while(pSttNode && pSttNode->IsSectionNode())
{
@@ -1581,19 +1523,19 @@ uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(SwDoc* pD
SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt();
SwTableBox* pBox = pSttNode->GetTblBox();
- if( pBox )
- aRet = new SwXTextRange(*pTableFmt, *pBox, *pNewCrsr);
- else
- aRet = new SwXTextRange(*pTableFmt, *pSttNode, *pNewCrsr);
+ xParentText = pBox
+ ? SwXCell::CreateXCell( pTableFmt, pBox )
+ : new SwXCell( pTableFmt, *pSttNode );
}
break;
case SwFlyStartNode:
{
- SwFrmFmt* pFmt;
- if(0 != (pFmt = pSttNode->GetFlyFmt()))
+ SwFrmFmt* pFmt = pSttNode->GetFlyFmt();
+ if (0 != pFmt)
{
- aRet = new SwXTextRange(*pFmt, *pNewCrsr);
-
+ SwXTextFrame* pFrame( static_cast<SwXTextFrame*>(
+ SwClientIter( *pFmt ).First( TYPE( SwXTextFrame ) ) ) );
+ xParentText = pFrame ? pFrame : new SwXTextFrame( *pFmt );
}
}
break;
@@ -1640,13 +1582,15 @@ uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(SwDoc* pD
(void)pTmpSttNode;
#endif
- if(pSttNode == pTxtFtn->GetStartNode()->GetNode().
+ if (pSttNode == pTxtFtn->GetStartNode()->GetNode().
FindSttNodeByType(SwFootnoteStartNode))
{
xParentText = ((SwUnoCallBack*)pDoc->GetUnoCallBack())->
GetFootnote(rFtn);
- if(!xParentText.is())
+ if (!xParentText.is())
+ {
xParentText = new SwXFootnote(pDoc, rFtn);
+ }
break;
}
}
@@ -1654,17 +1598,16 @@ uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(SwDoc* pD
break;
default:
{
- // dann ist es der Body-Text
- uno::Reference<frame::XModel> xModel = pDoc->GetDocShell()->GetBaseModel();
+ // then it is the body text
+ uno::Reference<frame::XModel> xModel =
+ pDoc->GetDocShell()->GetBaseModel();
uno::Reference< XTextDocument > xDoc(
xModel, uno::UNO_QUERY);
xParentText = xDoc->getText();
}
}
- if(!aRet.is())
- aRet = new SwXTextRange(*pNewCrsr, xParentText);
- delete pNewCrsr;
- return aRet;
+ OSL_ENSURE(xParentText.is(), "no parent text?");
+ return xParentText;
}
uno::Reference< XEnumeration > SAL_CALL SwXTextRange::createContentEnumeration(
@@ -1707,7 +1650,8 @@ uno::Reference< XEnumeration > SwXTextRange::createEnumeration(void) throw( Runt
}
DBG_ASSERT(pParentText, "parent is not a SwXText");
CursorType eSetType = RANGE_IN_CELL == eRangePosition ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION;
- uno::Reference< XEnumeration > xRet = new SwXParagraphEnumeration(pParentText, *pNewCrsr, eSetType);
+ uno::Reference< XEnumeration > xRet =
+ new SwXParagraphEnumeration(pParentText, pNewCrsr, eSetType);
return xRet;
}
@@ -2090,23 +2034,25 @@ Sequence< OUString > SwXParaFrameEnumeration::getSupportedServiceNames(void) thr
/*-- 23.03.99 13:22:29---------------------------------------------------
-----------------------------------------------------------------------*/
-SwXParaFrameEnumeration::SwXParaFrameEnumeration(const SwUnoCrsr& rUnoCrsr,
+SwXParaFrameEnumeration::SwXParaFrameEnumeration(const SwPaM& rPaM,
sal_uInt8 nParaFrameMode,
SwFrmFmt* pFmt)
{
- SwDoc* pDoc = rUnoCrsr.GetDoc();
- SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(*rUnoCrsr.GetPoint(), sal_False);
- if(rUnoCrsr.HasMark())
+ SwDoc* pDoc = rPaM.GetDoc();
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(*rPaM.GetPoint(), sal_False);
+ if (rPaM.HasMark())
{
pUnoCrsr->SetMark();
- *pUnoCrsr->GetMark() = *rUnoCrsr.GetMark();
+ *pUnoCrsr->GetMark() = *rPaM.GetMark();
}
pUnoCrsr->Add(this);
- if(PARAFRAME_PORTION_PARAGRAPH == nParaFrameMode)
- ::CollectFrameAtNode( *this, rUnoCrsr.GetPoint()->nNode,
+ if (PARAFRAME_PORTION_PARAGRAPH == nParaFrameMode)
+ {
+ ::CollectFrameAtNode( *this, rPaM.GetPoint()->nNode,
aFrameArr, FALSE );
- else if(pFmt)
+ }
+ else if (pFmt)
{
//jetzt einen SwDepend anlegen und in das Array einfuegen
SwDepend* pNewDepend = new SwDepend(this, pFmt);
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 7662df99afed..d21439ff120e 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -33,9 +33,7 @@
#include <cmdid.h>
-#ifndef _UNOMID_H
#include <unomid.h>
-#endif
#include <unoobj.hxx>
#include <unomap.hxx>
#include <unocrsr.hxx>
@@ -45,6 +43,7 @@
#include <ndtxt.hxx>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
+#include <docsh.hxx>
#define _SVSTDARR_USHORTS
#define _SVSTDARR_USHORTSSORT
@@ -53,21 +52,61 @@
#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
#include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
-#ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
using namespace ::com::sun::star;
using ::rtl::OUString;
+
+/* -----------------------------01.12.00 18:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwParaSelection
+{
+ SwCursor* m_pCursor;
+public:
+ SwParaSelection(SwCursor* pPam);
+ ~SwParaSelection();
+};
+
+SwParaSelection::SwParaSelection(SwCursor* pCursor)
+ : m_pCursor(pCursor)
+{
+ if (m_pCursor->HasMark())
+ {
+ m_pCursor->DeleteMark();
+ }
+ // is it at the start?
+ if (m_pCursor->GetPoint()->nContent != 0)
+ {
+ m_pCursor->MovePara(fnParaCurr, fnParaStart);
+ }
+ // or at the end already?
+ if (m_pCursor->GetPoint()->nContent != m_pCursor->GetCntntNode()->Len())
+ {
+ m_pCursor->SetMark();
+ m_pCursor->MovePara(fnParaCurr, fnParaEnd);
+ }
+}
+
+SwParaSelection::~SwParaSelection()
+{
+ if (m_pCursor->GetPoint()->nContent != 0)
+ {
+ m_pCursor->DeleteMark();
+ m_pCursor->MovePara(fnParaCurr, fnParaStart);
+ }
+}
+
+
/******************************************************************
* forward declarations
******************************************************************/
beans::PropertyState lcl_SwXParagraph_getPropertyState(
- SwUnoCrsr& rUnoCrsr,
+ const SwTxtNode& rTxtNode,
const SwAttrSet** ppSet,
const SfxItemPropertySimpleEntry& rEntry,
sal_Bool &rAttrSetFetched )
@@ -76,6 +115,9 @@ beans::PropertyState lcl_SwXParagraph_getPropertyState(
/******************************************************************
* SwXParagraph
******************************************************************/
+
+TYPEINIT1(SwXParagraph, SwClient);
+
/* -----------------------------11.07.00 12:10--------------------------------
---------------------------------------------------------------------------*/
@@ -164,9 +206,9 @@ SwXParagraph::SwXParagraph() :
/*-- 11.12.98 08:12:47---------------------------------------------------
-----------------------------------------------------------------------*/
-SwXParagraph::SwXParagraph(SwXText* pParent, SwUnoCrsr* pCrsr, sal_Int32 nSelStart, sal_Int32 nSelEnd) :
- SwClient(pCrsr),
- xParentText(pParent),
+SwXParagraph::SwXParagraph(uno::Reference< text::XText > const & i_xParent, SwTxtNode * i_pTxtNode, sal_Int32 nSelStart, sal_Int32 nSelEnd) :
+ SwClient(i_pTxtNode),
+ xParentText(i_xParent),
aLstnrCntnr( (text::XTextRange*)this),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH)),
nSelectionStartPos(nSelStart),
@@ -179,10 +221,6 @@ SwXParagraph::SwXParagraph(SwXText* pParent, SwUnoCrsr* pCrsr, sal_Int32 nSelSta
-----------------------------------------------------------------------*/
SwXParagraph::~SwXParagraph()
{
- vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
- delete pUnoCrsr;
}
/* -----------------------------11.07.00 14:48--------------------------------
@@ -247,14 +285,15 @@ void SAL_CALL SwXParagraph::SetPropertyValues_Impl(
throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException)
{
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
+ if (GetTxtNode())
{
+ SwPosition aPos( *GetTxtNode() );
+ SwCursor aCursor( aPos, 0, false );
const OUString* pPropertyNames = rPropertyNames.getConstArray();
const uno::Any* pValues = rValues.getConstArray();
const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap();
OUString sTmp;
- SwParaSelection aParaSel(pUnoCrsr);
+ SwParaSelection aParaSel( & aCursor );
for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
{
const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pPropertyNames[nProp] );
@@ -265,7 +304,7 @@ void SAL_CALL SwXParagraph::SetPropertyValues_Impl(
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
- SwXTextCursor::SetPropertyValue(*pUnoCrsr, *m_pPropSet,
+ SwXTextCursor::SetPropertyValue(aCursor, *m_pPropSet,
sTmp, pValues[nProp]);
}
}
@@ -304,14 +343,15 @@ uno::Sequence< uno::Any > SAL_CALL SwXParagraph::GetPropertyValues_Impl(
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
uno::Sequence< uno::Any > aValues(rPropertyNames.getLength());
- SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
- if(pUnoCrsr)
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
+ SwPosition aPos( *pTxtNode );
+ SwPaM aPam( aPos );
uno::Any* pValues = aValues.getArray();
const OUString* pPropertyNames = rPropertyNames.getConstArray();
const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap();
- SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode();
- const SwAttrSet& rAttrSet = ((SwTxtNode&)rTxtNode).GetSwAttrSet();
+ const SwAttrSet& rAttrSet( pTxtNode->GetSwAttrSet() );
for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
{
const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pPropertyNames[nProp] );
@@ -323,7 +363,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXParagraph::GetPropertyValues_Impl(
BOOL bDone = FALSE;
beans::PropertyState eTemp;
bDone = SwUnoCursorHelper::getCrsrPropertyValue(
- *pEntry, *pUnoCrsr, &(pValues[nProp]), eTemp, rTxtNode.GetTxtNode() );
+ *pEntry, aPam, &(pValues[nProp]), eTemp, pTxtNode );
if(!bDone)
m_pPropSet->getPropertyValue(*pEntry, rAttrSet, pValues[nProp]);
}
@@ -400,8 +440,9 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXParagraph::setProp
if (rPropertyNames.getLength() != rValues.getLength())
throw lang::IllegalArgumentException();
- SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
- if(!pUnoCrsr)
+
+ const SwTxtNode * const pTxtNode( GetTxtNode() );
+ if (!pTxtNode)
throw uno::RuntimeException();
//SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode();
@@ -422,7 +463,9 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXParagraph::setProp
const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap();
OUString sTmp;
- SwParaSelection aParaSel( pUnoCrsr );
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ SwParaSelection aParaSel( & aCursor );
for (sal_Int32 i = 0; i < nProps; ++i)
{
try
@@ -441,7 +484,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXParagraph::setProp
else
{
SwXTextCursor::SetPropertyValue(
- *pUnoCrsr, *m_pPropSet, pProp[i], pValue[i] );
+ aCursor, *m_pPropSet, pProp[i], pValue[i] );
}
}
}
@@ -506,11 +549,10 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::G
{
vos::OGuard aGuard( Application::GetSolarMutex() );
- SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
- if (!pUnoCrsr)
- throw uno::RuntimeException();
- SwTxtNode* pTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode().GetTxtNode();
+ const SwTxtNode * const pTxtNode( GetTxtNode() );
DBG_ASSERT( pTxtNode != NULL, "need text node" );
+ if (!pTxtNode)
+ throw uno::RuntimeException();
// #i46786# Use SwAttrSet pointer for determining the state.
// Use the value SwAttrSet (from the paragraph OR the style)
@@ -546,7 +588,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::G
// (compare to SwXParagraph::getPropertyState)
sal_Bool bAttrSetFetched = sal_True;
beans::PropertyState eState = lcl_SwXParagraph_getPropertyState(
- *pUnoCrsr, &pAttrSet, *pEntry, bAttrSetFetched );
+ *pTxtNode, &pAttrSet, *pEntry, bAttrSetFetched );
rResult.State = eState;
// if (bDirectValuesOnly && PropertyState_DIRECT_VALUE != eState)
@@ -561,12 +603,14 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::G
if (!SwXParagraph::getDefaultTextContentValue(
aValue, pProp[i], pEntry->nWID ) )
{
+ SwPosition aPos( *pTxtNode );
+ SwPaM aPam( aPos );
// handle properties that are not part of the attribute
// and thus only pretendend to be paragraph attributes
BOOL bDone = FALSE;
beans::PropertyState eTemp;
bDone = SwUnoCursorHelper::getCrsrPropertyValue(
- *pEntry, *pUnoCrsr, &aValue, eTemp, pTxtNode );
+ *pEntry, aPam, &aValue, eTemp, pTxtNode );
// if not found try the real paragraph attributes...
if (!bDone)
@@ -677,7 +721,8 @@ void SwXParagraph::removeVetoableChangeListener(const OUString& /*PropertyName*/
}
//-----------------------------------------------------------------------------
beans::PropertyState lcl_SwXParagraph_getPropertyState(
- SwUnoCrsr& rUnoCrsr,
+// SwUnoCrsr& rUnoCrsr,
+ const SwTxtNode& rTxtNode,
const SwAttrSet** ppSet,
const SfxItemPropertySimpleEntry& rEntry,
sal_Bool &rAttrSetFetched )
@@ -687,15 +732,16 @@ beans::PropertyState lcl_SwXParagraph_getPropertyState(
if(!(*ppSet) && !rAttrSetFetched )
{
- SwNode& rTxtNode = rUnoCrsr.GetPoint()->nNode.GetNode();
- (*ppSet) = ((SwTxtNode&)rTxtNode).GetpSwAttrSet();
+ (*ppSet) = rTxtNode.GetpSwAttrSet();
rAttrSetFetched = sal_True;
}
+ SwPosition aPos( rTxtNode );
+ SwPaM aPam( aPos );
switch( rEntry.nWID )
{
case FN_UNO_NUM_RULES:
- //wenn eine Numerierung gesetzt ist, dann hier herausreichen, sonst nichts tun
- SwUnoCursorHelper::getNumberingProperty( rUnoCrsr, eRet, NULL );
+ // if numbering is set, return it; else do nothing
+ SwUnoCursorHelper::getNumberingProperty( aPam, eRet, NULL );
break;
case FN_UNO_ANCHOR_TYPES:
break;
@@ -711,7 +757,7 @@ beans::PropertyState lcl_SwXParagraph_getPropertyState(
case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
{
SwFmtColl* pFmt = SwXTextCursor::GetCurTxtFmtColl(
- rUnoCrsr, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME);
+ aPam, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME);
eRet = pFmt ? beans::PropertyState_DIRECT_VALUE
: beans::PropertyState_AMBIGUOUS_VALUE;
}
@@ -719,7 +765,7 @@ beans::PropertyState lcl_SwXParagraph_getPropertyState(
case FN_UNO_PAGE_STYLE:
{
String sVal;
- SwUnoCursorHelper::GetCurPageStyle( rUnoCrsr, sVal );
+ SwUnoCursorHelper::GetCurPageStyle( aPam, sVal );
eRet = sVal.Len() ? beans::PropertyState_DIRECT_VALUE
: beans::PropertyState_AMBIGUOUS_VALUE;
}
@@ -741,16 +787,16 @@ beans::PropertyState SwXParagraph::getPropertyState(const OUString& rPropertyNam
{
vos::OGuard aGuard(Application::GetSolarMutex());
beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
- SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
- if( pUnoCrsr )
+ const SwTxtNode * const pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
const SwAttrSet* pSet = 0;
const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
if(!pEntry)
throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
sal_Bool bDummy = sal_False;
- eRet = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pSet, *pEntry,
- bDummy );
+ eRet = lcl_SwXParagraph_getPropertyState( *pTxtNode, &pSet, *pEntry,
+ bDummy );
}
else
throw uno::RuntimeException();
@@ -769,10 +815,10 @@ uno::Sequence< beans::PropertyState > SwXParagraph::getPropertyStates(
uno::Sequence< beans::PropertyState > aRet(PropertyNames.getLength());
beans::PropertyState* pStates = aRet.getArray();
- SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
- const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap();
- if( pUnoCrsr )
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
+ const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap();
const SwAttrSet* pSet = 0;
sal_Bool bAttrSetFetched = sal_False;
for(sal_Int32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd; i++,++pStates,++pNames )
@@ -780,12 +826,16 @@ uno::Sequence< beans::PropertyState > SwXParagraph::getPropertyStates(
const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( *pNames );
if(!pEntry)
throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + *pNames, static_cast < cppu::OWeakObject * > ( this ) );
- if (bAttrSetFetched && !pSet &&
- pEntry->nWID >= RES_CHRATR_BEGIN &&
- pEntry->nWID <= RES_UNKNOWNATR_END )
+
+ if (bAttrSetFetched && !pSet && isATR(pEntry->nWID))
+ {
*pStates = beans::PropertyState_DEFAULT_VALUE;
+ }
else
- *pStates = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pSet,*pEntry, bAttrSetFetched );
+ {
+ *pStates = lcl_SwXParagraph_getPropertyState(
+ *pTxtNode, &pSet, *pEntry, bAttrSetFetched );
+ }
}
}
else
@@ -800,16 +850,18 @@ void SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
throw( beans::UnknownPropertyException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)) ||
rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPES)) ||
rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_TEXT_WRAP)))
return;
- // Absatz selektieren
- SwParaSelection aParaSel(pUnoCrsr);
+ // select paragraph
+ SwParaSelection aParaSel( & aCursor );
const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
if(pEntry)
{
@@ -821,14 +873,17 @@ void SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
SvUShortsSort aWhichIds;
aWhichIds.Insert(pEntry->nWID);
if(pEntry->nWID < RES_PARATR_BEGIN)
- pUnoCrsr->GetDoc()->ResetAttrs(*pUnoCrsr, sal_True, &aWhichIds);
+ {
+ aCursor.GetDoc()->ResetAttrs(aCursor, sal_True, &aWhichIds);
+ }
else
{
- //fuer Absatzattribute muss die Selektion jeweils auf
- //Absatzgrenzen erweitert werden
- SwPosition aStart = *pUnoCrsr->Start();
- SwPosition aEnd = *pUnoCrsr->End();
- SwUnoCrsr* pTemp = pUnoCrsr->GetDoc()->CreateUnoCrsr(aStart, sal_False);
+ // for paragraph attributes the selection must be extended
+ // to paragraph boundaries
+ SwPosition aStart( *aCursor.Start() );
+ SwPosition aEnd ( *aCursor.End() );
+ std::auto_ptr<SwUnoCrsr> pTemp(
+ aCursor.GetDoc()->CreateUnoCrsr(aStart, sal_False) );
if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
{
pTemp->MovePara(fnParaCurr, fnParaStart);
@@ -842,11 +897,12 @@ void SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
pTemp->MovePara(fnParaCurr, fnParaEnd);
}
pTemp->GetDoc()->ResetAttrs(*pTemp, sal_True, &aWhichIds);
- delete pTemp;
}
}
else
- SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, *pUnoCrsr);
+ {
+ SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, aCursor);
+ }
}
else
throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
@@ -861,8 +917,8 @@ uno::Any SwXParagraph::getPropertyDefault(const OUString& rPropertyName)
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
uno::Any aRet;
- SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
- if(pUnoCrsr)
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
if(SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName))
return aRet;
@@ -873,7 +929,8 @@ uno::Any SwXParagraph::getPropertyDefault(const OUString& rPropertyName)
if(pEntry->nWID < RES_FRMATR_END)
{
const SfxPoolItem& rDefItem =
- pUnoCrsr->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
+ pTxtNode->GetDoc()->GetAttrPool().GetDefaultItem(
+ pEntry->nWID);
rDefItem.QueryValue(aRet, pEntry->nMemberId);
}
}
@@ -904,12 +961,14 @@ uno::Reference< text::XTextRange > SwXParagraph::getAnchor(void) throw( uno::Ru
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< text::XTextRange > aRet;
- SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
- if(pUnoCrsr)
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
- // Absatz selektieren
- SwParaSelection aSelection(pUnoCrsr);
- aRet = new SwXTextRange(*pUnoCrsr, xParentText);
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ // select paragraph
+ SwParaSelection aParaSel( & aCursor );
+ aRet = new SwXTextRange(aCursor, xParentText);
}
else
throw uno::RuntimeException();
@@ -921,16 +980,16 @@ uno::Reference< text::XTextRange > SwXParagraph::getAnchor(void) throw( uno::Ru
void SwXParagraph::dispose(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
- if(pUnoCrsr)
+ SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
- // Absatz selektieren
+ SwCursor aCursor( SwPosition( *pTxtNode ), 0, false );
+ // select paragraph
{
- SwParaSelection aSelection(pUnoCrsr);
- pUnoCrsr->GetDoc()->DelFullPara(*pUnoCrsr);
+ SwParaSelection aParaSel( & aCursor );
+ pTxtNode->GetDoc()->DelFullPara(aCursor);
}
aLstnrCntnr.Disposing();
- delete pUnoCrsr;
}
else
throw uno::RuntimeException();
@@ -959,9 +1018,14 @@ uno::Reference< container::XEnumeration > SwXParagraph::createEnumeration(void)
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< container::XEnumeration > aRef;
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
- aRef = new SwXTextPortionEnumeration(*pUnoCrsr, xParentText, nSelectionStartPos, nSelectionEndPos);
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
+ {
+ SwPosition aPos( *pTxtNode );
+ SwPaM aPam ( aPos );
+ aRef = new SwXTextPortionEnumeration(aPam, xParentText,
+ nSelectionStartPos, nSelectionEndPos);
+ }
else
throw uno::RuntimeException();
return aRef;
@@ -980,10 +1044,7 @@ uno::Type SwXParagraph::getElementType(void) throw( uno::RuntimeException )
sal_Bool SwXParagraph::hasElements(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- if(((SwXParagraph*)this)->GetCrsr())
- return sal_True;
- else
- return sal_False;
+ return (GetTxtNode()) ? sal_True : sal_False;
}
/*-- 11.12.98 08:12:55---------------------------------------------------
@@ -999,11 +1060,13 @@ uno::Reference< text::XTextRange > SwXParagraph::getStart(void) throw( uno::Run
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< text::XTextRange > xRet;
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if( pUnoCrsr)
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
- SwParaSelection aSelection(pUnoCrsr);
- SwPaM aPam(*pUnoCrsr->Start());
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ SwParaSelection aParaSel( &aCursor );
+ SwPaM aPam( *aCursor.Start() );
uno::Reference< text::XText > xParent = getText();
xRet = new SwXTextRange(aPam, xParent);
}
@@ -1018,11 +1081,13 @@ uno::Reference< text::XTextRange > SwXParagraph::getEnd(void) throw( uno::Runti
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< text::XTextRange > xRet;
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if( pUnoCrsr)
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
- SwParaSelection aSelection(pUnoCrsr);
- SwPaM aPam(*pUnoCrsr->End());
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ SwParaSelection aParaSel( &aCursor );
+ SwPaM aPam( *aCursor.End() );
uno::Reference< text::XText > xParent = getText();
xRet = new SwXTextRange(aPam, xParent);
}
@@ -1037,11 +1102,13 @@ OUString SwXParagraph::getString(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
OUString aRet;
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if( pUnoCrsr)
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
- SwParaSelection aSelection(pUnoCrsr);
- SwXTextCursor::getTextFromPam(*pUnoCrsr, aRet);
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ SwParaSelection aParaSel( & aCursor );
+ SwXTextCursor::getTextFromPam(aCursor, aRet);
}
else if(IsDescriptor())
aRet = m_sText;
@@ -1055,17 +1122,21 @@ OUString SwXParagraph::getString(void) throw( uno::RuntimeException )
void SwXParagraph::setString(const OUString& aString) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
{
- if(!SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr))
- pUnoCrsr->MovePara(fnParaCurr, fnParaStart);
- SwXTextCursor::SelectPam(*pUnoCrsr, sal_True);
- if(pUnoCrsr->GetNode()->GetTxtNode()->GetTxt().Len())
- pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
- SwXTextCursor::SetString(*pUnoCrsr, aString);
- SwXTextCursor::SelectPam(*pUnoCrsr, sal_False);
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ if (!SwUnoCursorHelper::IsStartOfPara(aCursor)) {
+ aCursor.MovePara(fnParaCurr, fnParaStart);
+ }
+ SwXTextCursor::SelectPam(aCursor, sal_True);
+ if (pTxtNode->GetTxt().Len()) {
+ aCursor.MovePara(fnParaCurr, fnParaEnd);
+ }
+ SwXTextCursor::SetString(aCursor, aString);
+ SwXTextCursor::SelectPam(aCursor, sal_False);
}
else if(IsDescriptor())
m_sText = aString;
@@ -1079,11 +1150,14 @@ void SwXParagraph::setString(const OUString& aString) throw( uno::RuntimeExcepti
uno::Reference< container::XEnumeration > SwXParagraph::createContentEnumeration(const OUString& rServiceName)
throw( uno::RuntimeException )
{
- SwUnoCrsr* pUnoCrsr = GetCrsr();
- if( !pUnoCrsr || COMPARE_EQUAL != rServiceName.compareToAscii("com.sun.star.text.TextContent") )
+ const SwTxtNode * pTxtNode( GetTxtNode() );
+ if(!pTxtNode || !rServiceName.equalsAscii("com.sun.star.text.TextContent"))
throw uno::RuntimeException();
- uno::Reference< container::XEnumeration > xRet = new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_PARAGRAPH);
+ SwPosition aPos( *pTxtNode );
+ SwPaM aPam( aPos );
+ uno::Reference< container::XEnumeration > xRet =
+ new SwXParaFrameEnumeration(aPam, PARAFRAME_PORTION_PARAGRAPH);
return xRet;
}
/* -----------------23.03.99 12:49-------------------
@@ -1106,3 +1180,33 @@ void SwXParagraph::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
aLstnrCntnr.Disposing();
}
+const SwTxtNode * SwXParagraph::GetTxtNode() const
+{
+ return static_cast<const SwTxtNode*>(GetRegisteredIn());
+}
+
+SwTxtNode * SwXParagraph::GetTxtNode()
+{
+ return static_cast<SwTxtNode*>(pRegisteredIn);
+}
+
+::sfx2::Metadatable* SwXParagraph::GetCoreObject()
+{
+ SwTxtNode * pTxtNode( GetTxtNode() );
+ return pTxtNode;
+}
+
+uno::Reference<frame::XModel> SwXParagraph::GetModel()
+{
+ SwTxtNode * pTxtNode( GetTxtNode() );
+ if (pTxtNode)
+ {
+ const SwDocShell * pShell( pTxtNode->GetDoc()->GetDocShell() );
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 6fcff2505136..4aa2d1a27d6f 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -86,7 +86,7 @@ SwFmtFld* SwXTextPortion::GetFldFmt(sal_Bool bInit)
-----------------------------------------------------------------------*/
SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
- uno::Reference< text::XText > & rParent,
+ uno::Reference< text::XText > const& rParent,
SwTextPortionType eType) :
aLstnrCntnr( (text::XTextRange*)this),
m_pPropSet(aSwMapProvider.GetPropertySet(
@@ -121,8 +121,9 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
/* -----------------24.03.99 16:30-------------------
*
* --------------------------------------------------*/
-SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< text::XText > & rParent,
- SwFrmFmt& rFmt ) :
+SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
+ uno::Reference< text::XText > const& rParent,
+ SwFrmFmt& rFmt ) :
aLstnrCntnr( (text::XTextRange*)this),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXTPORTION_EXTENSIONS)),
xParentText(rParent),
@@ -1072,7 +1073,7 @@ void SwXTextPortion::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
---------------------------------------------------------------------------*/
SwXRubyPortion::SwXRubyPortion(const SwUnoCrsr* pPortionCrsr,
SwTxtRuby& rAttr,
- uno::Reference< text::XText > & rParent,
+ uno::Reference< text::XText > const& rParent,
sal_Bool bEnd ) :
SwXTextPortion(pPortionCrsr, rParent, bEnd ? PORTION_RUBY_END : PORTION_RUBY_START )
{
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index eee230794051..d972329b0f52 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -57,12 +57,14 @@
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::text;
using ::rtl::OUString;
using namespace ::std;
+
namespace
{
static const BYTE BKM_TYPE_START = 0;
@@ -165,6 +167,7 @@ namespace
}
}
+
/******************************************************************
* SwXTextPortionEnumeration
******************************************************************/
@@ -284,7 +287,8 @@ uno::Any SwXTextPortionEnumeration::nextElement(void)
---------------------------------------------------------------------------*/
void lcl_InsertRefMarkPortion(
- XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr, Reference<XText>& rParent, SwTxtAttr* pAttr, BOOL bEnd)
+ XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr,
+ Reference<XText> const& rParent, SwTxtAttr* pAttr, BOOL bEnd)
{
SwDoc* pDoc = pUnoCrsr->GetDoc();
SwFmtRefMark& rRefMark = ((SwFmtRefMark&)pAttr->GetAttr());
@@ -311,18 +315,17 @@ void lcl_InsertRefMarkPortion(
}
//-----------------------------------------------------------------------------
void lcl_InsertRubyPortion( XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr,
- Reference<XText>& rParent, SwTxtAttr* pAttr, BOOL bEnd)
+ Reference<XText> const& rParent, SwTxtAttr* pAttr, BOOL bEnd)
{
- SwXRubyPortion* pPortion = 0;
- rArr.Insert(
- new Reference< XTextRange >(pPortion = new SwXRubyPortion(*pUnoCrsr, *(SwTxtRuby*)pAttr, rParent,
- bEnd)),
- rArr.Count());
+ SwXRubyPortion* pPortion =
+ new SwXRubyPortion(pUnoCrsr, *(SwTxtRuby*)pAttr, rParent, bEnd);
+ rArr.Insert( new Reference< XTextRange >(pPortion), rArr.Count() );
pPortion->SetCollapsed(pAttr->GetEnd() ? FALSE : TRUE);
}
//-----------------------------------------------------------------------------
void lcl_InsertTOXMarkPortion(
- XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr, Reference<XText>& rParent, SwTxtAttr* pAttr, BOOL bEnd)
+ XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr, Reference<XText> const& rParent,
+ SwTxtAttr* pAttr, BOOL bEnd)
{
SwDoc* pDoc = pUnoCrsr->GetDoc();
SwTOXMark& rTOXMark = ((SwTOXMark&)pAttr->GetAttr());
@@ -455,20 +458,17 @@ typedef std::multiset < SwXRedlinePortion_ImplSharedPtr, RedlineCompareStruct >
//-----------------------------------------------------------------------------
Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
- XTextRangeArr& rPortionArr,
- SwUnoCrsr* pUnoCrsr,
- Reference<XText> & rParent,
- const xub_StrLen nCurrentIndex,
- SwTextPortionType& ePortionType,
- const xub_StrLen& nFirstFrameIndex,
- SwXBookmarkPortion_ImplList& aBkmArr,
- SwXRedlinePortion_ImplList& aRedArr,
- SwSoftPageBreakList& aBreakArr,
- sal_Int32 nEndPos )
+ XTextRangeArr& rPortionArr,
+ SwUnoCrsr* pUnoCrsr,
+ const Reference<XText> & rParent,
+ const xub_StrLen nCurrentIndex,
+ SwTextPortionType & rePortionType,
+ bool & io_rbRightMoveForbidden,
+ sal_Int32 & o_rNextAttrPosition )
{
Reference<XTextRange> xRef;
SwDoc* pDoc = pUnoCrsr->GetDoc();
- sal_Bool bAttrFound = sal_False;
+ bool bAlreadyMoved = false;
//search for special text attributes - first some ends
sal_uInt16 nEndIndex = 0;
sal_uInt16 nNextEnd = 0;
@@ -490,29 +490,31 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
case RES_TXTATR_TOXMARK:
lcl_InsertTOXMarkPortion(
rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
- ePortionType = PORTION_TEXT;
+ rePortionType = PORTION_TEXT;
break;
case RES_TXTATR_REFMARK:
lcl_InsertRefMarkPortion(
rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
- ePortionType = PORTION_TEXT;
+ rePortionType = PORTION_TEXT;
break;
case RES_TXTATR_CJK_RUBY:
+ //#i91534# GetEnd() == 0 mixes the order of ruby start/end
+ if( *pAttr->GetEnd() == *pAttr->GetStart())
+ {
+ lcl_InsertRubyPortion(
+ rPortionArr, pUnoCrsr, rParent, pAttr, sal_False);
+ }
lcl_InsertRubyPortion(
- rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
- ePortionType = PORTION_TEXT;
+ rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
+ rePortionType = PORTION_TEXT;
break;
}
}
}
nEndIndex++;
}
- //#111716# the cursor must not move right at the end position of a selection!
- BOOL bRightMoveForbidden = FALSE;
- if(nEndPos > 0 && nCurrentIndex >= nEndPos)
- bRightMoveForbidden = TRUE;
- //then som starts
+ // then some starts
sal_uInt16 nStartIndex = 0;
sal_uInt16 nNextStart = 0;
while(nStartIndex < pHints->GetStartCount() &&
@@ -529,29 +531,29 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
switch( nAttrWhich )
{
case RES_TXTATR_FIELD:
- if(!bRightMoveForbidden)
+ if(!io_rbRightMoveForbidden)
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
break;
- bAttrFound = sal_True;
- ePortionType = PORTION_FIELD;
+ bAlreadyMoved = true;
+ rePortionType = PORTION_FIELD;
}
break;
case RES_TXTATR_FLYCNT :
- if(!bRightMoveForbidden)
+ if(!io_rbRightMoveForbidden)
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
break; // Robust #i81708 content in covered cells
pUnoCrsr->Exchange();
- bAttrFound = sal_True;
- ePortionType = PORTION_FRAME;
+ bAlreadyMoved = true;
+ rePortionType = PORTION_FRAME;
}
break;
case RES_TXTATR_FTN :
{
- if(!bRightMoveForbidden)
+ if(!io_rbRightMoveForbidden)
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
@@ -563,8 +565,8 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
SwXFootnotes::GetObject(*pDoc, pAttr->SwTxtAttr::GetFtn()),
UNO_QUERY);
pPortion->SetFootnote(xContent);
- bAttrFound = sal_True;
- ePortionType = PORTION_TEXT;
+ bAlreadyMoved = true;
+ rePortionType = PORTION_TEXT;
}
}
break;
@@ -577,12 +579,12 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
pUnoCrsr, rParent, PORTION_CONTROL_CHAR)),
rPortionArr.Count());
pPortion->SetControlChar(3);
- ePortionType = PORTION_TEXT;
+ rePortionType = PORTION_TEXT;
}
break;
case RES_TXTATR_HARDBLANK:
{
- ePortionType = PORTION_CONTROL_CHAR;
+ rePortionType = PORTION_CONTROL_CHAR;
SwXTextPortion* pPortion = 0;
rPortionArr.Insert(
new Reference< XTextRange >(
@@ -594,26 +596,26 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
pPortion->SetControlChar(2);//HARD_HYPHEN
else
pPortion->SetControlChar(4);//HARD_SPACE
- ePortionType = PORTION_TEXT;
+ rePortionType = PORTION_TEXT;
}
break;
case RES_TXTATR_TOXMARK:
lcl_InsertTOXMarkPortion(
rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
- ePortionType = PORTION_TEXT;
+ rePortionType = PORTION_TEXT;
break;
case RES_TXTATR_REFMARK:
- if(!bRightMoveForbidden || pAttr->GetEnd())
+ if(!io_rbRightMoveForbidden || pAttr->GetEnd())
{
if(!pAttr->GetEnd())
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
- bAttrFound = sal_True;
+ bAlreadyMoved = true;
}
lcl_InsertRefMarkPortion(
rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
- ePortionType = PORTION_TEXT;
+ rePortionType = PORTION_TEXT;
if(!pAttr->GetEnd())
{
if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark())
@@ -623,11 +625,12 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
}
break;
case RES_TXTATR_CJK_RUBY:
- if(pAttr->GetEnd())
+ //#i91534# GetEnd() == 0 mixes the order of ruby start/end
+ if(pAttr->GetEnd() && (*pAttr->GetEnd() != *pAttr->GetStart()))
{
lcl_InsertRubyPortion(
rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
- ePortionType = PORTION_TEXT;
+ rePortionType = PORTION_TEXT;
}
break;
default:
@@ -638,7 +641,7 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
nStartIndex++;
}
- if(!bAttrFound)
+ if (!bAlreadyMoved)
{
// search for attribute changes behind the current cursor position
// break up at frames, bookmarks, redlines
@@ -654,37 +657,54 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
while(nEndIndex < pHints->GetEndCount() &&
nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetAnyEnd())))
nEndIndex++;
- //nMovePos legt die neue EndPosition fest
- sal_uInt16 nMovePos = nNextStart > nCurrentIndex && nNextStart < nNextEnd ? nNextStart : nNextEnd;
- if (nMovePos <= nCurrentIndex)
- nMovePos = pUnoCrsr->GetCntntNode()->Len();
- if(nEndPos >= 0 && nMovePos > nEndPos)
- nMovePos = (USHORT)nEndPos;
-
- if(aBkmArr.size() && (*aBkmArr.begin())->getIndex() < nMovePos)
- {
- DBG_ASSERT((*aBkmArr.begin())->getIndex() > nCurrentIndex,
- "forgotten bookmark(s)");
- nMovePos = (sal_uInt16)(*aBkmArr.begin())->getIndex();
- }
- // break up portions for redlines
- if (aRedArr.size() && (*aRedArr.begin())->getRealIndex() < nMovePos)
+ sal_Int32 nNextPos =
+ ((nNextStart > nCurrentIndex) && (nNextStart < nNextEnd))
+ ? nNextStart : nNextEnd;
+ if (nNextPos > nCurrentIndex)
{
- nMovePos = (sal_uInt16)(*aRedArr.begin())->getRealIndex();
+ o_rNextAttrPosition = nNextPos;
}
- // break up portions for soft page breaks
- if (aBreakArr.size() && *aBreakArr.begin() < nMovePos)
- {
- nMovePos = *aBreakArr.begin();
- }
- // break up if the destination is behind a frame
- if(nFirstFrameIndex != STRING_MAXLEN && nMovePos > nFirstFrameIndex)
- nMovePos = nFirstFrameIndex;
+ }
+ else
+ {
+ io_rbRightMoveForbidden = true;
+ }
+ return xRef;
+}
+
+void lcl_MoveCursor( SwUnoCrsr* pUnoCrsr,
+ const xub_StrLen nCurrentIndex,
+ const sal_Int32 nNextFrameIndex, const sal_Int32 nNextPortionIndex,
+ const sal_Int32 nNextAttrIndex, const sal_Int32 nEndPos )
+{
+ sal_Int32 nMovePos = pUnoCrsr->GetCntntNode()->Len();
+
+ if ((nEndPos >= 0) && (nEndPos < nMovePos))
+ {
+ nMovePos = nEndPos;
+ }
- if(nMovePos > nCurrentIndex)
+ if ((nNextFrameIndex >= 0) && (nNextFrameIndex < nMovePos))
+ {
+ nMovePos = nNextFrameIndex;
+ }
+
+ if ((nNextPortionIndex >= 0) && (nNextPortionIndex < nMovePos))
+ {
+ nMovePos = nNextPortionIndex;
+ }
+
+ if ((nNextAttrIndex >= 0) && (nNextAttrIndex < nMovePos))
+ {
+ nMovePos = nNextAttrIndex;
+ }
+
+ if (nMovePos > nCurrentIndex)
+ {
// pUnoCrsr->Right(nMovePos - nCurrentIndex);
- pUnoCrsr->GetPoint()->nContent = nMovePos;
+ pUnoCrsr->GetPoint()->nContent = static_cast<USHORT>(nMovePos);
+ }
else if(nEndPos < 0 || nCurrentIndex < nEndPos)
{
// ensure proper exit: move to paragraph end
@@ -696,8 +716,6 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
"may only happen at paragraph end");
pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
}
- }
- return xRef;
}
//-----------------------------------------------------------------------------
@@ -757,8 +775,7 @@ void lcl_ExportRedline(
{
rPortionArr.Insert(
new Reference< XTextRange >( new SwXRedlinePortion(
- pPtr->pRedline, *pUnoCrsr, rParent,
- pPtr->bStart)),
+ pPtr->pRedline, pUnoCrsr, rParent, pPtr->bStart)),
rPortionArr.Count());
rRedlineArr.erase ( aIter++ );
}
@@ -823,6 +840,7 @@ void SwXTextPortionEnumeration::CreatePortions()
DBG_ASSERT(pUnoCrsr->Start()->nNode.GetNode().GetTxtNode() &&
nStartPos <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->GetTxt().Len(),
"Incorrect start position" );
+ // ??? should this be nStartPos - current position ?
pUnoCrsr->Right((xub_StrLen)nStartPos,CRSR_SKIP_CHARS,FALSE,FALSE);
}
if(pUnoCrsr /*&& !bAtEnd*/)
@@ -932,58 +950,34 @@ void SwXTextPortionEnumeration::CreatePortions()
}
if(!xRef.is())
{
- lcl_ExportBkmAndRedline(aBkmArr, aRedArr, aBreakArr, nCurrentIndex, pUnoCrsr, xParent, aPortionArr);
- if(pHints)
+ lcl_ExportBkmAndRedline(aBkmArr, aRedArr, aBreakArr,
+ nCurrentIndex, pUnoCrsr, xParent, aPortionArr);
+ sal_Int32 nNextAttrIndex = -1;
+ sal_Int32 nNextPortionIndex =
+ lcl_GetNextIndex(aBkmArr, aRedArr, aBreakArr);
+ // #111716# the cursor must not move right at the
+ // end position of a selection!
+ bool bRightMoveForbidden =
+ ((nEndPos > 0) && (nCurrentIndex >= nEndPos));
+ if (pHints)
{
- xRef = lcl_ExportHints(pHints,
- aPortionArr,
- pUnoCrsr,
- xParent,
- nCurrentIndex,
- ePortionType,
- nFirstFrameIndex,
- aBkmArr,
- aRedArr,
- aBreakArr,
- nEndPos);
+ // N.B.: side-effects bRightMoveForbidden
+ // and nNextAttrIndex
+ xRef = lcl_ExportHints(pHints, aPortionArr,
+ pUnoCrsr, xParent, nCurrentIndex, ePortionType,
+ bRightMoveForbidden, nNextAttrIndex);
}
- else if(USHRT_MAX != nFirstFrameIndex)
+ if (!bRightMoveForbidden)
{
- pUnoCrsr->Right(nFirstFrameIndex - nCurrentIndex,CRSR_SKIP_CHARS,FALSE,FALSE);
- }
- else
- {
- sal_Int32 nNextIndex = lcl_GetNextIndex(aBkmArr, aRedArr, aBreakArr);
- DBG_ASSERT( nNextIndex <= pCNd->Len(), "illegal next index" );
- if( nNextIndex > pCNd->Len() )
- {
- nNextIndex = pCNd->Len();
- bAtEnd = sal_True;
- }
- if(nEndPos >= 0 && (nNextIndex > nEndPos || nNextIndex < 0))
- {
- nNextIndex = nEndPos;
- bAtEnd = sal_True;
- }
- if(nNextIndex < 0)
- {
- // a text portion should stay within it's paragraph (#i56165)
- //sal_Bool bMove = pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
- pUnoCrsr->GetPoint()->nContent = pCNd->Len();
- bAtEnd = sal_True;
- }
- else
- {
- DBG_ASSERT(nNextIndex > nCurrentIndex || nNextIndex == nEndPos,
- "wrong move index");
- pUnoCrsr->Right((sal_uInt16)(nNextIndex - nCurrentIndex),CRSR_SKIP_CHARS,FALSE,FALSE);
- }
+ lcl_MoveCursor(pUnoCrsr, nCurrentIndex,
+ nFirstFrameIndex, nNextPortionIndex,
+ nNextAttrIndex, nEndPos);
}
}
if(!xRef.is() && pUnoCrsr->HasMark() ) {
//flr: maybe its a good idea to add a special hint to the hints array and rely on the hint segmentation....
- xub_StrLen start=pUnoCrsr->GetMark()->nContent.GetIndex();
- xub_StrLen end=pUnoCrsr->GetPoint()->nContent.GetIndex();
+ xub_StrLen start=pUnoCrsr->Start()->nContent.GetIndex();
+ xub_StrLen end=pUnoCrsr->End()->nContent.GetIndex();
ASSERT(start<=end, "hmm --- why is this different");
xub_StrLen startMarkerPos=pTxtNode->GetTxt().Search(CH_TXT_ATR_FIELDSTART, start);
xub_StrLen endMarkerPos=pTxtNode->GetTxt().Search(CH_TXT_ATR_FIELDEND, start);
@@ -1082,17 +1076,15 @@ void SwXTextPortionEnumeration::CreatePortions()
if(pHints)
{
SwTextPortionType ePortionType = PORTION_TEXT;
+ bool bDummy = false;
+ sal_Int32 nDummy = -1;
Reference<XTextRange> xRef = lcl_ExportHints(pHints,
aPortionArr,
pUnoCrsr,
xParent,
static_cast< xub_StrLen >(nLocalEnd),
ePortionType,
- STRING_MAXLEN,
- aBkmArr,
- aRedArr,
- aBreakArr,
- nEndPos);
+ bDummy, nDummy);
if(xRef.is())
aPortionArr.Insert(new Reference<XTextRange>(xRef), aPortionArr.Count());
}
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index 262adba59ddf..7b58a4120de7 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -778,7 +778,8 @@ const SwPropNameTab aPropNameTab = {
/* 0733 CHAR_OVERLINE */ {MAP_CHAR_LEN("CharOverline")},
/* 0734 CHAR_OVERLINE_COLOR */ {MAP_CHAR_LEN("CharOverlineColor")},
/* 0735 CHAR_OVERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharOverlineHasColor")},
-/* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")}//#outline level,add<-zhaojianwei Outlinelevel
+/* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
+/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")}
};
const SwPropNameLen& SwGetPropName( USHORT nId )
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 3b3347c16a4a..0df45c83458a 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -2041,8 +2041,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
case 15: //"BulletId",
{
sal_Int16 nSet = 0;
- pData->aVal >>= nSet;
- if(nSet < 0xff)
+ if( pData->aVal >>= nSet )
aFmt.SetBulletChar(nSet);
else
bWrongArg = sal_True;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index e4aed674e7ae..20dde56ead7d 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -79,9 +79,7 @@
#include <com/sun/star/style/PageStyleLayout.hpp>
#include <com/sun/star/style/BreakType.hpp>
#include <com/sun/star/style/GraphicLocation.hpp>
-#ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
#include <com/sun/star/chart/XChartDataChangeEventListener.hpp>
#include <com/sun/star/chart/ChartDataChangeEvent.hpp>
#include <com/sun/star/chart2/data/XDataSequence.hpp>
@@ -1600,7 +1598,7 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt* pFmt, SwTableBox* pBox) :
SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
pUnoCrsr->Move( fnMoveForward, fnGoNode );
pUnoCrsr->Add(&aCrsrDepend);
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pTblCrsr->MakeBoxSels();
}
/*-- 11.12.98 12:16:14---------------------------------------------------
@@ -1618,12 +1616,12 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt& rTableFmt, const SwTableCursor*
*pUnoCrsr->GetMark() = *pTableSelection->GetMark();
}
const SwSelBoxes& rBoxes = pTableSelection->GetBoxes();
- SwTableCursor* pTableCrsr = (SwTableCursor*) *pUnoCrsr;
+ SwTableCursor* pTableCrsr = dynamic_cast<SwTableCursor*>(pUnoCrsr);
for(sal_uInt16 i = 0; i < rBoxes.Count(); i++)
pTableCrsr->InsertBox( *rBoxes.GetObject(i) );
pUnoCrsr->Add(&aCrsrDepend);
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pTblCrsr->MakeBoxSels();
}
/*-- 11.12.98 12:16:14---------------------------------------------------
@@ -1648,7 +1646,7 @@ OUString SwXTextTableCursor::getRangeName(void) throw( uno::RuntimeException )
//!! see also SwChartDataSequence::getSourceRangeRepresentation
if(pUnoCrsr)
{
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pTblCrsr->MakeBoxSels();
const SwStartNode* pNode = pTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
@@ -1689,7 +1687,7 @@ sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& CellName, sal_Bool E
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
lcl_CrsrSelect( pTblCrsr, Expand );
String sCellName(CellName);
bRet = pTblCrsr->GotoTblBox(sCellName);
@@ -1706,7 +1704,7 @@ sal_Bool SwXTextTableCursor::goLeft(sal_Int16 Count, sal_Bool Expand) throw( uno
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
lcl_CrsrSelect( pTblCrsr, Expand );
bRet = pTblCrsr->Left( Count,CRSR_SKIP_CHARS, FALSE, FALSE);
}
@@ -1722,7 +1720,7 @@ sal_Bool SwXTextTableCursor::goRight(sal_Int16 Count, sal_Bool Expand) throw( un
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
lcl_CrsrSelect( pTblCrsr, Expand );
bRet = pTblCrsr->Right( Count, CRSR_SKIP_CHARS, FALSE, FALSE);
}
@@ -1738,7 +1736,7 @@ sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool Expand) throw( uno::
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
lcl_CrsrSelect( pTblCrsr, Expand );
bRet = pTblCrsr->UpDown(sal_True, Count, 0, 0);
}
@@ -1754,7 +1752,7 @@ sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool Expand) throw( uno
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
lcl_CrsrSelect( pTblCrsr, Expand );
bRet = pTblCrsr->UpDown(sal_False, Count, 0, 0);
}
@@ -1769,7 +1767,7 @@ void SwXTextTableCursor::gotoStart(sal_Bool Expand) throw( uno::RuntimeException
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
lcl_CrsrSelect( pTblCrsr, Expand );
pTblCrsr->MoveTable(fnTableCurr, fnTableStart);
}
@@ -1783,7 +1781,7 @@ void SwXTextTableCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException )
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
lcl_CrsrSelect( pTblCrsr, Expand );
pTblCrsr->MoveTable(fnTableCurr, fnTableEnd);
}
@@ -1802,7 +1800,7 @@ sal_Bool SwXTextTableCursor::mergeRange(void) throw( uno::RuntimeException )
// hier muessen die Actions aufgehoben werden
UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
}
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pTblCrsr->MakeBoxSels();
{
@@ -1835,7 +1833,7 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) th
// hier muessen die Actions aufgehoben werden
UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
}
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pTblCrsr->MakeBoxSels();
{
UnoActionContext aContext(pUnoCrsr->GetDoc());
@@ -1877,7 +1875,7 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName,
SwStartNode* pSttNode = pUnoCrsr->GetNode()->StartOfSectionNode();
const SwTableNode* pTblNode = pSttNode->FindTableNode();
lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
const SfxItemPropertySimpleEntry* pEntry =
m_pPropSet->getPropertyMap()->getByName(rPropertyName);
if(pEntry)
@@ -1936,7 +1934,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
SwStartNode* pSttNode = pUnoCrsr->GetNode()->StartOfSectionNode();
const SwTableNode* pTblNode = pSttNode->FindTableNode();
lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
- SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
const SfxItemPropertySimpleEntry* pEntry =
m_pPropSet->getPropertyMap()->getByName(rPropertyName);
if(pEntry)
@@ -2648,7 +2646,7 @@ uno::Reference< table::XCellRange > SwXTextTable::GetRangeByName(SwFrmFmt* pFmt
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pCrsr->MakeBoxSels();
// pUnoCrsr wird uebergeben und nicht geloescht
SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, rDesc);
@@ -3322,7 +3320,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pCrsr->MakeBoxSels();
SfxItemSet aSet(pDoc->GetAttrPool(),
@@ -3517,7 +3515,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pCrsr->MakeBoxSels();
SfxItemSet aSet(pDoc->GetAttrPool(),
@@ -4011,7 +4009,7 @@ uno::Reference< table::XCellRange > SwXCellRange::getCellRangeByPosition(
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pCrsr->MakeBoxSels();
// pUnoCrsr wird uebergeben und nicht geloescht
SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, aNewDesc);
@@ -4081,7 +4079,7 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName,
// remove actions to enable box selection
UnoActionRemoveContext aRemoveContext(pDoc);
}
- SwUnoTableCrsr* pCrsr = *pTblCrsr;
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
pCrsr->MakeBoxSels();
switch(pEntry->nWID )
{
@@ -4243,7 +4241,7 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( be
RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
0L);
// erstmal die Attribute des Cursors
- SwUnoTableCrsr* pCrsr = *pTblCrsr;
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
SwXTextCursor::GetCrsrAttr(pCrsr->GetSelRing(), aSet);
m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
}
@@ -4459,7 +4457,7 @@ SwUnoCrsr * lcl_CreateCursor( SwFrmFmt &rTblFmt,
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pEndBox->GetSttNd();
pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr *pCrsr = *pUnoCrsr;
+ SwUnoTableCrsr *pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pCrsr->MakeBoxSels();
}
return pUnoCrsr;
@@ -4891,7 +4889,7 @@ void SAL_CALL SwXCellRange::sort(const uno::Sequence< beans::PropertyValue >& rD
if(pFmt &&
SwXTextCursor::convertSortProperties(rDescriptor, aSortOpt))
{
- SwUnoTableCrsr* pTableCrsr = *pTblCrsr;
+ SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
pTableCrsr->MakeBoxSels();
UnoActionContext aContext( pFmt->GetDoc() );
pFmt->GetDoc()->SortTbl(pTableCrsr->GetBoxes(), aSortOpt);
@@ -5152,7 +5150,8 @@ void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno:
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pBLBox->GetSttNd();
pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pCrsr->MakeBoxSels();
{ // Die Klammer ist wichtig
UnoActionContext aAction(pFrmFmt->GetDoc());
@@ -5384,7 +5383,8 @@ void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( u
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pTRBox->GetSttNd();
pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ SwUnoTableCrsr* pCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
pCrsr->MakeBoxSels();
{ // Die Klammer ist wichtig
UnoActionContext aAction(pFrmFmt->GetDoc());
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 7c921808b908..c00c21f5494e 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -35,9 +35,7 @@
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
#include <rtl/uuid.h>
@@ -544,96 +542,7 @@ void SwXText::insertTextContent(const uno::Reference< text::XTextRange > & xRang
xTempRange = xRange;
else
xTempRange = xRange->getStart();
- SwXTextTable* pTable = reinterpret_cast< SwXTextTable * >(
- sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXTextTable::getUnoTunnelId()) ));
-
- if(pTable)
- pTable->attachToRange(xTempRange);
- else
- {
- if(pBookmark)
- pBookmark ->attachToRange(xTempRange);
- else
- {
- if(pSection)
- pSection ->attachToRange(xTempRange);
- else
- {
- SwXFootnote* pFootnote = reinterpret_cast< SwXFootnote * >(
- sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXFootnote::getUnoTunnelId()) ));
-
- if(pFootnote)
- pFootnote->attachToRange(xTempRange);
- else
- {
- if(pReferenceMark)
- pReferenceMark->attachToRange(xTempRange);
- else
- {
- SwXFrame* pFrame = reinterpret_cast< SwXFrame * >(
- sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXFrame::getUnoTunnelId()) ));
-
- if(pFrame)
- pFrame->attachToRange(xTempRange);
- else
- {
- SwXDocumentIndex* pDocumentIndex = reinterpret_cast< SwXDocumentIndex * >(
- sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXDocumentIndex::getUnoTunnelId()) ));
-
- if(pDocumentIndex)
- pDocumentIndex->attachToRange(xTempRange);
- else
- {
- if(pDocumentIndexMark)
- pDocumentIndexMark->attachToRange(xTempRange);
- else
- {
- SwXTextField* pTextField = reinterpret_cast< SwXTextField * >(
- sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXTextField::getUnoTunnelId()) ));
-
- if(pTextField)
- pTextField->attachToRange(xTempRange);
- else
- {
- uno::Reference<beans::XPropertySet> xShapeProperties(xContent, uno::UNO_QUERY);
- SwXShape* pShape = 0;
- if(xShapeProperties.is())
- pShape = reinterpret_cast< SwXShape * >(
- sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXShape::getUnoTunnelId()) ));
- if(pShape)
- {
- uno::Any aPos(&xRange,
- ::getCppuType((uno::Reference<text::XTextRange>*)0));
- pShape->setPropertyValue(C2U("TextRange"), aPos);
-
- uno::Reference<frame::XModel> xModel =
- pDoc->GetDocShell()->GetBaseModel();
- uno::Reference<drawing::XDrawPageSupplier> xPageSupp(
- xModel, uno::UNO_QUERY);
-
- uno::Reference<drawing::XDrawPage> xPage = xPageSupp->getDrawPage();
-
- uno::Reference<drawing::XShape> xShape((cppu::OWeakObject*)pShape,
- uno::UNO_QUERY);
- //nuer die XShapes haengen an der Sw-Drawpage
- uno::Reference<drawing::XShapes> xShps(xPage, uno::UNO_QUERY);
- xShps->add(xShape);
- }
- else
- {
- lang::IllegalArgumentException aArgException;
- aArgException.Message = C2U("unknown text content");
- throw aArgException;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
+ xContent->attach(xTempRange);
}
else
{
@@ -1411,8 +1320,9 @@ uno::Reference< text::XTextRange > SwXText::finishOrAppendParagraph(
throw aEx;
}
}
- SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(*aPam.Start(), sal_False);
- xRet = new SwXParagraph(this, pUnoCrsr);
+ SwTxtNode * pTxtNode( aPam.Start()->nNode.GetNode().GetTxtNode() );
+ OSL_ENSURE(pTxtNode, "no SwTxtNode?");
+ xRet = new SwXParagraph(this, pTxtNode);
}
return xRet;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 35aeb1cda89a..65afdc46233a 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1347,7 +1347,15 @@ BOOL ViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect )
// #i75172# isolated static conditions
const bool bOnlyYScroll(!lXDiff && Abs(lYDiff) != 0 && Abs(lYDiff) < lMax);
const bool bAllowedWithChildWindows(GetWin()->GetWindowClipRegionPixel(WINDOW_GETCLIPREGION_NOCHILDREN|WINDOW_GETCLIPREGION_NULL).IsNull());
+// --> OD 2009-08-12 #i98766# - disable smooth scrolling for Mac port builds
+#ifdef QUARTZ
+ const bool bSmoothScrollAllowed(false);
+ (void) bOnlyYScroll;
+ (void) bAllowedWithChildWindows;
+#else
const bool bSmoothScrollAllowed(bOnlyYScroll && bEnableSmooth && GetViewOptions()->IsSmoothScroll() && bAllowedWithChildWindows);
+#endif
+// <-
const bool bIAmCursorShell(ISA(SwCrsrShell));
(void) bIAmCursorShell;
@@ -1971,6 +1979,11 @@ void ViewShell::Paint(const Rectangle &rRect)
//angemeldet hat, so muessen Repaints ausgeloest werden.
if ( !CheckInvalidForPaint( aRect ) )
{
+ // --> OD 2009-08-12 #i101192#
+ // start Pre/PostPaint encapsulation to avoid screen blinking
+ const Region aRepaintRegion(aRect.SVRect());
+ DLPrePaint2(aRepaintRegion);
+ // <--
PaintDesktop( aRect );
//Falls sinnvoll gleich das alte InvalidRect verarbeiten bzw.
//vernichten.
@@ -1979,6 +1992,10 @@ void ViewShell::Paint(const Rectangle &rRect)
ViewShell::bLstAct = TRUE;
GetLayout()->Paint( aRect );
ViewShell::bLstAct = FALSE;
+ // --> OD 2009-08-12 #i101192#
+ // end Pre/PostPaint encapsulation
+ DLPostPaint2(true);
+ // <--
}
//delete pSaveHdl;
@@ -2721,4 +2738,3 @@ const IDocumentOutlineNodes* ViewShell::getIDocumentOutlineNodesAccess() const
return pDoc;
}
// <--
-
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 873c2d2bda24..6775bf213736 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -36,9 +36,7 @@
#include <sfx2/printer.hxx>
#include <sfx2/objsh.hxx>
-#ifndef _INTN_HXX //autogen
// #include <tools/intn.hxx>
-#endif
#include <sfx2/progress.hxx>
#include <sfx2/app.hxx>
#include <sfx2/prnmon.hxx>
@@ -752,7 +750,7 @@ SwDoc * ViewShell::CreatePrtDoc( SfxPrinter* pPrt, SfxObjectShellRef &rDocShellR
// Wir bauen uns ein neues Dokument
SwDoc *pPrtDoc = new SwDoc;
pPrtDoc->acquire();
- pPrtDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)rDocShellRef );
+ pPrtDoc->SetRefForDocShell( boost::addressof(rDocShellRef) );
pPrtDoc->LockExpFlds();
// Der Drucker wird uebernommen
@@ -770,9 +768,11 @@ SwDoc * ViewShell::CreatePrtDoc( SfxPrinter* pPrt, SfxObjectShellRef &rDocShellR
pPrtDoc->ReplaceStyles( *GetDoc() );
SwShellCrsr *pActCrsr = pFESh->_GetCrsr();
- SwShellCrsr *pFirstCrsr = (SwShellCrsr*)*((SwCursor*)pActCrsr->GetNext());
+ SwShellCrsr *pFirstCrsr = dynamic_cast<SwShellCrsr*>(pActCrsr->GetNext());
if( !pActCrsr->HasMark() ) // bei Multiselektion kann der aktuelle Cursor leer sein
- pActCrsr = (SwShellCrsr*)*((SwCursor*)pActCrsr->GetPrev());
+ {
+ pActCrsr = dynamic_cast<SwShellCrsr*>(pActCrsr->GetPrev());
+ }
// Die Y-Position der ersten Selektion
const Point aSelPoint = pFESh->IsTableMode() ?
@@ -838,7 +838,7 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt)
// Wir bauen uns ein neues Dokument
// SwDoc *pPrtDoc = new SwDoc;
// pPrtDoc->acquire();
-// pPrtDoc->SetRefForDocShell( (SvEmbeddedObjectRef*)&(long&)rDocShellRef );
+// pPrtDoc->SetRefForDocShell( boost::addressof(rDocShellRef) );
pPrtDoc->LockExpFlds();
// Der Drucker wird uebernommen
@@ -858,9 +858,11 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt)
pPrtDoc->ReplaceStyles( *GetDoc() );
SwShellCrsr *pActCrsr = pFESh->_GetCrsr();
- SwShellCrsr *pFirstCrsr = (SwShellCrsr*)*((SwCursor*)pActCrsr->GetNext());
+ SwShellCrsr *pFirstCrsr = dynamic_cast<SwShellCrsr*>(pActCrsr->GetNext());
if( !pActCrsr->HasMark() ) // bei Multiselektion kann der aktuelle Cursor leer sein
- pActCrsr = (SwShellCrsr*)*((SwCursor*)pActCrsr->GetPrev());
+ {
+ pActCrsr = dynamic_cast<SwShellCrsr*>(pActCrsr->GetPrev());
+ }
// Die Y-Position der ersten Selektion
// Die Y-Position der ersten Selektion
diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx
index e79016c96364..92f9e1adb3d5 100644
--- a/sw/source/filter/html/htmlfly.cxx
+++ b/sw/source/filter/html/htmlfly.cxx
@@ -1640,7 +1640,7 @@ static Writer& OutHTML_FrmFmtGrfNode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
ULONG nFrmFlags = bInCntnr ? HTML_FRMOPTS_IMG_CNTNR : HTML_FRMOPTS_IMG;
if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bInCntnr )
nFrmFlags |= HTML_FRMOPTS_IMG_CSS1;
- OutHTML_Image( rWrt, rFrmFmt, aGrfNm, pGrfNd->GetAlternateText(),
+ OutHTML_Image( rWrt, rFrmFmt, aGrfNm, pGrfNd->GetTitle(),
pGrfNd->GetTwipSize(), nFrmFlags, pMarkToGraphic );
return rWrt;
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 48faa240cf7f..904648f75bd2 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -743,7 +743,7 @@ IMAGE_SETEVENT:
}
if( sAltNm.Len() )
- pGrfNd->SetAlternateText( sAltNm );
+ pGrfNd->SetTitle( sAltNm );
if( bSetTwipSize )
pGrfNd->SetTwipSize( aGrfSz );
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 9dbcc420ebfd..21e409c48530 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -491,7 +491,7 @@ void SwHTMLParser::InsertEmbed()
SwNoTxtNode *pNoTxtNd =
pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx()
->GetIndex()+1 ]->GetNoTxtNode();
- pNoTxtNd->SetAlternateText( aAlt );
+ pNoTxtNd->SetTitle( aAlt );
// Ggf Frames anlegen und auto-geb. Rahmen registrieren
if( !bHidden )
@@ -665,7 +665,7 @@ void SwHTMLParser::EndObject()
SwNoTxtNode *pNoTxtNd =
pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx()
->GetIndex()+1 ]->GetNoTxtNode();
- pNoTxtNd->SetAlternateText( pAppletImpl->GetAltText() );
+ pNoTxtNd->SetTitle( pAppletImpl->GetAltText() );
// Ggf Frames anlegen und auto-geb. Rahmen registrieren
RegisterFlyFrm( pFlyFmt );
@@ -798,7 +798,7 @@ void SwHTMLParser::EndApplet()
SwNoTxtNode *pNoTxtNd =
pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx()
->GetIndex()+1 ]->GetNoTxtNode();
- pNoTxtNd->SetAlternateText( pAppletImpl->GetAltText() );
+ pNoTxtNd->SetTitle( pAppletImpl->GetAltText() );
// Ggf Frames anlegen und auto-geb. Rahmen registrieren
RegisterFlyFrm( pFlyFmt );
@@ -975,7 +975,7 @@ void SwHTMLParser::InsertFloatingFrame()
SwNoTxtNode *pNoTxtNd =
pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx()
->GetIndex()+1 ]->GetNoTxtNode();
- pNoTxtNd->SetAlternateText( aAlt );
+ pNoTxtNd->SetTitle( aAlt );
// Ggf Frames anlegen und auto-geb. Rahmen registrieren
RegisterFlyFrm( pFlyFmt );
@@ -1254,7 +1254,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
// ALT, WIDTH, HEIGHT, HSPACE, VSPACE, ALIGN
if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bHiddenEmbed )
nFrmOpts |= HTML_FRMOPTS_OLE_CSS1;
- rHTMLWrt.OutFrmFmtOptions( rFrmFmt, pOLENd->GetAlternateText(),
+ rHTMLWrt.OutFrmFmtOptions( rFrmFmt, pOLENd->GetTitle(),
aEndTags, nFrmOpts );
if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bHiddenEmbed )
rHTMLWrt.OutCSS1_FrmFmtOptions( rFrmFmt, nFrmOpts );
@@ -1398,7 +1398,7 @@ Writer& OutHTML_FrmFmtOLENodeGrf( Writer& rWrt, const SwFrmFmt& rFrmFmt,
ULONG nFlags = bInCntnr ? HTML_FRMOPTS_GENIMG_CNTNR
: HTML_FRMOPTS_GENIMG;
OutHTML_Image( rWrt, rFrmFmt, aGrfNm,
- pOLENd->GetAlternateText(), pOLENd->GetTwipSize(),
+ pOLENd->GetTitle(), pOLENd->GetTwipSize(),
nFlags, pMarkToOLE );
}
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 49889e9c39d3..3760768006d9 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2303,7 +2303,7 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum )
SwpHints& rHints = pTxtNd->GetSwpHints();
for( sal_uInt16 i=0; i < nCntAttr; i++ )
{
- SwTxtAttr *pHt = rHints.GetHt( i );
+ SwTxtAttr *pHt = rHints.GetTextHint( i );
sal_uInt16 nWhich = pHt->Which();
sal_Int16 nIdx = -1;
if( RES_CHRATR_CJK_FONT <= nWhich &&
@@ -2613,8 +2613,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable,
( !pAttr->IsLikePara() &&
nEndParaIdx == rEndIdx.GetIndex() &&
pAttr->GetEndCnt() < nEndCnt &&
- RES_CHRATR_BEGIN <= nWhich &&
- RES_TXTATR_WITHEND_END > nWhich ) ||
+ (isCHRATR(nWhich) || isTXTATR_WITHEND(nWhich)) ) ||
( bBeforeTable &&
nEndParaIdx == rEndIdx.GetIndex() &&
!pAttr->GetEndCnt() );
@@ -2663,9 +2662,8 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable,
{
// durch die elende Loescherei von Nodes kann auch mal
// ein Index auf einen End-Node zeigen :-(
- if( pAttr->GetSttPara() == pAttr->GetEndPara() &&
- (nWhich < RES_TXTATR_NOEND_BEGIN ||
- nWhich >= RES_TXTATR_NOEND_END) )
+ if ( (pAttr->GetSttPara() == pAttr->GetEndPara()) &&
+ !isTXTATR_NOEND(nWhich) )
{
// wenn der End-Index auch auf den Node zeigt
// brauchen wir auch kein Attribut mehr zu setzen,
@@ -2696,9 +2694,8 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable,
pAttrPam->GetPoint()->nContent.Assign( pCNd, pAttr->nSttCntnt );
pAttrPam->SetMark();
- if( pAttr->GetSttPara() != pAttr->GetEndPara() &&
- (nWhich < RES_TXTATR_NOEND_BEGIN ||
- nWhich >= RES_TXTATR_NOEND_END) )
+ if ( (pAttr->GetSttPara() != pAttr->GetEndPara()) &&
+ !isTXTATR_NOEND(nWhich) )
{
pCNd = pDoc->GetNodes()[ pAttr->nEndPara ]->GetCntntNode();
if( !pCNd )
@@ -2738,8 +2735,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable,
// muessen wir es im Node davor beenden oder wegschmeissen,
// wenn es erst in dem Node beginnt
if( nWhich != RES_BREAK && nWhich != RES_PAGEDESC &&
- (nWhich < RES_TXTATR_NOEND_BEGIN ||
- nWhich >= RES_TXTATR_NOEND_END) )
+ !isTXTATR_NOEND(nWhich) )
{
if( pAttrPam->GetMark()->nNode.GetIndex() !=
rEndIdx.GetIndex() )
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index 3daf237e860d..ec836f2b8549 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -144,19 +144,37 @@ public:
void DeleteAndDestroy(Entries::size_type nCnt);
};
+class SwFltAnchorClient;
+
class SW_DLLPUBLIC SwFltAnchor : public SfxPoolItem
{
SwFrmFmt* pFrmFmt;
+ SwFltAnchorClient * pClient;
+
public:
SwFltAnchor(SwFrmFmt* pFlyFmt);
SwFltAnchor(const SwFltAnchor&);
+ virtual ~SwFltAnchor();
+
// "pure virtual Methoden" vom SfxPoolItem
virtual int operator==(const SfxPoolItem&) const;
virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
- const SwFrmFmt* GetFrmFmt() const { return pFrmFmt; }
- SwFrmFmt* GetFrmFmt() { return pFrmFmt; }
+ void SetFrmFmt(SwFrmFmt * _pFrmFmt);
+ const SwFrmFmt* GetFrmFmt() const;
+ SwFrmFmt* GetFrmFmt();
+};
+
+class SwFltAnchorClient : public SwClient
+{
+ SwFltAnchor * m_pFltAnchor;
+
+public:
+ SwFltAnchorClient(SwFltAnchor * pFltAnchor);
+
+ virtual void Modify (SfxPoolItem *pOld, SfxPoolItem *pNew);
};
+
class SW_DLLPUBLIC SwFltRedline : public SfxPoolItem
{
public:
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index 1e66aacbf7de..cb2c5dda9635 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -146,9 +146,7 @@ namespace sw
struct AuthorInfo;
typedef AuthorInfo* AuthorInfo_Ptr;
- //-----------------------------------------
- // Redlining Authors
- //-----------------------------------------
+ /// Redlining Authors
struct AuthorInfo
{
USHORT nWWAuthorId;
diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx
index 7283c640abc3..267789d41e3c 100644
--- a/sw/source/filter/inc/wrtswtbl.hxx
+++ b/sw/source/filter/inc/wrtswtbl.hxx
@@ -34,6 +34,8 @@
#include <tools/color.hxx>
#include <svtools/svarray.hxx>
+#include <swdllapi.h>
+
class Color;
class SwTableBox;
class SwTableLine;
@@ -299,6 +301,13 @@ protected:
public:
static long GetBoxWidth( const SwTableBox *pBox );
+
+ USHORT GetRawWidth( USHORT nCol, USHORT nColSpan ) const;
+ USHORT GetAbsWidth( USHORT nCol, USHORT nColSpan ) const;
+ USHORT GetRelWidth( USHORT nCol, USHORT nColSpan ) const;
+ USHORT GetPrcWidth( USHORT nCol, USHORT nColSpan ) const;
+
+ long GetAbsHeight( long nRawWidth, USHORT nRow, USHORT nRowSpan ) const;
protected:
long GetLineHeight( const SwTableLine *pLine );
@@ -309,12 +318,6 @@ protected:
USHORT GetLeftSpace( USHORT nCol ) const;
USHORT GetRightSpace( USHORT nCol, USHORT nColSpan ) const;
- USHORT GetRawWidth( USHORT nCol, USHORT nColSpan ) const;
- USHORT GetAbsWidth( USHORT nCol, USHORT nColSpan ) const;
- USHORT GetRelWidth( USHORT nCol, USHORT nColSpan ) const;
- USHORT GetPrcWidth( USHORT nCol, USHORT nColSpan ) const;
-
- long GetAbsHeight( long nRawWidth, USHORT nRow, USHORT nRowSpan ) const;
public:
SwWriteTable( const SwTableLines& rLines, long nWidth, USHORT nBWidth,
diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx
index 88dc0da19562..d1b0f0f7859c 100644
--- a/sw/source/filter/rtf/rtfatr.cxx
+++ b/sw/source/filter/rtf/rtfatr.cxx
@@ -230,6 +230,8 @@ void OutRTF_SfxItemSet( SwRTFWriter& rWrt, const SfxItemSet& rSet,
( *pItem != rPool.GetDefaultItem( nWhich )
|| ( rSet.GetParent() &&
*pItem != rSet.GetParent()->Get( nWhich ) )
+ || ( rWrt.GetAttrSet() &&
+ *pItem != rWrt.GetAttrSet()->Get( nWhich ) )
) )
;
else
@@ -1328,8 +1330,6 @@ static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
nChrCnt = nStrPos & 0xff00;
}
- HandleHyperlinks(rWrt, pNd->GetpSwpHints(), nStrPos);
-
if( nAttrPos < nCntAttr && *pHt->GetStart() == nStrPos
&& nStrPos != nEnde )
{
@@ -1361,6 +1361,8 @@ static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
else
aEndPosLst.OutScriptChange( nStrPos );
+ HandleHyperlinks(rWrt, pNd->GetpSwpHints(), nStrPos);
+
if( rRTFWrt.bOutFmtAttr )
rRTFWrt.Strm() << ' ';
@@ -1760,17 +1762,29 @@ static void OutSwTblBorder(SwRTFWriter& rWrt, const SvxBoxItem& rBox,
{
BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT
};
+#ifdef __MINGW32__
+ static const char* aBorderNames[] __attribute__((section(".data"))) =
+#else
static const char* aBorderNames[] =
+#endif
{
OOO_STRING_SVTOOLS_RTF_CLBRDRT, OOO_STRING_SVTOOLS_RTF_CLBRDRL, OOO_STRING_SVTOOLS_RTF_CLBRDRB, OOO_STRING_SVTOOLS_RTF_CLBRDRR
};
//Yes left and top are swapped with eachother for cell padding! Because
//that's what the thunderingly annoying rtf export/import word xp does.
+#ifdef __MINGW32__
+ static const char* aCellPadNames[] __attribute__((section(".data"))) =
+#else
static const char* aCellPadNames[] =
+#endif
{
OOO_STRING_SVTOOLS_RTF_CLPADL, OOO_STRING_SVTOOLS_RTF_CLPADT, OOO_STRING_SVTOOLS_RTF_CLPADB, OOO_STRING_SVTOOLS_RTF_CLPADR
};
+#ifdef __MINGW32__
+ static const char* aCellPadUnits[] __attribute__((section(".data"))) =
+#else
static const char* aCellPadUnits[] =
+#endif
{
OOO_STRING_SVTOOLS_RTF_CLPADFL, OOO_STRING_SVTOOLS_RTF_CLPADFT, OOO_STRING_SVTOOLS_RTF_CLPADFB, OOO_STRING_SVTOOLS_RTF_CLPADFR
};
@@ -1895,7 +1909,12 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode)
const SwWriteTableCells& rCells = pRow->GetCells();
BOOL bFixRowHeight = false;
- for( nColCnt = 0, nBox = 0; nBox < rCells.Count(); ++nColCnt )
+
+ USHORT nBoxes = rCells.Count();
+ if (nColCnt < nBoxes)
+ nBoxes = nColCnt;
+
+ for( nColCnt = 0, nBox = 0; nBox < rCells.Count() && nColCnt < nBoxes; ++nColCnt )
{
SwWriteTableCell* pCell = rCells[ nBox ];
const bool bProcessCoveredCell = bNewTableModel && 0 == pCell->GetRowSpan();
@@ -1972,7 +1991,11 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode)
{
BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT
};
+#ifdef __MINGW32__
+ static const char* aRowPadNames[] __attribute__((section(".data"))) =
+#else
static const char* aRowPadNames[] =
+#endif
{
OOO_STRING_SVTOOLS_RTF_TRPADDT, OOO_STRING_SVTOOLS_RTF_TRPADDL, OOO_STRING_SVTOOLS_RTF_TRPADDB, OOO_STRING_SVTOOLS_RTF_TRPADDR
};
@@ -1994,7 +2017,7 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode)
for( nBox = 0; nBox < nColCnt; ++nBox )
{
SwWriteTableCell* pCell = pBoxArr[ nBox ];
- if( nBox && pBoxArr[ nBox-1 ] == pBoxArr[ nBox ] )
+ if( (nBox && pBoxArr[ nBox-1 ] == pBoxArr[ nBox ]) || (pCell == NULL) )
continue;
const SwFrmFmt& rFmt = *pCell->GetBox()->GetFrmFmt();
@@ -2045,15 +2068,17 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode)
// Inhalt der Boxen ausgeben
rWrt.Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
- for( nBox = 0; nBox < nColCnt; ++nBox )
+ for( nBox = 0; nBox < nBoxes; ++nBox )
{
- if( nBox && pBoxArr[ nBox-1 ] == pBoxArr[ nBox ] )
+ SwWriteTableCell * pCell = pBoxArr[nBox];
+
+ if( (nBox && pBoxArr[ nBox-1 ] == pBoxArr[ nBox ]) || pCell == NULL)
continue;
- if( pBoxArr[ nBox ]->GetRowSpan() == pRowSpans[ nBox ] )
+ if( pCell->GetRowSpan() == pRowSpans[ nBox ] )
{
// new Box
- const SwStartNode* pSttNd = pBoxArr[ nBox ]->GetBox()->GetSttNd();
+ const SwStartNode* pSttNd = pCell->GetBox()->GetSttNd();
RTFSaveData aSaveData( rRTFWrt,
pSttNd->GetIndex()+1, pSttNd->EndOfSectionIndex() );
rRTFWrt.bOutTable = TRUE;
diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx
index ad012153b78c..e4f1adc8850c 100644
--- a/sw/source/filter/rtf/rtffly.cxx
+++ b/sw/source/filter/rtf/rtffly.cxx
@@ -263,20 +263,26 @@ void SwRTFParser::SetFlysInDoc()
pSttNd->GetIndex() + 1 == pEndNd->GetIndex()
&& pSttNd->GetTxt().Len()>0 /* #i38227# leave drop caps with no content as fly frames */ )
{
+ ULONG nPos = pSttNd->GetIndex();
+ SwDoc * pDoc1 = pSttNd->GetDoc();
+
BOOL bJoined;
{
- SwPaM aTmp( *pEndNd, 0, *pSttNd, pSttNd->GetTxt().Len() );
- bJoined = pDoc->DeleteAndJoin( aTmp );
+ SwPaM aTmp( *pSttNd, pSttNd->GetTxt().Len(), *pEndNd, 0 );
+ bJoined = pDoc1->DeleteAndJoin( aTmp );
}
- if( bJoined )
+
+ SwTxtNode * pNd = (pDoc1->GetNodes()[nPos])->GetTxtNode();
+
+ if( bJoined && pNd != NULL)
{
SwFmtDrop aDropCap;
aDropCap.GetLines() = (BYTE)pFlySave->nDropLines;
aDropCap.GetChars() = 1;
SwIndex aIdx( pEndNd );
- pEndNd->RstAttr( aIdx, 1, RES_CHRATR_FONTSIZE );
- pEndNd->SetAttr( aDropCap );
+ pNd->RstAttr( aIdx, 1, RES_CHRATR_FONTSIZE );
+ pNd->SetAttr( aDropCap );
}
delete pFlySave;
continue;
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index f390f87a4168..6f092a855760 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -1650,7 +1650,8 @@ void fixKeepAndSplitAttributes(SwTableNode *pTableNode)
SwTableLine* pSplitLine = rLns[ nLines-2 ];
SwTableBox* pSplitBox = pSplitLine->GetTabBoxes()[ 0 ];
SwNodeIndex aSplitIdx( *pSplitBox->GetSttNd() );
- pDoc->SplitTable( aSplitIdx, HEADLINE_NONE, !isTableKeep );
+ pDoc->SplitTable( SwPosition(aSplitIdx), HEADLINE_NONE,
+ !isTableKeep );
SwTable& rSplitTable=aSplitIdx.GetNode().FindTableNode()->GetTable();
aSplitIdx-=2;
pDoc->GetNodes().Delete(aSplitIdx);
@@ -1668,7 +1669,7 @@ void fixKeepAndSplitAttributes(SwTableNode *pTableNode)
if (isTableKeep)
{
SwNodeIndex aTmpIdx( *pBox->GetSttNd() );
- pDoc->SplitTable( aTmpIdx, HEADLINE_NONE, FALSE );
+ pDoc->SplitTable( SwPosition(aTmpIdx), HEADLINE_NONE, FALSE );
SwTable& rSplitTable=aTmpIdx.GetNode().FindTableNode()->GetTable();
aTmpIdx-=2;
pDoc->GetNodes().Delete(aTmpIdx);
@@ -1947,7 +1948,9 @@ void SwRTFParser::NextToken( int nToken )
break;
case RTF_REVDTTM:
- pRedlineInsert->aStamp = sw::ms::DTTM2DateTime(nTokenValue);
+ if (pRedlineInsert != NULL)
+ pRedlineInsert->aStamp = sw::ms::DTTM2DateTime(nTokenValue);
+
break;
case RTF_REVDTTMDEL:
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index cde2254a1428..7500adf65ef6 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -223,7 +223,7 @@ sal_Int32 Writer::FindPos_Bkmk(const SwPosition& rPos) const
SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx,
- BOOL bNodesArray ) const
+ BOOL bNodesArray )
{
SwNodes* pNds = bNodesArray ? &rDoc.GetNodes() : (SwNodes*)rDoc.GetUndoNds();
@@ -231,7 +231,7 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx,
SwCntntNode* pCNode = aStt.GetNode().GetCntntNode();
if( !pCNode && 0 == ( pCNode = pNds->GoNext( &aStt )) )
{
- ASSERT( !this, "An StartPos kein ContentNode mehr" );
+ ASSERT( false, "An StartPos kein ContentNode mehr" );
}
SwPaM* pNew = new SwPaM( aStt );
@@ -240,7 +240,7 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx,
if( 0 == (pCNode = aStt.GetNode().GetCntntNode()) &&
0 == (pCNode = pNds->GoPrevious( &aStt )) )
{
- ASSERT( !this, "An StartPos kein ContentNode mehr" );
+ ASSERT( false, "An StartPos kein ContentNode mehr" );
}
pCNode->MakeEndIndex( &pNew->GetPoint()->nContent );
pNew->GetPoint()->nNode = aStt;
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 5e36c9aedb79..b66adc860f45 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -33,6 +33,7 @@
#include <ctype.h>
#include <hintids.hxx>
+#include <hints.hxx>
#ifndef _GRAPH_HXX //autogen
#include <vcl/graph.hxx>
@@ -176,7 +177,6 @@ BOOL SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, BOOL bCheck )
return TRUE;
}
-
SwFltControlStack::SwFltControlStack(SwDoc* pDo, ULONG nFieldFl)
: nFieldFlags(nFieldFl), pDoc(pDo), bIsEndStack(false)
{
@@ -427,16 +427,20 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
{
case RES_FLTR_ANCHOR:
{
- MakePoint(pEntry, pDoc, aRegion);
SwFrmFmt* pFmt = ((SwFltAnchor*)pEntry->pAttr)->GetFrmFmt();
- SwFmtAnchor aAnchor(pFmt->GetAnchor());
- aAnchor.SetAnchor(aRegion.GetPoint());
- pFmt->SetFmtAttr(aAnchor);
- // Damit die Frames bei Einfuegen in existierendes Doc
- // erzeugt werden (erst nach Setzen des Ankers!):
- if(pDoc->GetRootFrm()
- && FLY_AT_CNTNT == pFmt->GetAnchor().GetAnchorId()){
- pFmt->MakeFrms();
+ if (pFmt != NULL)
+ {
+ MakePoint(pEntry, pDoc, aRegion);
+ SwFmtAnchor aAnchor(pFmt->GetAnchor());
+ aAnchor.SetAnchor(aRegion.GetPoint());
+ pFmt->SetFmtAttr(aAnchor);
+ // Damit die Frames bei Einfuegen in existierendes Doc
+ // erzeugt werden (erst nach Setzen des Ankers!):
+ if(pDoc->GetRootFrm()
+ && FLY_AT_CNTNT == pFmt->GetAnchor().GetAnchorId())
+ {
+ pFmt->MakeFrms();
+ }
}
}
break;
@@ -728,11 +732,35 @@ void SwFltControlStack::Delete(const SwPaM &rPam)
SwFltAnchor::SwFltAnchor(SwFrmFmt* pFmt) :
SfxPoolItem(RES_FLTR_ANCHOR), pFrmFmt(pFmt)
{
+ pClient = new SwFltAnchorClient(this);
+ pFrmFmt->Add(pClient);
}
SwFltAnchor::SwFltAnchor(const SwFltAnchor& rCpy) :
SfxPoolItem(RES_FLTR_ANCHOR), pFrmFmt(rCpy.pFrmFmt)
{
+ pClient = new SwFltAnchorClient(this);
+ pFrmFmt->Add(pClient);
+}
+
+SwFltAnchor::~SwFltAnchor()
+{
+ delete pClient;
+}
+
+void SwFltAnchor::SetFrmFmt(SwFrmFmt * _pFrmFmt)
+{
+ pFrmFmt = _pFrmFmt;
+}
+
+const SwFrmFmt * SwFltAnchor::GetFrmFmt() const
+{
+ return pFrmFmt;
+}
+
+SwFrmFmt * SwFltAnchor::GetFrmFmt()
+{
+ return pFrmFmt;
}
int SwFltAnchor::operator==(const SfxPoolItem& rItem) const
@@ -745,6 +773,29 @@ SfxPoolItem* __EXPORT SwFltAnchor::Clone(SfxItemPool*) const
return new SwFltAnchor(*this);
}
+// SwFltAnchorClient
+
+SwFltAnchorClient::SwFltAnchorClient(SwFltAnchor * pFltAnchor)
+: m_pFltAnchor(pFltAnchor)
+{
+}
+
+void SwFltAnchorClient::Modify(SfxPoolItem *, SfxPoolItem * pNew)
+{
+ if (pNew->Which() == RES_FMT_CHG)
+ {
+ SwFmtChg * pFmtChg = dynamic_cast<SwFmtChg *> (pNew);
+
+ if (pFmtChg != NULL)
+ {
+ SwFrmFmt * pFrmFmt = dynamic_cast<SwFrmFmt *> (pFmtChg->pChangedFmt);
+
+ if (pFrmFmt != NULL)
+ m_pFltAnchor->SetFrmFmt(pFrmFmt);
+ }
+ }
+}
+
//------ hier stehen die Methoden von SwFltRedline -----------
int SwFltRedline::operator==(const SfxPoolItem& rItem) const
{
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx
index eb3dfe80b5d0..79cb9b714187 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -190,7 +190,9 @@ WW8TableNodeInfo::~WW8TableNodeInfo()
}
#ifdef DEBUG
- sResult += dbg_out(*mpNode);
+//!! does not compile with debug=t -> unresolved external (dbg_out),
+//!! sommeone who knows what he wants to get should fix this
+// sResult += dbg_out(*mpNode);
#endif
sResult +="</tableNodeInfo>";
@@ -557,8 +559,7 @@ WW8TableNodeInfo::Pointer_t WW8TableInfo::insertTableNodeInfo
if (pNodeInfo.get() == NULL)
{
- pNodeInfo = WW8TableNodeInfo::Pointer_t
- (new WW8TableNodeInfo(pNode));
+ pNodeInfo = WW8TableNodeInfo::Pointer_t(new WW8TableNodeInfo(pNode));
mMap.insert(Map_t::value_type(pNode, pNodeInfo));
}
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
new file mode 100644
index 000000000000..98f2f6074349
--- /dev/null
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -0,0 +1,584 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ATTRIBUTEOUTPUTBASE_HXX_
+#define _ATTRIBUTEOUTPUTBASE_HXX_
+
+#include "fields.hxx"
+#include "WW8TableInfo.hxx"
+
+#include <rtl/textenc.h>
+#include <svx/svxenum.hxx>
+#include <tools/solar.h>
+
+#include <swtypes.hxx>
+#include <wrtswtbl.hxx>
+#include <fldbas.hxx>
+
+#include <vector>
+
+class Point;
+class SvxCaseMapItem;
+class SvxColorItem;
+class SvxContourItem;
+class SvxCrossedOutItem;
+class SvxEscapementItem;
+class SvxFontItem;
+class SvxFontHeightItem;
+class SvxKerningItem;
+class SvxLanguageItem;
+class SvxPostureItem;
+class SvxShadowedItem;
+class SvxUnderlineItem;
+class SvxWeightItem;
+class SvxAutoKernItem;
+class SvxBlinkItem;
+class SvxBrushItem;
+class SvxFontItem;
+class SvxFontHeightItem;
+class SvxLanguageItem;
+class SvxPostureItem;
+class SvxWeightItem;
+class SvxFontItem;
+class SvxFontHeightItem;
+class SvxLanguageItem;
+class SvxPostureItem;
+class SvxWeightItem;
+class SvxCharRotateItem;
+class SvxEmphasisMarkItem;
+class SvxTwoLinesItem;
+class SvxCharScaleWidthItem;
+class SvxCharReliefItem;
+class SvxCharHiddenItem;
+class SwFmtINetFmt;
+class SwFmtCharFmt;
+class SwFmtFld;
+class SwFmtFlyCnt;
+class SwFmtFtn;
+class SwFmtHardBlank;
+class SvxLineSpacingItem;
+class SvxAdjustItem;
+class SvxFmtSplitItem;
+class SvxWidowsItem;
+class SvxTabStopItem;
+class SvxHyphenZoneItem;
+class SwNumRuleItem;
+class SfxBoolItem;
+class SfxPoolItem;
+class SfxItemSet;
+class SvxParaVertAlignItem;
+class SvxParaGridItem;
+class SwFmtFrmSize;
+class SvxPaperBinItem;
+class SvxLRSpaceItem;
+class SvxULSpaceItem;
+class SwFmtPageDesc;
+class SvxFmtBreakItem;
+class SwFmtSurround;
+class SwFmtVertOrient;
+class SwFmtHoriOrient;
+class SwFmtAnchor;
+class SvxBrushItem;
+class SvxBoxItem;
+class SwFmtCol;
+class SvxFmtKeepItem;
+class SwTextGridItem;
+class SwFmtLineNumber;
+class SvxFrameDirectionItem;
+class SwFmtRuby;
+class SwTxtNode;
+class SwTOXMark;
+class SwRedlineData;
+class SwSection;
+class SwFmtDrop;
+class SwFrmFmt;
+class SwNumFmt;
+class SwFmt;
+class SwTableNode;
+struct WW8_SepInfo;
+struct WW8_PdAttrDesc;
+class SwLineNumberInfo;
+class SwNumRule;
+class wwFont;
+
+class String;
+
+class MSWordExportBase;
+
+namespace sw { class Frame; }
+
+namespace msword {
+ const BYTE ColumnBreak = 0xE;
+ const BYTE PageBreak = 0xC;
+}
+
+class AttributeOutputBase
+{
+public:
+ /// Export the state of RTL/CJK.
+ virtual void RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript ) = 0;
+
+ /// Start of the paragraph.
+ virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo ) = 0;
+
+ /// End of the paragraph.
+ virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ) = 0;
+
+ /// Called before we start outputting the attributes.
+ virtual void StartParagraphProperties( const SwTxtNode& rNode ) = 0;
+
+ /// Called after we end outputting the attributes.
+ virtual void EndParagraphProperties() = 0;
+
+ /// Empty paragraph.
+ virtual void EmptyParagraph() = 0;
+
+ /// Start of the text run.
+ virtual void StartRun( const SwRedlineData* pRedlineData ) = 0;
+
+ /// End of the text run.
+ virtual void EndRun() = 0;
+
+ /// Called before we start outputting the attributes.
+ virtual void StartRunProperties() = 0;
+
+ /// Called after we end outputting the attributes.
+ virtual void EndRunProperties( const SwRedlineData* pRedlineData ) = 0;
+
+ /// Output text (inside a run).
+ virtual void RunText( const String& rText, rtl_TextEncoding eCharSet ) = 0;
+
+ /// Output text (without markup).
+ virtual void RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet ) = 0;
+
+ /// Output ruby start.
+ virtual void StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby ) = 0;
+
+ /// Output ruby end.
+ virtual void EndRuby() = 0;
+
+ /// Output URL start.
+ virtual bool StartURL( const String& rUrl, const String& rTarget ) = 0;
+
+ /// Output URL end.
+ virtual bool EndURL() = 0;
+
+ virtual void FieldVanish( const String& rTxt, ww::eField eType ) = 0;
+
+ void StartTOX( const SwSection& rSect );
+
+ void EndTOX( const SwSection& rSect );
+
+ virtual void TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAttr );
+
+ /// Output redlining.
+ virtual void Redline( const SwRedlineData* pRedline ) = 0;
+
+ virtual void FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, USHORT nStyle, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ) = 0;
+
+ /// Output FKP (Formatted disK Page) - necessary for binary formats only.
+ /// FIXME having it in AttributeOutputBase is probably a hack, it
+ /// should be in WW8AttributeOutput only...
+ virtual void OutputFKP() {}
+
+ /// Output style.
+ virtual void ParagraphStyle( USHORT nStyle ) = 0;
+
+ virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
+ virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo ) = 0;
+
+ virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner ) = 0;
+
+ virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) = 0;
+
+ virtual void TableRowEnd( sal_uInt32 nDepth ) = 0;
+
+ /// Start of the styles table.
+ virtual void StartStyles() = 0;
+
+ /// End of the styles table.
+ virtual void EndStyles( USHORT nNumberOfStyles ) = 0;
+
+ /// Write default style.
+ virtual void DefaultStyle( USHORT nStyle ) = 0;
+
+ /// Start of a style in the styles table.
+ virtual void StartStyle( const String& rName, bool bPapFmt,
+ USHORT nBase, USHORT nNext, USHORT nWwId, USHORT nId ) = 0;
+
+ /// End of a style in the styles table.
+ virtual void EndStyle() = 0;
+
+ /// Start of (paragraph or run) properties of a style.
+ virtual void StartStyleProperties( bool bParProp, USHORT nStyle ) = 0;
+
+ /// End of (paragraph or run) properties of a style.
+ virtual void EndStyleProperties( bool bParProp ) = 0;
+
+ /// Numbering rule and Id.
+ virtual void OutlineNumbering( BYTE nLvl, const SwNumFmt& rNFmt, const SwFmt& rFmt ) = 0;
+
+ /// Page break
+ /// As a paragraph property - the paragraph should be on the next page.
+ virtual void PageBreakBefore( bool bBreak ) = 0;
+
+ /// Write a section break
+ /// msword::ColumnBreak or msword::PageBreak
+ virtual void SectionBreak( BYTE nC, const WW8_SepInfo* pSectionInfo = NULL ) = 0;
+
+ /// Start of the section properties.
+ virtual void StartSection() = 0;
+
+ /// End of the section properties.
+ virtual void EndSection() = 0;
+
+ /// Protection of forms.
+ virtual void SectionFormProtection( bool bProtected ) = 0;
+
+ /// Numbering of the lines in the document.
+ virtual void SectionLineNumbering( ULONG nRestartNo, const SwLineNumberInfo& rLnNumInfo ) = 0;
+
+ /// Has different headers/footers for the title page.
+ virtual void SectionTitlePage() = 0;
+
+ /// Description of the page borders.
+ virtual void SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* pFirstPageFmt ) = 0;
+
+ /// Columns populated from right/numbers on the right side?
+ virtual void SectionBiDi( bool bBiDi ) = 0;
+
+ /// The style of the page numbers.
+ ///
+ /// nPageRestartNumberr being 0 means no restart.
+ virtual void SectionPageNumbering( USHORT nNumType, USHORT nPageRestartNumber ) = 0;
+
+ /// The type of breaking.
+ virtual void SectionType( BYTE nBreakCode ) = 0;
+
+ /// Special header/footer flags, needed for old versions only.
+ virtual void SectionWW6HeaderFooterFlags( BYTE /*nHeadFootFlags*/ ) {}
+
+ /// Definition of a numbering instance.
+ virtual void NumberingDefinition( USHORT nId, const SwNumRule &rRule ) = 0;
+
+ /// Start of the abstract numbering definition instance.
+ virtual void StartAbstractNumbering( USHORT /*nId*/ ) {}
+
+ /// End of the abstract numbering definition instance.
+ virtual void EndAbstractNumbering() {}
+
+ /// All the numbering level information.
+ virtual void NumberingLevel( BYTE nLevel,
+ USHORT nStart,
+ USHORT nNumberingType,
+ SvxAdjust eAdjust,
+ const BYTE *pNumLvlPos,
+ BYTE nFollow,
+ const wwFont *pFont,
+ const SfxItemSet *pOutSet,
+ sal_Int16 nIndentAt,
+ sal_Int16 nFirstLineIndex,
+ sal_Int16 nListTabPos,
+ const String &rNumberingString ) = 0;
+
+protected:
+
+ void GetNumberPara( String& rStr, const SwField& rFld );
+
+ /// Output frames - the implementation.
+ virtual void OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point& rNdTopLeft ) = 0;
+
+ /// Sfx item Sfx item RES_CHRATR_CASEMAP
+ virtual void CharCaseMap( const SvxCaseMapItem& ) = 0;
+
+ /// Sfx item Sfx item RES_CHRATR_COLOR
+ virtual void CharColor( const SvxColorItem& ) = 0;
+
+ /// Sfx item Sfx item RES_CHRATR_CONTOUR
+ virtual void CharContour( const SvxContourItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CROSSEDOUT
+ virtual void CharCrossedOut( const SvxCrossedOutItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_ESCAPEMENT
+ virtual void CharEscapement( const SvxEscapementItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_FONT
+ virtual void CharFont( const SvxFontItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_FONTSIZE
+ virtual void CharFontSize( const SvxFontHeightItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_KERNING
+ virtual void CharKerning( const SvxKerningItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_LANGUAGE
+ virtual void CharLanguage( const SvxLanguageItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_POSTURE
+ virtual void CharPosture( const SvxPostureItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_SHADOWED
+ virtual void CharShadow( const SvxShadowedItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_UNDERLINE
+ virtual void CharUnderline( const SvxUnderlineItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_WEIGHT
+ virtual void CharWeight( const SvxWeightItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_AUTOKERN
+ virtual void CharAutoKern( const SvxAutoKernItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_BLINK
+ virtual void CharAnimatedText( const SvxBlinkItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_BACKGROUND
+ virtual void CharBackground( const SvxBrushItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CJK_FONT
+ virtual void CharFontCJK( const SvxFontItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CJK_FONTSIZE
+ virtual void CharFontSizeCJK( const SvxFontHeightItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CJK_LANGUAGE
+ virtual void CharLanguageCJK( const SvxLanguageItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CJK_POSTURE
+ virtual void CharPostureCJK( const SvxPostureItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CJK_WEIGHT
+ virtual void CharWeightCJK( const SvxWeightItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CTL_FONT
+ virtual void CharFontCTL( const SvxFontItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CTL_FONTSIZE
+ virtual void CharFontSizeCTL( const SvxFontHeightItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CTL_LANGUAGE
+ virtual void CharLanguageCTL( const SvxLanguageItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CTL_POSTURE
+ virtual void CharPostureCTL( const SvxPostureItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_CTL_WEIGHT
+ virtual void CharWeightCTL( const SvxWeightItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_ROTATE
+ virtual void CharRotate( const SvxCharRotateItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_EMPHASIS_MARK
+ virtual void CharEmphasisMark( const SvxEmphasisMarkItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_TWO_LINES
+ virtual void CharTwoLines( const SvxTwoLinesItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_SCALEW
+ virtual void CharScaleWidth( const SvxCharScaleWidthItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_RELIEF
+ virtual void CharRelief( const SvxCharReliefItem& ) = 0;
+
+ /// Sfx item RES_CHRATR_HIDDEN
+ virtual void CharHidden( const SvxCharHiddenItem& ) = 0;
+
+ /// Sfx item RES_TXTATR_INETFMT
+ virtual void TextINetFormat( const SwFmtINetFmt& ) = 0;
+
+ /// Sfx item RES_TXTATR_CHARFMT
+ virtual void TextCharFormat( const SwFmtCharFmt& ) = 0;
+
+ /// Sfx item RES_TXTATR_FIELD
+ void TextField( const SwFmtFld& );
+
+ /// Sfx item RES_TXTATR_FLYCNT
+ virtual void TextFlyContent( const SwFmtFlyCnt& );
+
+ /// Sfx item RES_TXTATR_FTN
+ ///
+ /// This one is common for both WW8AttributeOutput as well as
+ /// DocxAttributeOutput.
+ void TextFootnote( const SwFmtFtn& );
+
+ /// Sfx item RES_TXTATR_FTN
+ virtual void TextFootnote_Impl( const SwFmtFtn& ) = 0;
+
+ /// Sfx item RES_TXTATR_HARDBLANK
+ virtual void TextHardBlank( const SwFmtHardBlank& ) = 0;
+
+ /// Sfx item RES_PARATR_LINESPACING
+ void ParaLineSpacing( const SvxLineSpacingItem& );
+
+ /// Count the values in ParaLineSpacing, and pass theme here.
+ virtual void ParaLineSpacing_Impl( short nSpace, short nMulti ) = 0;
+
+ /// Sfx item RES_PARATR_ADJUST
+ virtual void ParaAdjust( const SvxAdjustItem& ) = 0;
+
+ /// Sfx item RES_PARATR_SPLIT
+ virtual void ParaSplit( const SvxFmtSplitItem& ) = 0;
+
+ /// Sfx item RES_PARATR_WIDOWS
+ virtual void ParaWidows( const SvxWidowsItem& ) = 0;
+
+ /// Sfx item RES_PARATR_TABSTOP
+ virtual void ParaTabStop( const SvxTabStopItem& ) = 0;
+
+ /// Sfx item RES_PARATR_HYPHENZONE
+ virtual void ParaHyphenZone( const SvxHyphenZoneItem& ) = 0;
+
+ /// Sfx item RES_PARATR_NUMRULE
+ void ParaNumRule( const SwNumRuleItem& );
+
+ /// Numbering - the implementation.
+ virtual void ParaNumRule_Impl( const SwTxtNode *pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId ) = 0;
+
+ /// Sfx item RES_PARATR_SCRIPTSPACE
+ virtual void ParaScriptSpace( const SfxBoolItem& ) = 0;
+
+ /// Sfx item RES_PARATR_HANGINGPUNCTUATION
+ void ParaHangingPunctuation( const SfxBoolItem& rHt ) { ParaScriptSpace( rHt ); };
+
+ /// Sfx item RES_PARATR_FORBIDDEN_RULES
+ void ParaForbiddenRules( const SfxBoolItem& rHt ) { ParaScriptSpace( rHt ); };
+
+ /// Sfx item RES_PARATR_VERTALIGN
+ virtual void ParaVerticalAlign( const SvxParaVertAlignItem& ) = 0;
+
+ /// Sfx item RES_PARATR_SNAPTOGRID
+ virtual void ParaSnapToGrid( const SvxParaGridItem& ) = 0;
+
+ /// Sfx item RES_FRM_SIZE
+ virtual void FormatFrameSize( const SwFmtFrmSize& ) = 0;
+
+ /// Sfx item RES_PAPER_BIN
+ virtual void FormatPaperBin( const SvxPaperBinItem& ) = 0;
+
+ /// Sfx item RES_LR_SPACE
+ virtual void FormatLRSpace( const SvxLRSpaceItem& ) = 0;
+
+ /// Sfx item RES_UL_SPACE
+ virtual void FormatULSpace( const SvxULSpaceItem& ) = 0;
+
+ /// Sfx item RES_PAGEDESC
+ void FormatPageDescription( const SwFmtPageDesc& );
+
+ /// Sfx item RES_BREAK
+ void FormatBreak( const SvxFmtBreakItem& );
+
+ /// Sfx item RES_SURROUND
+ virtual void FormatSurround( const SwFmtSurround& ) = 0;
+
+ /// Sfx item RES_VERT_ORIENT
+ virtual void FormatVertOrientation( const SwFmtVertOrient& ) = 0;
+
+ /// Sfx item RES_HORI_ORIENT
+ virtual void FormatHorizOrientation( const SwFmtHoriOrient& ) = 0;
+
+ /// Sfx item RES_ANCHOR
+ virtual void FormatAnchor( const SwFmtAnchor& ) = 0;
+
+ /// Sfx item RES_BACKGROUND
+ virtual void FormatBackground( const SvxBrushItem& ) = 0;
+
+ /// Sfx item RES_BOX
+ virtual void FormatBox( const SvxBoxItem& ) = 0;
+
+ /// Sfx item RES_COL
+ void FormatColumns( const SwFmtCol& );
+
+ virtual void FormatColumns_Impl( USHORT nCols, const SwFmtCol & rCol, bool bEven, SwTwips nPageSize ) = 0;
+
+ /// Sfx item RES_KEEP
+ virtual void FormatKeep( const SvxFmtKeepItem& ) = 0;
+
+ /// Sfx item RES_TEXTGRID
+ virtual void FormatTextGrid( const SwTextGridItem& ) = 0;
+
+ /// Sfx item RES_LINENUMBER
+ virtual void FormatLineNumbering( const SwFmtLineNumber& ) = 0;
+
+ /// Sfx item RES_FRAMEDIR
+ virtual void FormatFrameDirection( const SvxFrameDirectionItem& ) = 0;
+
+ /// Write the expanded field
+ virtual void WriteExpand( const SwField* pFld ) = 0;
+
+ virtual void RefField( const SwField& rFld, const String& rRef ) = 0;
+ virtual void HiddenField( const SwField& rFld ) = 0;
+ virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd ) = 0;
+ virtual void PostitField( const SwField* pFld ) = 0;
+ virtual bool DropdownField( const SwField* pFld ) = 0;
+
+ virtual bool AnalyzeURL( const String& rUrl, const String& rTarget, String* pLinkURL, String* pMark );
+
+ std::vector<SwTwips> GetGridCols( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ void GetTablePageSize( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner, sal_uInt32& rPageSize, bool& rRelBoxSize );
+
+public:
+ AttributeOutputBase() {}
+ virtual ~AttributeOutputBase() {}
+
+ /// Return the right export class.
+ virtual MSWordExportBase& GetExport() = 0;
+
+ /// Call the right virtual function according to the type of the item.
+ void OutputItem( const SfxPoolItem& rHt );
+
+ /// Use OutputItem() on an item set - for styles.
+ void OutputStyleItemSet( const SfxItemSet& rSet, BOOL bDeep, BOOL bTestForDefault );
+
+ /// Output frames.
+ void OutputFlyFrame( const sw::Frame& rFmt );
+};
+
+#endif // _ATTRIBUTEOUTPUTBASE_HXX_
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
new file mode 100644
index 000000000000..537a881f76ad
--- /dev/null
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -0,0 +1,3331 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "docxattributeoutput.hxx"
+#include "docxexport.hxx"
+#include "docxfootnotes.hxx"
+#include "writerwordglue.hxx"
+#include "wrtww8.hxx"
+#include "ww8par.hxx"
+
+#include <oox/core/tokens.hxx>
+#include <oox/export/drawingml.hxx>
+#include <oox/export/utils.hxx>
+#include <oox/export/vmlexport.hxx>
+
+#include <i18npool/mslangid.hxx>
+
+#include <hintids.hxx>
+
+#include <svtools/poolitem.hxx>
+
+#include <svx/fontitem.hxx>
+#include <svx/tstpitem.hxx>
+#include <svx/adjitem.hxx>
+#include <svx/spltitem.hxx>
+#include <svx/widwitem.hxx>
+#include <svx/lspcitem.hxx>
+#include <svx/keepitem.hxx>
+#include <svx/shaditem.hxx>
+#include <svx/brshitem.hxx>
+#include <svx/postitem.hxx>
+#include <svx/wghtitem.hxx>
+#include <svx/kernitem.hxx>
+#include <svx/crsditem.hxx>
+#include <svx/cmapitem.hxx>
+#include <svx/wrlmitem.hxx>
+#include <svx/udlnitem.hxx>
+#include <svx/langitem.hxx>
+#include <svx/escpitem.hxx>
+#include <svx/fhgtitem.hxx>
+#include <svx/colritem.hxx>
+#include <svx/hyznitem.hxx>
+#include <svx/brkitem.hxx>
+#include <svx/lrspitem.hxx>
+#include <svx/ulspitem.hxx>
+#include <svx/boxitem.hxx>
+#include <svx/cntritem.hxx>
+#include <svx/shdditem.hxx>
+#include <svx/akrnitem.hxx>
+#include <svx/pbinitem.hxx>
+#include <svx/emphitem.hxx>
+#include <svx/twolinesitem.hxx>
+#include <svx/charscaleitem.hxx>
+#include <svx/charrotateitem.hxx>
+#include <svx/charreliefitem.hxx>
+#include <svx/paravertalignitem.hxx>
+#include <svx/pgrditem.hxx>
+#include <svx/frmdiritem.hxx>
+#include <svx/blnkitem.hxx>
+#include <svx/charhiddenitem.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdobj.hxx>
+
+#include <docufld.hxx>
+#include <flddropdown.hxx>
+#include <format.hxx>
+#include <fmtclds.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtfld.hxx>
+#include <fmtfsize.hxx>
+#include <fmtftn.hxx>
+#include <fmtrowsplt.hxx>
+#include <fmtline.hxx>
+#include <frmfmt.hxx>
+#include <frmatr.hxx>
+#include <ftninfo.hxx>
+#include <htmltbl.hxx>
+#include <ndgrf.hxx>
+#include <ndtxt.hxx>
+#include <node.hxx>
+#include <pagedesc.hxx>
+#include <paratr.hxx>
+#include <swmodule.hxx>
+#include <swtable.hxx>
+#include <txtftn.hxx>
+#include <txtinet.hxx>
+#include <numrule.hxx>
+
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+
+#include <tools/color.hxx>
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+
+#if OSL_DEBUG_LEVEL > 0
+#include <stdio.h>
+#endif
+
+using rtl::OString;
+using rtl::OStringBuffer;
+using rtl::OUString;
+using rtl::OUStringBuffer;
+using rtl::OUStringToOString;
+
+using namespace docx;
+using namespace sax_fastparser;
+using namespace nsSwDocInfoSubType;
+using namespace nsFieldFlags;
+using namespace sw::util;
+
+void DocxAttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 /*nScript*/ )
+{
+ if (bIsRTL)
+ m_pSerializer->singleElementNS( XML_w, XML_rtl, FSNS( XML_w, XML_val ), "true", FSEND );
+}
+
+void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo )
+{
+ if ( m_nColBreakStatus == COLBRK_POSTPONE )
+ m_nColBreakStatus = COLBRK_WRITE;
+
+ // Output table/table row/table cell starts if needed
+ if ( pTextNodeInfo.get() )
+ {
+ sal_uInt32 nRow = pTextNodeInfo->getRow();
+ sal_uInt32 nCell = pTextNodeInfo->getCell();
+
+ // New cell/row?
+ if ( m_nTableDepth > 0 && !m_bTableCellOpen )
+ {
+ ww8::WW8TableNodeInfoInner::Pointer_t pDeepInner( pTextNodeInfo->getInnerForDepth( m_nTableDepth ) );
+ if ( pDeepInner->getCell() == 0 )
+ StartTableRow( pDeepInner );
+
+ StartTableCell( pDeepInner );
+ }
+
+ if ( nRow == 0 && nCell == 0 )
+ {
+ // Do we have to start the table?
+ // [If we are at the rigth depth already, it means that we
+ // continue the table cell]
+ sal_uInt32 nCurrentDepth = pTextNodeInfo->getDepth();
+
+ if ( nCurrentDepth > m_nTableDepth )
+ {
+ // Start all the tables that begin here
+ for ( sal_uInt32 nDepth = m_nTableDepth + 1; nDepth <= pTextNodeInfo->getDepth(); ++nDepth )
+ {
+ ww8::WW8TableNodeInfoInner::Pointer_t pInner( pTextNodeInfo->getInnerForDepth( nDepth ) );
+
+ StartTable( pInner );
+ StartTableRow( pInner );
+ StartTableCell( pInner );
+ }
+
+ m_nTableDepth = nCurrentDepth;
+ }
+ }
+ }
+
+ m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
+
+ // postpone the output of the run (we get it before the paragraph
+ // properties, but must write it after them)
+ m_pSerializer->mark();
+
+ // no section break in this paragraph yet; can be set in SectionBreak()
+ m_pSectionInfo = NULL;
+
+ m_bParagraphOpened = true;
+}
+
+void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner )
+{
+ // write the paragraph properties + the run, already in the correct order
+ m_pSerializer->mergeTopMarks();
+ m_pSerializer->endElementNS( XML_w, XML_p );
+
+ // Check for end of cell, rows, tables here
+ FinishTableRowCell( pTextNodeInfoInner );
+
+ m_bParagraphOpened = false;
+}
+
+void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool bForceEmptyParagraph )
+{
+ if ( pInner.get() )
+ {
+ // Where are we in the table
+ sal_uInt32 nRow = pInner->getRow( );
+
+ const SwTable *pTable = pInner->getTable( );
+ const SwTableLines& rLines = pTable->GetTabLines( );
+ USHORT nLinesCount = rLines.Count( );
+
+ if ( pInner->isEndOfCell() )
+ {
+ if ( bForceEmptyParagraph )
+ m_pSerializer->singleElementNS( XML_w, XML_p, FSEND );
+
+ EndTableCell();
+ }
+
+ // This is a line end
+ if ( pInner->isEndOfLine() )
+ EndTableRow();
+
+ // This is the end of the table
+ if ( pInner->isEndOfLine( ) && ( nRow + 1 ) == nLinesCount )
+ EndTable();
+ }
+}
+
+void DocxAttributeOutput::EmptyParagraph()
+{
+ m_pSerializer->singleElementNS( XML_w, XML_p, FSEND );
+}
+
+void DocxAttributeOutput::StartParagraphProperties( const SwTxtNode& rNode )
+{
+ // output page/section breaks
+ // Writer can have them at the beginning of a paragraph, or at the end, but
+ // in docx, we have to output them in the paragraph properties of the last
+ // paragraph in a section. To get it right, we have to switch to the next
+ // paragraph, and detect the section breaks there.
+ SwNodeIndex aNextIndex( rNode, 1 );
+ if ( aNextIndex.GetNode().IsTxtNode() )
+ {
+ const SwTxtNode* pTxtNode = static_cast< SwTxtNode* >( &aNextIndex.GetNode() );
+ m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode );
+ }
+ else if ( aNextIndex.GetNode().IsTableNode() )
+ {
+ const SwTableNode* pTableNode = static_cast< SwTableNode* >( &aNextIndex.GetNode() );
+ const SwFrmFmt *pFmt = pTableNode->GetTable().GetFrmFmt();
+ m_rExport.OutputSectionBreaks( &(pFmt->GetAttrSet()), *pTableNode );
+ }
+
+ // postpone the output so that we can later [in EndParagraphProperties()]
+ // prepend the properties before the run
+ m_pSerializer->mark();
+
+ m_pSerializer->startElementNS( XML_w, XML_pPr, FSEND );
+
+ // and output the section break now (if it appeared)
+ if ( m_pSectionInfo )
+ {
+ m_rExport.SectionProperties( *m_pSectionInfo );
+ m_pSectionInfo = NULL;
+ }
+
+ InitCollectedParagraphProperties();
+}
+
+void DocxAttributeOutput::InitCollectedParagraphProperties()
+{
+ m_pSpacingAttrList = NULL;
+}
+
+void DocxAttributeOutput::WriteCollectedParagraphProperties()
+{
+ if ( m_pSpacingAttrList )
+ {
+ XFastAttributeListRef xAttrList( m_pSpacingAttrList );
+ m_pSpacingAttrList = NULL;
+
+ m_pSerializer->singleElementNS( XML_w, XML_spacing, xAttrList );
+ }
+}
+
+void DocxAttributeOutput::EndParagraphProperties()
+{
+ WriteCollectedParagraphProperties();
+
+ m_pSerializer->endElementNS( XML_w, XML_pPr );
+
+ if ( m_nColBreakStatus == COLBRK_WRITE )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_br,
+ FSNS( XML_w, XML_type ), "column", FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+
+ m_nColBreakStatus = COLBRK_NONE;
+ }
+
+ // merge the properties _before_ the run (strictly speaking, just
+ // after the start of the paragraph)
+ m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+}
+
+void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData )
+{
+ // if there is some redlining in the document, output it
+ StartRedline( pRedlineData );
+
+ // postpone the output of the start of a run (there are elements that need
+ // to be written before the start of the run, but we learn which they are
+ // _inside_ of the run)
+ m_pSerializer->mark(); // let's call it "postponed run start"
+
+ // postpone the output of the text (we get it before the run properties,
+ // but must write it after them)
+ m_pSerializer->mark(); // let's call it "postponed text"
+}
+
+void DocxAttributeOutput::EndRun()
+{
+ // Write field starts
+ for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); ++pIt )
+ {
+ // Add the fields starts for all but hyperlinks and TOCs
+ if ( pIt->bOpen && pIt->pField )
+ {
+ StartField_Impl( *pIt );
+
+ // Remove the field from the stack if only the start has to be written
+ // Unknown fields sould be removed too
+ if ( !pIt->bClose || ( pIt->eType == ww::eUNKNOWN ) )
+ {
+ m_Fields.erase( pIt );
+ --pIt;
+ }
+ }
+ }
+
+
+ // write the run properties + the text, already in the correct order
+ m_pSerializer->mergeTopMarks(); // merges with "postponed text", see above
+
+ // level down, to be able to prepend the actual run start attribute (just
+ // before "postponed run start")
+ m_pSerializer->mark(); // let's call it "actual run start"
+
+ // prepend the actual run start
+ if ( m_pHyperlinkAttrList )
+ {
+ XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList );
+
+ m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
+ }
+
+ // Write the hyperlink and toc fields starts
+ for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); ++pIt )
+ {
+ // Add the fields starts for hyperlinks, TOCs and index marks
+ if ( pIt->bOpen )
+ {
+ StartField_Impl( *pIt, sal_True );
+
+ // Remove the field if no end needs to be written
+ if ( !pIt->bClose ) {
+ m_Fields.erase( pIt );
+ --pIt;
+ }
+ }
+ }
+
+ DoWriteBookmarks( );
+
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND ); // merges with "postponed run start", see above
+
+ // write the run start + the run content
+ m_pSerializer->mergeTopMarks(); // merges the "actual run start"
+
+ // append the actual run end
+ m_pSerializer->endElementNS( XML_w, XML_r );
+
+ if ( m_pHyperlinkAttrList )
+ {
+ m_pSerializer->endElementNS( XML_w, XML_hyperlink );
+ m_pHyperlinkAttrList = NULL;
+ }
+
+ while ( m_Fields.begin() != m_Fields.end() )
+ {
+ EndField_Impl( m_Fields.front( ) );
+ m_Fields.erase( m_Fields.begin( ) );
+ }
+
+ // if there is some redlining in the document, output it
+ EndRedline();
+}
+
+void DocxAttributeOutput::DoWriteBookmarks()
+{
+ // Write the start bookmarks
+ for ( std::vector< OString >::const_iterator it = m_rMarksStart.begin(), end = m_rMarksStart.end();
+ it < end; ++it )
+ {
+ const OString& rName = *it;
+
+ // Output the bookmark
+ USHORT nId = m_nNextMarkId++;
+ m_rOpenedMarksIds[rName] = nId;
+ m_pSerializer->singleElementNS( XML_w, XML_bookmarkStart,
+ FSNS( XML_w, XML_id ), OString::valueOf( sal_Int32( nId ) ).getStr( ),
+ FSNS( XML_w, XML_name ), rName.getStr(),
+ FSEND );
+ }
+ m_rMarksStart.clear();
+
+ // export the end bookmarks
+ for ( std::vector< OString >::const_iterator it = m_rMarksEnd.begin(), end = m_rMarksEnd.end();
+ it < end; ++it )
+ {
+ const OString& rName = *it;
+
+ // Get the id of the bookmark
+ std::map< OString, USHORT >::iterator pPos = m_rOpenedMarksIds.find( rName );
+ if ( pPos != m_rOpenedMarksIds.end( ) )
+ {
+ USHORT nId = ( *pPos ).second;
+ m_pSerializer->singleElementNS( XML_w, XML_bookmarkEnd,
+ FSNS( XML_w, XML_id ), OString::valueOf( sal_Int32( nId ) ).getStr( ),
+ FSEND );
+ m_rOpenedMarksIds.erase( rName );
+ }
+ }
+ m_rMarksEnd.clear();
+}
+
+void DocxAttributeOutput::StartField_Impl( FieldInfos& rInfos, sal_Bool bWriteRun )
+{
+ if ( rInfos.pField && rInfos.eType == ww::eUNKNOWN )
+ {
+ // Expand unsupported fields
+ RunText( rInfos.pField->Expand( ) );
+ }
+ else if ( rInfos.eType != ww::eNONE ) // HYPERLINK fields are just commands
+ {
+ if ( bWriteRun )
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+
+ if ( rInfos.eType == ww::eFORMDROPDOWN )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "begin",
+ FSEND );
+
+ const SwDropDownField& rFld2 = *(SwDropDownField*)rInfos.pField;
+ uno::Sequence<rtl::OUString> aItems =
+ rFld2.GetItemSequence();
+ GetExport().DoComboBox(rFld2.GetName(),
+ rFld2.GetHelp(),
+ rFld2.GetToolTip(),
+ rFld2.GetSelectedItem(), aItems);
+
+ m_pSerializer->endElementNS( XML_w, XML_fldChar );
+
+ if ( bWriteRun )
+ m_pSerializer->endElementNS( XML_w, XML_r );
+
+ }
+ else
+ {
+ // Write the field start
+ m_pSerializer->singleElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "begin",
+ FSEND );
+
+ if ( bWriteRun )
+ m_pSerializer->endElementNS( XML_w, XML_r );
+
+ // The hyperlinks fields can't be expanded: the value is
+ // normally in the text run
+ if ( !rInfos.pField )
+ CmdField_Impl( rInfos );
+ }
+ }
+}
+
+void DocxAttributeOutput::DoWriteCmd( String& rCmd )
+{
+ // Write the Field command
+ m_pSerializer->startElementNS( XML_w, XML_instrText, FSEND );
+ m_pSerializer->writeEscaped( OUString( rCmd ) );
+ m_pSerializer->endElementNS( XML_w, XML_instrText );
+
+}
+
+void DocxAttributeOutput::CmdField_Impl( FieldInfos& rInfos )
+{
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ xub_StrLen nNbToken = rInfos.sCmd.GetTokenCount( '\t' );
+
+ for ( xub_StrLen i = 0; i < nNbToken; i++ )
+ {
+ String sToken = rInfos.sCmd.GetToken( i, '\t' );
+ // Write the Field command
+ DoWriteCmd( sToken );
+
+ // Replace tabs by </instrText><tab/><instrText>
+ if ( i < ( nNbToken - 1 ) )
+ RunText( String::CreateFromAscii( "\t" ) );
+ }
+
+ m_pSerializer->endElementNS( XML_w, XML_r );
+
+
+ // Write the Field separator
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "separate",
+ FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+}
+
+void DocxAttributeOutput::EndField_Impl( FieldInfos& rInfos )
+{
+ // The command has to be written before for the hyperlinks
+ if ( rInfos.pField )
+ {
+ CmdField_Impl( rInfos );
+ }
+
+ // Write the bookmark start if any
+ OUString aBkmName( m_sFieldBkm );
+ if ( aBkmName.getLength( ) > 0 )
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_bookmarkStart,
+ FSNS( XML_w, XML_id ), OString::valueOf( sal_Int32( m_nNextMarkId ) ).getStr( ),
+ FSNS( XML_w, XML_name ), OUStringToOString( aBkmName, RTL_TEXTENCODING_UTF8 ).getStr( ),
+ FSEND );
+ }
+
+ if (rInfos.pField ) // For hyperlinks and TOX
+ {
+ // Write the Field latest value
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+
+ // Find another way for hyperlinks
+ RunText( rInfos.pField->Expand( ) );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+ }
+
+ // Write the bookmark end if any
+ if ( aBkmName.getLength( ) > 0 )
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_bookmarkEnd,
+ FSNS( XML_w, XML_id ), OString::valueOf( sal_Int32( m_nNextMarkId ) ).getStr( ),
+ FSEND );
+
+ m_nNextMarkId++;
+ }
+
+ // Write the Field end
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "end",
+ FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+
+
+ // Write the ref field if a bookmark had to be set and the field
+ // should be visible
+ if ( rInfos.pField )
+ {
+ USHORT nSubType = rInfos.pField->GetSubType( );
+ bool bIsSetField = rInfos.pField->GetTyp( )->Which( ) == RES_SETEXPFLD;
+ bool bShowRef = ( !bIsSetField || ( nSubType & nsSwExtendedSubType::SUB_INVISIBLE ) ) ? false : true;
+
+ if ( ( m_sFieldBkm.Len( ) > 0 ) && bShowRef )
+ {
+ // Write the field beginning
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "begin",
+ FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+
+ rInfos.sCmd = FieldString( ww::eREF );
+ rInfos.sCmd.APPEND_CONST_ASC( "\"" );
+ rInfos.sCmd += m_sFieldBkm;
+ rInfos.sCmd.APPEND_CONST_ASC( "\" " );
+
+ // Clean the field bookmark data to avoid infinite loop
+ m_sFieldBkm = String( );
+
+ // Write the end of the field
+ EndField_Impl( rInfos );
+ }
+ }
+}
+
+void DocxAttributeOutput::StartRunProperties()
+{
+ // postpone the output so that we can later [in EndRunProperties()]
+ // prepend the properties before the text
+ m_pSerializer->mark();
+
+ m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
+
+ InitCollectedRunProperties();
+}
+
+void DocxAttributeOutput::InitCollectedRunProperties()
+{
+ m_pFontsAttrList = NULL;
+ m_pEastAsianLayoutAttrList = NULL;
+ m_pCharLangAttrList = NULL;
+}
+
+void DocxAttributeOutput::WriteCollectedRunProperties()
+{
+ // Write all differed properties
+ if ( m_pFontsAttrList )
+ {
+ XFastAttributeListRef xAttrList( m_pFontsAttrList );
+ m_pFontsAttrList = NULL;
+
+ m_pSerializer->singleElementNS( XML_w, XML_rFonts, xAttrList );
+ }
+
+ if ( m_pEastAsianLayoutAttrList )
+ {
+ XFastAttributeListRef xAttrList( m_pEastAsianLayoutAttrList );
+ m_pEastAsianLayoutAttrList = NULL;
+
+ m_pSerializer->singleElementNS( XML_w, XML_eastAsianLayout, xAttrList );
+ }
+
+ if ( m_pCharLangAttrList )
+ {
+ XFastAttributeListRef xAttrList( m_pCharLangAttrList );
+ m_pCharLangAttrList = NULL;
+
+ m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList );
+ }
+}
+
+void DocxAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*/ )
+{
+ WriteCollectedRunProperties();
+
+ m_pSerializer->endElementNS( XML_w, XML_rPr );
+
+ // write footnotes/endnotes if we have any
+ FootnoteEndnoteReference();
+
+ // merge the properties _before_ the run text (strictly speaking, just
+ // after the start of the run)
+ m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+}
+
+/** Output sal_Unicode* as a run text (<t>the text</t>).
+
+ When bMove is true, update rBegin to point _after_ the end of the text +
+ 1, meaning that it skips one character after the text. This is to make
+ the switch in DocxAttributeOutput::RunText() nicer ;-)
+ */
+static void impl_WriteRunText( FSHelperPtr pSerializer, sal_Int32 nTextToken,
+ const sal_Unicode* &rBegin, const sal_Unicode* pEnd, bool bMove = true )
+{
+ const sal_Unicode *pBegin = rBegin;
+
+ // skip one character after the end
+ if ( bMove )
+ rBegin = pEnd + 1;
+
+ if ( pBegin >= pEnd )
+ return; // we want to write at least one character
+
+ // we have to add 'preserve' when starting/ending with space
+ if ( *pBegin == sal_Unicode( ' ' ) || *( pEnd - 1 ) == sal_Unicode( ' ' ) )
+ {
+ pSerializer->startElementNS( XML_w, nTextToken, FSNS( XML_xml, XML_space ), "preserve", FSEND );
+ }
+ else
+ pSerializer->startElementNS( XML_w, nTextToken, FSEND );
+
+ pSerializer->writeEscaped( OUString( pBegin, pEnd - pBegin ) );
+
+ pSerializer->endElementNS( XML_w, nTextToken );
+}
+
+void DocxAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eCharSet*/ )
+{
+ OUString aText( rText );
+
+ // one text can be split into more <w:t>blah</w:t>'s by line breaks etc.
+ const sal_Unicode *pBegin = aText.getStr();
+ const sal_Unicode *pEnd = pBegin + aText.getLength();
+
+ // the text run is usually XML_t, with the exception of the deleted text
+ sal_Int32 nTextToken = XML_t;
+ if ( m_pRedlineData && m_pRedlineData->GetType() == nsRedlineType_t::REDLINE_DELETE )
+ nTextToken = XML_delText;
+
+ for ( const sal_Unicode *pIt = pBegin; pIt < pEnd; ++pIt )
+ {
+ switch ( *pIt )
+ {
+ case 0x09: // tab
+ impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt );
+ m_pSerializer->singleElementNS( XML_w, XML_tab, FSEND );
+ break;
+ case 0x0b: // line break
+ impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt );
+ m_pSerializer->singleElementNS( XML_w, XML_br, FSEND );
+ break;
+ default:
+ if ( *pIt < 0x0020 ) // filter out the control codes
+ {
+ impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt );
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "Ignored control code %x in a text run.", *pIt );
+#endif
+ }
+ break;
+ }
+ }
+
+ impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pEnd, false );
+}
+
+void DocxAttributeOutput::RawText( const String& /*rText*/, bool /*bForceUnicode*/, rtl_TextEncoding /*eCharSet*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet )\n" );
+#endif
+}
+
+void DocxAttributeOutput::StartRuby( const SwTxtNode& /*rNode*/, const SwFmtRuby& /*rRuby*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby )\n" );
+#endif
+}
+
+void DocxAttributeOutput::EndRuby()
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::EndRuby()\n" );
+#endif
+}
+
+bool DocxAttributeOutput::AnalyzeURL( const String& rUrl, const String& rTarget, String* pLinkURL, String* pMark )
+{
+ bool bBookMarkOnly = AttributeOutputBase::AnalyzeURL( rUrl, rTarget, pLinkURL, pMark );
+
+ String sURL = *pLinkURL;
+ String sMark = *pMark;
+
+ bool bOutputField = sMark.Len();
+
+ if ( bOutputField )
+ {
+ if ( bBookMarkOnly )
+ sURL = FieldString( ww::eHYPERLINK );
+ else
+ {
+ String sFld( FieldString( ww::eHYPERLINK ) );
+ sFld.APPEND_CONST_ASC( "\"" );
+ sURL.Insert( sFld, 0 );
+ sURL += '\"';
+ }
+
+ if ( sMark.Len() )
+ ( ( sURL.APPEND_CONST_ASC( " \\l \"" ) ) += sMark ) += '\"';
+
+ if ( rTarget.Len() )
+ ( sURL.APPEND_CONST_ASC( " \\n " ) ) += rTarget;
+ }
+
+ *pLinkURL = sURL;
+ *pMark = sMark;
+
+ return bBookMarkOnly;
+}
+
+bool DocxAttributeOutput::StartURL( const String& rUrl, const String& rTarget )
+{
+ String sMark;
+ String sUrl;
+
+ bool bBookmarkOnly = AnalyzeURL( rUrl, rTarget, &sUrl, &sMark );
+
+ if ( sMark.Len() && !bBookmarkOnly )
+ {
+ m_rExport.OutputField( NULL, ww::eHYPERLINK, sUrl );
+ }
+ else
+ {
+ // Output a hyperlink XML element
+
+ m_pHyperlinkAttrList = m_pSerializer->createAttrList();
+ if ( !bBookmarkOnly )
+ {
+ OUString osUrl( sUrl );
+
+ ::rtl::OString sId = m_rExport.AddRelation(
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" ),
+ osUrl, S("External") );
+ m_pHyperlinkAttrList->add( FSNS( XML_r, XML_id), sId.getStr());
+ }
+ else
+ m_pHyperlinkAttrList->add( FSNS( XML_w, XML_anchor ),
+ OUStringToOString( OUString( sMark ), RTL_TEXTENCODING_UTF8 ).getStr( ) );
+
+ OUString sTarget( rTarget );
+ if ( sTarget.getLength( ) > 0 )
+ {
+ OString soTarget = OUStringToOString( sTarget, RTL_TEXTENCODING_UTF8 );
+ m_pHyperlinkAttrList->add(FSNS( XML_w, XML_tgtFrame ), soTarget.getStr());
+ }
+ }
+
+ return true;
+}
+
+bool DocxAttributeOutput::EndURL()
+{
+ return true;
+}
+
+void DocxAttributeOutput::FieldVanish( const String& rTxt, ww::eField eType )
+{
+ WriteField_Impl( NULL, eType, rTxt, WRITEFIELD_ALL );
+}
+
+void DocxAttributeOutput::Redline( const SwRedlineData* /*pRedline*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::Redline( const SwRedlineData* pRedline )\n" );
+#endif
+}
+
+/// Append the number as 2-digit when less than 10.
+static void impl_AppendTwoDigits( OStringBuffer &rBuffer, sal_Int32 nNum )
+{
+ if ( nNum < 0 || nNum > 99 )
+ {
+ rBuffer.append( "00" );
+ return;
+ }
+
+ if ( nNum < 10 )
+ rBuffer.append( '0' );
+
+ rBuffer.append( nNum );
+}
+
+/** Convert DateTime to xsd::dateTime string.
+
+I guess there must be an implementation of this somewhere in OOo, but I failed
+to find it, unfortunately :-(
+*/
+static OString impl_DateTimeToOString( const DateTime& rDateTime )
+{
+ DateTime aInUTC( rDateTime );
+ aInUTC.ConvertToUTC();
+
+ OStringBuffer aBuffer( 25 );
+ aBuffer.append( sal_Int32( aInUTC.GetYear() ) );
+ aBuffer.append( '-' );
+
+ impl_AppendTwoDigits( aBuffer, aInUTC.GetMonth() );
+ aBuffer.append( '-' );
+
+ impl_AppendTwoDigits( aBuffer, aInUTC.GetDay() );
+ aBuffer.append( 'T' );
+
+ impl_AppendTwoDigits( aBuffer, aInUTC.GetHour() );
+ aBuffer.append( ':' );
+
+ impl_AppendTwoDigits( aBuffer, aInUTC.GetMin() );
+ aBuffer.append( ':' );
+
+ impl_AppendTwoDigits( aBuffer, aInUTC.GetSec() );
+ aBuffer.append( 'Z' ); // we are in UTC
+
+ return aBuffer.makeStringAndClear();
+}
+
+void DocxAttributeOutput::StartRedline( const SwRedlineData* pRedlineData )
+{
+ m_pRedlineData = pRedlineData;
+
+ if ( !m_pRedlineData )
+ return;
+
+ // FIXME check if it's necessary to travel over the Next()'s in pRedlineData
+
+ OString aId( OString::valueOf( m_nRedlineId++ ) );
+
+ const String &rAuthor( SW_MOD()->GetRedlineAuthor( pRedlineData->GetAuthor() ) );
+ OString aAuthor( OUStringToOString( rAuthor, RTL_TEXTENCODING_UTF8 ) );
+
+ OString aDate( impl_DateTimeToOString( pRedlineData->GetTimeStamp() ) );
+
+ switch ( pRedlineData->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ m_pSerializer->startElementNS( XML_w, XML_ins,
+ FSNS( XML_w, XML_id ), aId.getStr(),
+ FSNS( XML_w, XML_author ), aAuthor.getStr(),
+ FSNS( XML_w, XML_date ), aDate.getStr(),
+ FSEND );
+ break;
+
+ case nsRedlineType_t::REDLINE_DELETE:
+ m_pSerializer->startElementNS( XML_w, XML_del,
+ FSNS( XML_w, XML_id ), aId.getStr(),
+ FSNS( XML_w, XML_author ), aAuthor.getStr(),
+ FSNS( XML_w, XML_date ), aDate.getStr(),
+ FSEND );
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT:
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::StartRedline()\n" );
+#endif
+ default:
+ break;
+ }
+}
+
+void DocxAttributeOutput::EndRedline()
+{
+ if ( !m_pRedlineData )
+ return;
+
+ switch ( m_pRedlineData->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ m_pSerializer->endElementNS( XML_w, XML_ins );
+ break;
+
+ case nsRedlineType_t::REDLINE_DELETE:
+ m_pSerializer->endElementNS( XML_w, XML_del );
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT:
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::EndRedline()\n" );
+#endif
+ break;
+ default:
+ break;
+ }
+
+ m_pRedlineData = NULL;
+}
+
+void DocxAttributeOutput::FormatDrop( const SwTxtNode& /*rNode*/, const SwFmtDrop& /*rSwFmtDrop*/, USHORT /*nStyle*/, ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, ww8::WW8TableNodeInfoInner::Pointer_t )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, USHORT nStyle )\n" );
+#endif
+}
+
+void DocxAttributeOutput::ParagraphStyle( USHORT nStyle )
+{
+ OString aStyleId( "style" );
+ aStyleId += OString::valueOf( sal_Int32( nStyle ) );
+
+ m_pSerializer->singleElementNS( XML_w, XML_pStyle, FSNS( XML_w, XML_val ), aStyleId.getStr(), FSEND );
+}
+
+#if 0
+void DocxAttributeOutput::InTable()
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::InTable()\n" );
+#endif
+}
+
+
+void DocxAttributeOutput::TableRowProperties( bool /*bHeader*/, long /*nCellHeight*/, bool /*bCannotSplit*/, bool /*bRightToLeft*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::TableRowProperties()\n" );
+#endif
+}
+#endif
+
+static OString impl_ConvertColor( const Color &rColor )
+{
+ OString color( "auto" );
+ if ( rColor.GetColor() != COL_AUTO )
+ {
+ const char pHexDigits[] = "0123456789ABCDEF";
+ char pBuffer[] = "000000";
+
+ pBuffer[0] = pHexDigits[ ( rColor.GetRed() >> 4 ) & 0x0F ];
+ pBuffer[1] = pHexDigits[ rColor.GetRed() & 0x0F ];
+ pBuffer[2] = pHexDigits[ ( rColor.GetGreen() >> 4 ) & 0x0F ];
+ pBuffer[3] = pHexDigits[ rColor.GetGreen() & 0x0F ];
+ pBuffer[4] = pHexDigits[ ( rColor.GetBlue() >> 4 ) & 0x0F ];
+ pBuffer[5] = pHexDigits[ rColor.GetBlue() & 0x0F ];
+
+ color = OString( pBuffer );
+ }
+ return color;
+}
+
+static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, const SvxBorderLine* pBorderLine, USHORT nDist )
+{
+ FastAttributeList* pAttr = pSerializer->createAttrList();
+
+ USHORT inW = pBorderLine->GetInWidth();
+ USHORT outW = pBorderLine->GetOutWidth();
+ USHORT nWidth = inW + outW;
+
+ // Compute val attribute value
+ // Can be one of:
+ // single, double,
+ // basicWideOutline, basicWideInline
+ // OOXml also supports those types of borders, but we'll try to play with the first ones.
+ // thickThinMediumGap, thickThinLargeGap, thickThinSmallGap
+ // thinThickLargeGap, thinThickMediumGap, thinThickSmallGap
+ const char* pVal = "single";
+ if ( pBorderLine->isDouble() )
+ {
+ if ( inW == outW )
+ pVal = ( sal_Char* )"double";
+ else if ( inW > outW )
+ {
+ pVal = ( sal_Char* )"thinThickMediumGap";
+ }
+ else if ( inW < outW )
+ {
+ pVal = ( sal_Char* )"thickThinMediumGap";
+ }
+ }
+
+ pAttr->add( FSNS( XML_w, XML_val ), OString( pVal ) );
+
+ // Compute the sz attribute
+
+ // The unit is the 8th of point
+ nWidth = sal_Int32( nWidth / 2.5 );
+ USHORT nMinWidth = 2;
+ USHORT nMaxWidth = 96;
+
+ if ( nWidth > nMaxWidth )
+ nWidth = nMaxWidth;
+ else if ( nWidth < nMinWidth )
+ nWidth = nMinWidth;
+
+ pAttr->add( FSNS( XML_w, XML_sz ), OString::valueOf( sal_Int32( nWidth ) ) );
+
+ // Get the distance (in pt)
+ pAttr->add( FSNS( XML_w, XML_space ), OString::valueOf( sal_Int32( nDist / 20 ) ) );
+
+ // Get the color code as an RRGGBB hex value
+ OString sColor( impl_ConvertColor( pBorderLine->GetColor( ) ) );
+ pAttr->add( FSNS( XML_w, XML_color ), sColor );
+
+ XFastAttributeListRef xAttrs( pAttr );
+ pSerializer->singleElementNS( XML_w, elementToken, xAttrs );
+}
+
+static void impl_pageBorders( FSHelperPtr pSerializer, const SvxBoxItem& rBox )
+{
+ static const USHORT aBorders[] =
+ {
+ BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT
+ };
+
+ static const USHORT aXmlElements[] =
+ {
+ XML_top, XML_left, XML_bottom, XML_right
+ };
+ const USHORT* pBrd = aBorders;
+ for( int i = 0; i < 4; ++i, ++pBrd )
+ {
+ const SvxBorderLine* pLn = rBox.GetLine( *pBrd );
+ if ( pLn )
+ impl_borderLine( pSerializer, aXmlElements[i], pLn, 0 );
+ }
+}
+
+void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ m_pSerializer->startElementNS( XML_w, XML_tcPr, FSEND );
+
+ const SwTableBox *pTblBox = pTableTextNodeInfoInner->getTableBox( );
+
+ // The cell borders
+ m_pSerializer->startElementNS( XML_w, XML_tcBorders, FSEND );
+ SwFrmFmt *pFmt = pTblBox->GetFrmFmt( );
+ impl_pageBorders( m_pSerializer, pFmt->GetBox( ) );
+ m_pSerializer->endElementNS( XML_w, XML_tcBorders );
+
+ // Vertical merges
+ long vSpan = pTblBox->getRowSpan( );
+ if ( vSpan > 1 )
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_vMerge,
+ FSNS( XML_w, XML_val ), "restart",
+ FSEND );
+ }
+ else if ( vSpan < 0 )
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_vMerge,
+ FSNS( XML_w, XML_val ), "continue",
+ FSEND );
+ }
+
+ // Horizontal spans
+ const SwWriteTableRows& aRows = m_pTableWrt->GetRows( );
+ SwWriteTableRow *pRow = aRows[ pTableTextNodeInfoInner->getRow( ) ];
+ SwWriteTableCell *pCell = pRow->GetCells( )[ pTableTextNodeInfoInner->getCell( ) ];
+
+ USHORT nColSpan = pCell->GetColSpan();
+ if ( nColSpan > 1 )
+ m_pSerializer->singleElementNS( XML_w, XML_gridSpan,
+ FSNS( XML_w, XML_val ), OString::valueOf( sal_Int32( nColSpan ) ).getStr(),
+ FSEND );
+
+ TableBackgrounds( pTableTextNodeInfoInner );
+
+ // Cell prefered width
+ SwTwips nWidth = GetGridCols( pTableTextNodeInfoInner )[ pTableTextNodeInfoInner->getCell() ];
+ m_pSerializer->singleElementNS( XML_w, XML_tcW,
+ FSNS( XML_w, XML_w ), OString::valueOf( sal_Int32( nWidth ) ).getStr( ),
+ FSNS( XML_w, XML_type ), "dxa",
+ FSEND );
+
+ // Cell margins
+ m_pSerializer->startElementNS( XML_w, XML_tcMar, FSEND );
+ const SvxBoxItem& rBox = pFmt->GetBox( );
+ static const USHORT aBorders[] =
+ {
+ BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT
+ };
+
+ static const USHORT aXmlElements[] =
+ {
+ XML_top, XML_left, XML_bottom, XML_right
+ };
+ const USHORT* pBrd = aBorders;
+ for( int i = 0; i < 4; ++i, ++pBrd )
+ {
+ sal_Int32 nDist = sal_Int32( rBox.GetDistance( *pBrd ) );
+ m_pSerializer->singleElementNS( XML_w, aXmlElements[i],
+ FSNS( XML_w, XML_w ), OString::valueOf( nDist ).getStr( ),
+ FSNS( XML_w, XML_type ), "dxa",
+ FSEND );
+ }
+
+ m_pSerializer->endElementNS( XML_w, XML_tcMar );
+
+ TableVerticalCell( pTableTextNodeInfoInner );
+
+ m_pSerializer->endElementNS( XML_w, XML_tcPr );
+}
+
+void DocxAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ sal_uInt32 nPageSize = 0;
+ bool bRelBoxSize = false;
+
+ // Create the SwWriteTable instance to use col spans (and maybe other infos)
+ GetTablePageSize( pTableTextNodeInfoInner, nPageSize, bRelBoxSize );
+
+ const SwTable* pTable = pTableTextNodeInfoInner->getTable( );
+ const SwFrmFmt *pFmt = pTable->GetFrmFmt( );
+ SwTwips nTblSz = pFmt->GetFrmSize( ).GetWidth( );
+
+ const SwHTMLTableLayout *pLayout = pTable->GetHTMLTableLayout();
+ if( pLayout && pLayout->IsExportable() )
+ m_pTableWrt = new SwWriteTable( pLayout );
+ else
+ m_pTableWrt = new SwWriteTable( pTable->GetTabLines(), (USHORT)nPageSize,
+ (USHORT)nTblSz, false);
+}
+
+void DocxAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ m_pSerializer->startElementNS( XML_w, XML_tbl, FSEND );
+
+ InitTableHelper( pTableTextNodeInfoInner );
+ TableDefinition( pTableTextNodeInfoInner );
+}
+
+void DocxAttributeOutput::EndTable()
+{
+ m_pSerializer->endElementNS( XML_w, XML_tbl );
+
+ if ( m_nTableDepth > 0 )
+ --m_nTableDepth;
+
+ // We closed the table; if it is a nested table, the cell that contains it
+ // still continues
+ m_bTableCellOpen = true;
+
+ // Cleans the table helper
+ delete m_pTableWrt, m_pTableWrt = NULL;
+}
+
+void DocxAttributeOutput::StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ m_pSerializer->startElementNS( XML_w, XML_tr, FSEND );
+
+ // Output the row properties
+ m_pSerializer->startElementNS( XML_w, XML_trPr, FSEND );
+
+ // Header row: tblHeader
+ const SwTable *pTable = pTableTextNodeInfoInner->getTable( );
+ if ( pTable->GetRowsToRepeat( ) > pTableTextNodeInfoInner->getRow( ) )
+ m_pSerializer->singleElementNS( XML_w, XML_tblHeader,
+ FSNS( XML_w, XML_val ), "true",
+ FSEND );
+
+ TableHeight( pTableTextNodeInfoInner );
+ TableCanSplit( pTableTextNodeInfoInner );
+
+ m_pSerializer->endElementNS( XML_w, XML_trPr );
+}
+
+void DocxAttributeOutput::EndTableRow( )
+{
+ m_pSerializer->endElementNS( XML_w, XML_tr );
+}
+
+
+void DocxAttributeOutput::StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ if ( !m_pTableWrt )
+ InitTableHelper( pTableTextNodeInfoInner );
+
+ m_pSerializer->startElementNS( XML_w, XML_tc, FSEND );
+
+ // Write the cell properties here
+ TableCellProperties( pTableTextNodeInfoInner );
+
+ m_bTableCellOpen = true;
+}
+
+void DocxAttributeOutput::EndTableCell( )
+{
+ m_pSerializer->endElementNS( XML_w, XML_tc );
+
+ m_bTableCellOpen = false;
+}
+
+void DocxAttributeOutput::TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
+{
+}
+
+void DocxAttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfo*/ )
+{
+}
+
+void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ // Write the table properties
+ m_pSerializer->startElementNS( XML_w, XML_tblPr, FSEND );
+
+ sal_uInt32 nPageSize = 0;
+ bool bRelBoxSize = false;
+
+ // Create the SwWriteTable instance to use col spans (and maybe other infos)
+ GetTablePageSize( pTableTextNodeInfoInner, nPageSize, bRelBoxSize );
+
+ // Output the table prefered width
+ if ( nPageSize != 0 )
+ m_pSerializer->singleElementNS( XML_w, XML_tblW,
+ FSNS( XML_w, XML_w ), OString::valueOf( sal_Int32( nPageSize ) ).getStr( ),
+ FSNS( XML_w, XML_type ), "dxa",
+ FSEND );
+
+ // Output the table borders
+ TableDefaultBorders( pTableTextNodeInfoInner );
+ TableBidi( pTableTextNodeInfoInner );
+
+ // Output the table alignement
+ const SwTable *pTable = pTableTextNodeInfoInner->getTable();
+ SwFrmFmt *pTblFmt = pTable->GetFrmFmt( );
+ const char* pJcVal;
+ sal_Int32 nIndent = 0;
+ switch ( pTblFmt->GetHoriOrient( ).GetHoriOrient( ) )
+ {
+ case text::HoriOrientation::CENTER:
+ pJcVal = "center";
+ break;
+ case text::HoriOrientation::RIGHT:
+ pJcVal = "right";
+ break;
+ default:
+ case text::HoriOrientation::NONE:
+ case text::HoriOrientation::LEFT_AND_WIDTH:
+ {
+ pJcVal = "left";
+ nIndent = sal_Int32( pTblFmt->GetLRSpace( ).GetLeft( ) );
+ break;
+ }
+ }
+ m_pSerializer->singleElementNS( XML_w, XML_jc,
+ FSNS( XML_w, XML_val ), pJcVal,
+ FSEND );
+
+ // Table indent
+ if ( nIndent != 0 )
+ m_pSerializer->singleElementNS( XML_w, XML_tblInd,
+ FSNS( XML_w, XML_w ), OString::valueOf( nIndent ).getStr( ),
+ FSNS( XML_w, XML_type ), "dxa",
+ FSEND );
+
+ m_pSerializer->endElementNS( XML_w, XML_tblPr );
+
+
+ // Write the table grid infos
+ m_pSerializer->startElementNS( XML_w, XML_tblGrid, FSEND );
+
+ std::vector<SwTwips> gridCols = GetGridCols( pTableTextNodeInfoInner );
+ for ( std::vector<SwTwips>::const_iterator it = gridCols.begin(); it != gridCols.end(); ++it )
+ m_pSerializer->singleElementNS( XML_w, XML_gridCol,
+ FSNS( XML_w, XML_w ), OString::valueOf( sal_Int32( *it ) ).getStr( ),
+ FSEND );
+
+ m_pSerializer->endElementNS( XML_w, XML_tblGrid );
+}
+
+void DocxAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
+ const SwFrmFmt * pFrmFmt = pTabBox->GetFrmFmt();
+
+ // the defaults of the table are taken from the top-left cell
+ m_pSerializer->startElementNS( XML_w, XML_tblBorders, FSEND );
+ impl_pageBorders( m_pSerializer, pFrmFmt->GetBox( ) );
+ m_pSerializer->endElementNS( XML_w, XML_tblBorders );
+}
+
+void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ const SwTableBox *pTblBox = pTableTextNodeInfoInner->getTableBox( );
+ const SwFrmFmt *pFmt = pTblBox->GetFrmFmt( );
+ const SfxPoolItem *pI = NULL;
+
+ Color aColor;
+ if ( SFX_ITEM_ON == pFmt->GetAttrSet().GetItemState( RES_BACKGROUND, false, &pI ) )
+ aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor();
+ else
+ aColor = COL_AUTO;
+
+ OString sColor = impl_ConvertColor( aColor );
+ m_pSerializer->singleElementNS( XML_w, XML_shd,
+ FSNS( XML_w, XML_fill ), sColor.getStr( ),
+ FSEND );
+}
+
+void DocxAttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
+ const SwTableLine * pTabLine = pTabBox->GetUpper();
+ const SwFrmFmt * pLineFmt = pTabLine->GetFrmFmt();
+
+ const SwFmtFrmSize& rLSz = pLineFmt->GetFrmSize();
+ if ( ATT_VAR_SIZE != rLSz.GetHeightSizeType() && rLSz.GetHeight() )
+ {
+ sal_Int32 nHeight = rLSz.GetHeight();
+ const char *pRule = NULL;
+
+ switch ( rLSz.GetHeightSizeType() )
+ {
+ case ATT_FIX_SIZE: pRule = "exact"; break;
+ case ATT_MIN_SIZE: pRule = "atLeast"; break;
+ default: break;
+ }
+
+ if ( pRule )
+ m_pSerializer->singleElementNS( XML_w, XML_trHeight,
+ FSNS( XML_w, XML_val ), OString::valueOf( nHeight ).getStr( ),
+ FSNS( XML_w, XML_hRule ), pRule,
+ FSEND );
+ }
+}
+
+void DocxAttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
+ const SwTableLine * pTabLine = pTabBox->GetUpper();
+ const SwFrmFmt * pLineFmt = pTabLine->GetFrmFmt();
+
+ const SwFmtRowSplit& rSplittable = pLineFmt->GetRowSplit( );
+ const char* pCantSplit = ( !rSplittable.GetValue( ) ) ? "on" : "off";
+
+ m_pSerializer->singleElementNS( XML_w, XML_cantSplit,
+ FSNS( XML_w, XML_val ), pCantSplit,
+ FSEND );
+}
+
+void DocxAttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ const SwTable * pTable = pTableTextNodeInfoInner->getTable();
+ const SwFrmFmt * pFrmFmt = pTable->GetFrmFmt();
+
+ if ( m_rExport.TrueFrameDirection( *pFrmFmt ) == FRMDIR_HORI_RIGHT_TOP )
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_bidiVisual,
+ FSNS( XML_w, XML_val ), "on",
+ FSEND );
+ }
+}
+
+void DocxAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
+ const SwFrmFmt *pFrmFmt = pTabBox->GetFrmFmt( );
+
+ if ( FRMDIR_VERT_TOP_RIGHT == m_rExport.TrueFrameDirection( *pFrmFmt ) )
+ m_pSerializer->singleElementNS( XML_w, XML_textDirection,
+ FSNS( XML_w, XML_val ), "tbRl",
+ FSEND );
+}
+
+void DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t /*pNodeInfo*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO: DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo )\n" );
+#endif
+}
+
+void DocxAttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner )
+{
+ // This is called when the nested table ends in a cell, and there's no
+ // paragraph benhind that; so we must check for the ends of cell, rows,
+ // tables
+ // ['true' to write an empty paragraph, MS Word insists on that]
+ FinishTableRowCell( pNodeInfoInner, true );
+}
+
+void DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO: DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )\n" );
+#endif
+}
+
+void DocxAttributeOutput::TableRowEnd( sal_uInt32 /*nDepth*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO: DocxAttributeOutput::TableRowEnd( sal_uInt32 nDepth = 1 )\n" );
+#endif
+}
+
+void DocxAttributeOutput::StartStyles()
+{
+ m_pSerializer->startElementNS( XML_w, XML_styles,
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSEND );
+}
+
+void DocxAttributeOutput::EndStyles( USHORT /*nNumberOfStyles*/ )
+{
+ m_pSerializer->endElementNS( XML_w, XML_styles );
+}
+
+void DocxAttributeOutput::DefaultStyle( USHORT nStyle )
+{
+ // are these the values of enum ww::sti (see ../inc/wwstyles.hxx)?
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::DefaultStyle( USHORT nStyle )- %d\n", nStyle );
+#else
+ (void) nStyle; // to quiet the warning
+#endif
+}
+
+void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) - some stuff still missing\n" );
+#endif
+ // create the relation ID
+ OString aRelId;
+ sal_Int32 nImageType;
+ if ( rGrfNode.IsLinkedFile() )
+ {
+ // linked image, just create the relation
+ String aFileName;
+ rGrfNode.GetFileFilterNms( &aFileName, 0 );
+
+ // TODO Convert the file name to relative for better interoperability
+
+ aRelId = m_rExport.AddRelation(
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" ),
+ OUString( aFileName ),
+ S( "External" ) );
+
+ nImageType = XML_link;
+ }
+ else
+ {
+ // inline, we also have to write the image itself
+ Graphic& rGraphic = const_cast< Graphic& >( rGrfNode.GetGrf() );
+
+ m_rDrawingML.SetFS( m_pSerializer ); // to be sure that we write to the right stream
+ OUString aImageId = m_rDrawingML.WriteImage( rGraphic );
+
+ aRelId = OUStringToOString( aImageId, RTL_TEXTENCODING_UTF8 );
+
+ nImageType = XML_embed;
+ }
+
+ if ( aRelId.getLength() == 0 )
+ return;
+
+ m_pSerializer->startElementNS( XML_w, XML_drawing,
+ FSEND );
+ m_pSerializer->startElementNS( XML_wp, XML_inline,
+ XML_distT, "0", XML_distB, "0", XML_distL, "0", XML_distR, "0",
+ FSEND );
+
+ // extent of the image
+ OString aWidth( OString::valueOf( TwipsToEMU( rSize.Width() ) ) );
+ OString aHeight( OString::valueOf( TwipsToEMU( rSize.Height() ) ) );
+ m_pSerializer->singleElementNS( XML_wp, XML_extent,
+ XML_cx, aWidth.getStr(),
+ XML_cy, aHeight.getStr(),
+ FSEND );
+ // TODO - the right effectExtent, extent including the effect
+ m_pSerializer->singleElementNS( XML_wp, XML_effectExtent,
+ XML_l, "0", XML_t, "0", XML_r, "0", XML_b, "0",
+ FSEND );
+
+ // picture description
+ // TODO the right image description
+ m_pSerializer->startElementNS( XML_wp, XML_docPr,
+ XML_id, "1",
+ XML_name, "Picture",
+ XML_descr, "A description...",
+ FSEND );
+ // TODO hyperlink
+ // m_pSerializer->singleElementNS( XML_a, XML_hlinkClick,
+ // FSNS( XML_xmlns, XML_a ), "http://schemas.openxmlformats.org/drawingml/2006/main",
+ // FSNS( XML_r, XML_id ), "rId4",
+ // FSEND );
+ m_pSerializer->endElementNS( XML_wp, XML_docPr );
+
+ m_pSerializer->startElementNS( XML_wp, XML_cNvGraphicFramePr,
+ FSEND );
+ // TODO change aspect?
+ m_pSerializer->singleElementNS( XML_a, XML_graphicFrameLocks,
+ FSNS( XML_xmlns, XML_a ), "http://schemas.openxmlformats.org/drawingml/2006/main",
+ XML_noChangeAspect, "1",
+ FSEND );
+ m_pSerializer->endElementNS( XML_wp, XML_cNvGraphicFramePr );
+
+ m_pSerializer->startElementNS( XML_a, XML_graphic,
+ FSNS( XML_xmlns, XML_a ), "http://schemas.openxmlformats.org/drawingml/2006/main",
+ FSEND );
+ m_pSerializer->startElementNS( XML_a, XML_graphicData,
+ XML_uri, "http://schemas.openxmlformats.org/drawingml/2006/picture",
+ FSEND );
+
+ m_pSerializer->startElementNS( XML_pic, XML_pic,
+ FSNS( XML_xmlns, XML_pic ), "http://schemas.openxmlformats.org/drawingml/2006/picture",
+ FSEND );
+
+ m_pSerializer->startElementNS( XML_pic, XML_nvPicPr,
+ FSEND );
+ // TODO the right image description
+ m_pSerializer->startElementNS( XML_pic, XML_cNvPr,
+ XML_id, "0",
+ XML_name, "Picture",
+ XML_descr, "A description...",
+ FSEND );
+ // TODO hyperlink
+ // m_pSerializer->singleElementNS( XML_a, XML_hlinkClick,
+ // FSNS( XML_r, XML_id ), "rId4",
+ // FSEND );
+ m_pSerializer->endElementNS( XML_pic, XML_cNvPr );
+
+ m_pSerializer->startElementNS( XML_pic, XML_cNvPicPr,
+ FSEND );
+ // TODO change aspect?
+ m_pSerializer->singleElementNS( XML_a, XML_picLocks,
+ XML_noChangeAspect, "1", XML_noChangeArrowheads, "1",
+ FSEND );
+ m_pSerializer->endElementNS( XML_pic, XML_cNvPicPr );
+ m_pSerializer->endElementNS( XML_pic, XML_nvPicPr );
+
+ // the actual picture
+ m_pSerializer->startElementNS( XML_pic, XML_blipFill,
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_blip,
+ FSNS( XML_r, nImageType ), aRelId.getStr(),
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_srcRect,
+ FSEND );
+ m_pSerializer->startElementNS( XML_a, XML_stretch,
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_fillRect,
+ FSEND );
+ m_pSerializer->endElementNS( XML_a, XML_stretch );
+ m_pSerializer->endElementNS( XML_pic, XML_blipFill );
+
+ // TODO setup the right values below
+ m_pSerializer->startElementNS( XML_pic, XML_spPr,
+ XML_bwMode, "auto",
+ FSEND );
+ m_pSerializer->startElementNS( XML_a, XML_xfrm,
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_off,
+ XML_x, "0", XML_y, "0",
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_ext,
+ XML_cx, aWidth.getStr(),
+ XML_cy, aHeight.getStr(),
+ FSEND );
+ m_pSerializer->endElementNS( XML_a, XML_xfrm );
+ m_pSerializer->startElementNS( XML_a, XML_prstGeom,
+ XML_prst, "rect",
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_avLst,
+ FSEND );
+ m_pSerializer->endElementNS( XML_a, XML_prstGeom );
+ m_pSerializer->singleElementNS( XML_a, XML_noFill,
+ FSEND );
+ m_pSerializer->startElementNS( XML_a, XML_ln,
+ XML_w, "9525",
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_noFill,
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_miter,
+ XML_lim, "800000",
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_headEnd,
+ FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_tailEnd,
+ FSEND );
+ m_pSerializer->endElementNS( XML_a, XML_ln );
+ m_pSerializer->endElementNS( XML_pic, XML_spPr );
+
+ m_pSerializer->endElementNS( XML_pic, XML_pic );
+
+ m_pSerializer->endElementNS( XML_a, XML_graphicData );
+ m_pSerializer->endElementNS( XML_a, XML_graphic );
+ m_pSerializer->endElementNS( XML_wp, XML_inline );
+
+ m_pSerializer->endElementNS( XML_w, XML_drawing );
+}
+
+void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Point& /*rNdTopLeft*/ )
+{
+ m_pSerializer->mark();
+
+ switch ( rFrame.GetWriterType() )
+ {
+ case sw::Frame::eGraphic:
+ {
+ const SwNode *pNode = rFrame.GetContent();
+ const SwGrfNode *pGrfNode = pNode ? pNode->GetGrfNode() : 0;
+ if ( pGrfNode )
+ FlyFrameGraphic( *pGrfNode, rFrame.GetLayoutSize() );
+ }
+ break;
+ case sw::Frame::eDrawing:
+ {
+ const SdrObject* pSdrObj = rFrame.GetFrmFmt().FindRealSdrObject();
+ if ( pSdrObj )
+ {
+ bool bSwapInPage = false;
+ if ( !pSdrObj->GetPage() )
+ {
+ if ( SdrModel* pModel = m_rExport.pDoc->GetDrawModel() )
+ {
+ if ( SdrPage *pPage = pModel->GetPage( 0 ) )
+ {
+ bSwapInPage = true;
+ const_cast< SdrObject* >( pSdrObj )->SetPage( pPage );
+ }
+ }
+ }
+
+ m_pSerializer->startElementNS( XML_w, XML_pict,
+ FSEND );
+
+ m_rExport.VMLExporter().AddSdrObject( *pSdrObj );
+
+ m_pSerializer->endElementNS( XML_w, XML_pict );
+
+ if ( bSwapInPage )
+ const_cast< SdrObject* >( pSdrObj )->SetPage( 0 );
+ }
+ }
+ break;
+ default:
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Point& rNdTopLeft ) - frame type '%s'\n",
+ rFrame.GetWriterType() == sw::Frame::eTxtBox? "eTxtBox":
+ ( rFrame.GetWriterType() == sw::Frame::eOle? "eOle":
+ ( rFrame.GetWriterType() == sw::Frame::eFormControl? "eFormControl": "???" ) ) );
+#endif
+ break;
+ }
+
+ m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_POSTPONE );
+}
+
+void DocxAttributeOutput::StartStyle( const String& rName, bool bPapFmt,
+ USHORT nBase, USHORT nNext, USHORT /*nWwId*/, USHORT nId )
+{
+ OString aStyle( "style" );
+
+ m_pSerializer->startElementNS( XML_w, XML_style,
+ FSNS( XML_w, XML_type ), bPapFmt? "paragraph": "character", // FIXME is this correct?
+ FSNS( XML_w, XML_styleId ), ( aStyle + OString::valueOf( sal_Int32( nId ) ) ).getStr(),
+ FSEND );
+
+ m_pSerializer->singleElementNS( XML_w, XML_name,
+ FSNS( XML_w, XML_val ), OUStringToOString( OUString( rName ), RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+
+ if ( nBase != 0x0FFF )
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_basedOn,
+ FSNS( XML_w, XML_val ), ( aStyle + OString::valueOf( sal_Int32( nBase ) ) ).getStr(),
+ FSEND );
+ }
+
+ m_pSerializer->singleElementNS( XML_w, XML_next,
+ FSNS( XML_w, XML_val ), ( aStyle + OString::valueOf( sal_Int32( nNext ) ) ).getStr(),
+ FSEND );
+}
+
+void DocxAttributeOutput::EndStyle()
+{
+ m_pSerializer->endElementNS( XML_w, XML_style );
+}
+
+void DocxAttributeOutput::StartStyleProperties( bool bParProp, USHORT /*nStyle*/ )
+{
+ if ( bParProp )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_pPr, FSEND );
+ InitCollectedParagraphProperties();
+ }
+ else
+ {
+ m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
+ InitCollectedRunProperties();
+ }
+}
+
+void DocxAttributeOutput::EndStyleProperties( bool bParProp )
+{
+ if ( bParProp )
+ {
+ WriteCollectedParagraphProperties();
+ m_pSerializer->endElementNS( XML_w, XML_pPr );
+ }
+ else
+ {
+ WriteCollectedRunProperties();
+ m_pSerializer->endElementNS( XML_w, XML_rPr );
+ }
+}
+
+void DocxAttributeOutput::OutlineNumbering( BYTE nLvl, const SwNumFmt& /*rNFmt*/, const SwFmt& /*rFmt*/ )
+{
+ if ( nLvl >= WW8ListManager::nMaxLevel )
+ nLvl = WW8ListManager::nMaxLevel - 1;
+
+ m_pSerializer->singleElementNS( XML_w, XML_outlineLvl,
+ FSNS( XML_w, XML_val ), OString::valueOf( sal_Int32( nLvl ) ).getStr( ),
+ FSEND );
+}
+
+void DocxAttributeOutput::PageBreakBefore( bool bBreak )
+{
+ if ( bBreak )
+ m_pSerializer->singleElementNS( XML_w, XML_pageBreakBefore, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_pageBreakBefore,
+ FSNS( XML_w, XML_val ), "off",
+ FSEND );
+}
+
+void DocxAttributeOutput::SectionBreak( BYTE nC, const WW8_SepInfo* pSectionInfo )
+{
+ switch ( nC )
+ {
+ case msword::ColumnBreak:
+ // The column break should be output in the next paragraph...
+ m_nColBreakStatus = COLBRK_POSTPONE;
+ break;
+ case msword::PageBreak:
+ if ( pSectionInfo )
+ {
+ if ( !m_bParagraphOpened )
+ {
+ // Create a dummy paragraph if needed
+ m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
+ m_pSerializer->startElementNS( XML_w, XML_pPr, FSEND );
+
+ m_rExport.SectionProperties( *pSectionInfo );
+
+ m_pSerializer->endElementNS( XML_w, XML_pPr );
+ m_pSerializer->endElementNS( XML_w, XML_p );
+ }
+ else
+ {
+ // postpone the output of this; it has to be done inside the
+ // paragraph properties, so remember it until then
+ m_pSectionInfo = pSectionInfo;
+ }
+ }
+ else
+ {
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_br,
+ FSNS( XML_w, XML_type ), "page", FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+ }
+ break;
+ default:
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "Unknown section break to write: %d\n", nC );
+#endif
+ break;
+ }
+}
+
+void DocxAttributeOutput::StartSection()
+{
+ m_pSerializer->startElementNS( XML_w, XML_sectPr, FSEND );
+ m_bOpenedSectPr = true;
+}
+
+void DocxAttributeOutput::EndSection()
+{
+ // Write the section properties
+ if ( m_pSpacingAttrList )
+ {
+ XFastAttributeListRef xAttrList( m_pSpacingAttrList );
+ m_pSpacingAttrList = NULL;
+
+ m_pSerializer->singleElementNS( XML_w, XML_pgMar, xAttrList );
+ }
+
+ m_pSerializer->endElementNS( XML_w, XML_sectPr );
+ m_bOpenedSectPr = false;
+}
+
+void DocxAttributeOutput::SectionFormProtection( bool bProtected )
+{
+ if ( bProtected )
+ m_pSerializer->singleElementNS( XML_w, XML_formProt, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_formProt,
+ FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::SectionLineNumbering( ULONG /*nRestartNo*/, const SwLineNumberInfo& /*rLnNumInfo*/ )
+{
+ // see 2.6.8 lnNumType (Line Numbering Settings)
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::SectionLineNumbering()\n" );
+#endif
+}
+
+void DocxAttributeOutput::SectionTitlePage()
+{
+ m_pSerializer->singleElementNS( XML_w, XML_titlePg, FSEND );
+}
+
+void DocxAttributeOutput::SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* /*pFirstPageFmt*/ )
+{
+ // Output the margins
+
+
+ const SvxBoxItem& rBox = pFmt->GetBox( );
+
+ const SvxBorderLine* pBottom = rBox.GetBottom( );
+ const SvxBorderLine* pTop = rBox.GetTop( );
+ const SvxBorderLine* pLeft = rBox.GetLeft( );
+ const SvxBorderLine* pRight = rBox.GetRight( );
+
+ if ( pBottom || pTop || pLeft || pRight )
+ {
+ // All distances are relative to the text margins
+ m_pSerializer->startElementNS( XML_w, XML_pgBorders,
+ FSNS( XML_w, XML_display ), "allPages",
+ FSNS( XML_w, XML_offsetFrom ), "text",
+ FSEND );
+
+ m_pSerializer->mark();
+
+ m_pSerializer->endElementNS( XML_w, XML_pgBorders );
+ m_pSerializer->mark();
+ }
+}
+
+void DocxAttributeOutput::SectionBiDi( bool bBiDi )
+{
+ if ( bBiDi )
+ m_pSerializer->singleElementNS( XML_w, XML_bidi, FSEND );
+}
+
+static OString impl_NumberingType( USHORT nNumberingType )
+{
+ OString aType;
+
+ switch ( nNumberingType )
+ {
+ case SVX_NUM_CHARS_UPPER_LETTER:
+ case SVX_NUM_CHARS_UPPER_LETTER_N: aType = "upperLetter"; break;
+ case SVX_NUM_CHARS_LOWER_LETTER:
+ case SVX_NUM_CHARS_LOWER_LETTER_N: aType = "lowerLetter"; break;
+ case SVX_NUM_ROMAN_UPPER: aType = "upperRoman"; break;
+ case SVX_NUM_ROMAN_LOWER: aType = "lowerRoman"; break;
+
+ case SVX_NUM_ARABIC: aType = "decimal"; break;
+
+ case SVX_NUM_BITMAP:
+ case SVX_NUM_CHAR_SPECIAL: aType = "bullet"; break;
+
+ default: aType = "none"; break;
+ }
+
+ return aType;
+}
+
+void DocxAttributeOutput::SectionPageNumbering( USHORT nNumType, USHORT nPageRestartNumber )
+{
+ // FIXME Not called properly with page styles like "First Page"
+
+ FastAttributeList* pAttr = m_pSerializer->createAttrList();
+
+ // 0 means no restart: then don't output that attribute if 0
+ if ( nPageRestartNumber > 0 )
+ pAttr->add( FSNS( XML_w, XML_start ), OString::valueOf( sal_Int32( nPageRestartNumber ) ) );
+
+ // nNumType corresponds to w:fmt. See WW8Export::GetNumId() for more precisions
+ OString aFmt( impl_NumberingType( nNumType ) );
+ if ( aFmt.getLength() )
+ pAttr->add( FSNS( XML_w, XML_fmt ), aFmt.getStr() );
+
+ XFastAttributeListRef xAttrs( pAttr );
+ m_pSerializer->singleElementNS( XML_w, XML_pgNumType, xAttrs );
+
+ // see 2.6.12 pgNumType (Page Numbering Settings)
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::SectionPageNumbering()\n" );
+#endif
+}
+
+void DocxAttributeOutput::SectionType( BYTE nBreakCode )
+{
+ /* break code: 0 No break, 1 New column
+ 2 New page, 3 Even page, 4 Odd page
+ */
+ const char* pType = NULL;
+ switch ( nBreakCode )
+ {
+ case 1: pType = "nextColumn"; break;
+ case 2: pType = "nextPage"; break;
+ case 3: pType = "evenPage"; break;
+ case 4: pType = "oddPage"; break;
+ default: pType = "continuous"; break;
+ }
+
+ if ( pType )
+ m_pSerializer->singleElementNS( XML_w, XML_type,
+ FSNS( XML_w, XML_val ), pType,
+ FSEND );
+}
+
+void DocxAttributeOutput::StartFont( const String& rFamilyName ) const
+{
+ m_pSerializer->startElementNS( XML_w, XML_font,
+ FSNS( XML_w, XML_name ), OUStringToOString( OUString( rFamilyName ), RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+}
+
+void DocxAttributeOutput::EndFont() const
+{
+ m_pSerializer->endElementNS( XML_w, XML_font );
+}
+
+void DocxAttributeOutput::FontAlternateName( const String& rName ) const
+{
+ m_pSerializer->singleElementNS( XML_w, XML_altName,
+ FSNS( XML_w, XML_val ), OUStringToOString( OUString( rName ), RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+}
+
+void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet ) const
+{
+ OString aCharSet( OString::valueOf( sal_Int32( nCharSet ), 16 ) );
+ if ( aCharSet.getLength() == 1 )
+ aCharSet = OString( "0" ) + aCharSet;
+
+ m_pSerializer->singleElementNS( XML_w, XML_charset,
+ FSNS( XML_w, XML_val ), aCharSet.getStr(),
+ FSEND );
+}
+
+void DocxAttributeOutput::FontFamilyType( FontFamily eFamily ) const
+{
+ const char *pFamily = NULL;
+ switch ( eFamily )
+ {
+ case FAMILY_ROMAN: pFamily = "roman"; break;
+ case FAMILY_SWISS: pFamily = "swiss"; break;
+ case FAMILY_MODERN: pFamily = "modern"; break;
+ case FAMILY_SCRIPT: pFamily = "script"; break;
+ case FAMILY_DECORATIVE: pFamily = "decorative"; break;
+ default: pFamily = "auto"; break; // no font family
+ }
+
+ if ( pFamily )
+ m_pSerializer->singleElementNS( XML_w, XML_family,
+ FSNS( XML_w, XML_val ), pFamily,
+ FSEND );
+}
+
+void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const
+{
+ const char *pPitch = NULL;
+ switch ( ePitch )
+ {
+ case PITCH_VARIABLE: pPitch = "variable"; break;
+ case PITCH_FIXED: pPitch = "fixed"; break;
+ default: pPitch = "default"; break; // no info about the pitch
+ }
+
+ if ( pPitch )
+ m_pSerializer->singleElementNS( XML_w, XML_pitch,
+ FSNS( XML_w, XML_val ), pPitch,
+ FSEND );
+}
+
+void DocxAttributeOutput::NumberingDefinition( USHORT nId, const SwNumRule &rRule )
+{
+ // nId is the same both for abstract numbering definition as well as the
+ // numbering definition itself
+ // TODO check that this is actually true & fix if not ;-)
+ OString aId( OString::valueOf( sal_Int32( nId ) ) );
+
+ m_pSerializer->startElementNS( XML_w, XML_num,
+ FSNS( XML_w, XML_numId ), aId.getStr(),
+ FSEND );
+
+ m_pSerializer->singleElementNS( XML_w, XML_abstractNumId,
+ FSNS( XML_w, XML_val ), aId.getStr(),
+ FSEND );
+
+#if OSL_DEBUG_LEVEL > 0
+ // TODO ww8 version writes this, anything to do about it here?
+ if ( rRule.IsContinusNum() )
+ fprintf( stderr, "TODO DocxAttributeOutput::NumberingDefinition()\n" );
+#else
+ (void) rRule; // to quiet the warning...
+#endif
+
+ m_pSerializer->endElementNS( XML_w, XML_num );
+}
+
+void DocxAttributeOutput::StartAbstractNumbering( USHORT nId )
+{
+ m_pSerializer->startElementNS( XML_w, XML_abstractNum,
+ FSNS( XML_w, XML_abstractNumId ), OString::valueOf( sal_Int32( nId ) ).getStr(),
+ FSEND );
+}
+
+void DocxAttributeOutput::EndAbstractNumbering()
+{
+ m_pSerializer->endElementNS( XML_w, XML_abstractNum );
+}
+
+void DocxAttributeOutput::NumberingLevel( BYTE nLevel,
+ USHORT nStart,
+ USHORT nNumberingType,
+ SvxAdjust eAdjust,
+ const BYTE * /*pNumLvlPos*/,
+ BYTE nFollow,
+ const wwFont *pFont,
+ const SfxItemSet *pOutSet,
+ sal_Int16 nIndentAt,
+ sal_Int16 nFirstLineIndex,
+ sal_Int16 /*nListTabPos*/,
+ const String &rNumberingString )
+{
+ m_pSerializer->startElementNS( XML_w, XML_lvl,
+ FSNS( XML_w, XML_ilvl ), OString::valueOf( sal_Int32( nLevel ) ).getStr(),
+ FSEND );
+
+ // start with the nStart value
+ m_pSerializer->singleElementNS( XML_w, XML_start,
+ FSNS( XML_w, XML_val ), OString::valueOf( sal_Int32( nStart ) ).getStr(),
+ FSEND );
+
+ // format
+ OString aFmt( impl_NumberingType( nNumberingType ) );
+
+ if ( aFmt.getLength() )
+ m_pSerializer->singleElementNS( XML_w, XML_numFmt,
+ FSNS( XML_w, XML_val ), aFmt.getStr(),
+ FSEND );
+
+ // justification
+ const char *pJc;
+ switch ( eAdjust )
+ {
+ case SVX_ADJUST_CENTER: pJc = "center"; break;
+ case SVX_ADJUST_RIGHT: pJc = "right"; break;
+ default: pJc = "left"; break;
+ }
+ m_pSerializer->singleElementNS( XML_w, XML_lvlJc,
+ FSNS( XML_w, XML_val ), pJc,
+ FSEND );
+
+ // suffix
+ const char *pSuffix = NULL;
+ switch ( nFollow )
+ {
+ case 1: pSuffix = "space"; break;
+ case 2: pSuffix = "nothing"; break;
+ default: /*pSuffix = "tab";*/ break;
+ }
+ if ( pSuffix )
+ m_pSerializer->singleElementNS( XML_w, XML_suff,
+ FSNS( XML_w, XML_val ), pSuffix,
+ FSEND );
+
+ // text
+ OUString aText( rNumberingString );
+ OUStringBuffer aBuffer( aText.getLength() + WW8ListManager::nMaxLevel );
+
+ const sal_Unicode *pPrev = aText.getStr();
+ const sal_Unicode *pIt = aText.getStr();
+ while ( pIt < aText.getStr() + aText.getLength() )
+ {
+ // convert the level values to %NUMBER form
+ // (we don't use pNumLvlPos at all)
+ // FIXME so far we support the ww8 limit of levels only
+ if ( *pIt < sal_Unicode( WW8ListManager::nMaxLevel ) )
+ {
+ aBuffer.append( pPrev, pIt - pPrev );
+ aBuffer.appendAscii( "%" );
+ aBuffer.append( OUString::valueOf( sal_Int32( *pIt ) + 1 ) );
+
+ pPrev = pIt + 1;
+ }
+ ++pIt;
+ }
+ if ( pPrev < pIt )
+ aBuffer.append( pPrev, pIt - pPrev );
+
+ m_pSerializer->singleElementNS( XML_w, XML_lvlText,
+ FSNS( XML_w, XML_val ), OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+
+ // indentation
+ m_pSerializer->startElementNS( XML_w, XML_pPr, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_ind,
+ FSNS( XML_w, XML_left ), OString::valueOf( sal_Int32( nIndentAt ) ).getStr(),
+ FSNS( XML_w, XML_hanging ), OString::valueOf( sal_Int32( -nFirstLineIndex ) ).getStr(),
+ FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_pPr );
+
+ // font
+ if ( pOutSet )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
+
+ if ( pFont )
+ {
+ OString aFamilyName( OUStringToOString( OUString( pFont->GetFamilyName() ), RTL_TEXTENCODING_UTF8 ) );
+ m_pSerializer->singleElementNS( XML_w, XML_rFonts,
+ FSNS( XML_w, XML_ascii ), aFamilyName.getStr(),
+ FSNS( XML_w, XML_hAnsi ), aFamilyName.getStr(),
+ FSNS( XML_w, XML_cs ), aFamilyName.getStr(),
+ FSNS( XML_w, XML_hint ), "default",
+ FSEND );
+ }
+ m_rExport.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN );
+
+ m_pSerializer->endElementNS( XML_w, XML_rPr );
+ }
+
+ // TODO anything to do about nListTabPos?
+
+ m_pSerializer->endElementNS( XML_w, XML_lvl );
+}
+
+void DocxAttributeOutput::CharCaseMap( const SvxCaseMapItem& rCaseMap )
+{
+ switch ( rCaseMap.GetValue() )
+ {
+ case SVX_CASEMAP_KAPITAELCHEN:
+ m_pSerializer->singleElementNS( XML_w, XML_smallCaps, FSEND );
+ break;
+ case SVX_CASEMAP_VERSALIEN:
+ m_pSerializer->singleElementNS( XML_w, XML_caps, FSEND );
+ break;
+ default: // Something that ooxml does not support
+ m_pSerializer->singleElementNS( XML_w, XML_smallCaps, FSNS( XML_w, XML_val ), "off", FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_caps, FSNS( XML_w, XML_val ), "off", FSEND );
+ break;
+ }
+}
+
+void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
+{
+ const Color aColor( rColor.GetValue() );
+ OString aColorString;
+
+ aColorString = impl_ConvertColor( aColor );
+
+ m_pSerializer->singleElementNS( XML_w, XML_color,
+ FSNS( XML_w, XML_val ), aColorString.getStr(), FSEND );
+}
+
+void DocxAttributeOutput::CharContour( const SvxContourItem& rContour )
+{
+ if ( rContour.GetValue() )
+ m_pSerializer->singleElementNS( XML_w, XML_outline, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_outline, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossedOut )
+{
+ switch ( rCrossedOut.GetStrikeout() )
+ {
+ case STRIKEOUT_DOUBLE:
+ m_pSerializer->singleElementNS( XML_w, XML_dstrike, FSEND );
+ break;
+ case STRIKEOUT_NONE:
+ m_pSerializer->singleElementNS( XML_w, XML_dstrike, FSNS( XML_w, XML_val ), "off", FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_strike, FSNS( XML_w, XML_val ), "off", FSEND );
+ break;
+ default:
+ m_pSerializer->singleElementNS( XML_w, XML_strike, FSEND );
+ break;
+ }
+}
+
+void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& /*rEscapement*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::CharEscapement()\n" );
+#endif
+}
+
+void DocxAttributeOutput::CharFont( const SvxFontItem& rFont)
+{
+ if (!m_pFontsAttrList)
+ m_pFontsAttrList = m_pSerializer->createAttrList();
+ OUString sFontName(rFont.GetFamilyName());
+ OString sFontNameUtf8 = OUStringToOString(sFontName, RTL_TEXTENCODING_UTF8);
+ m_pFontsAttrList->add(FSNS(XML_w, XML_ascii), sFontNameUtf8);
+ m_pFontsAttrList->add(FSNS(XML_w, XML_hAnsi), sFontNameUtf8);
+}
+
+void DocxAttributeOutput::CharFontSize( const SvxFontHeightItem& rFontSize)
+{
+ OString fontSize = OString::valueOf( sal_Int32( ( rFontSize.GetHeight() + 5 ) / 10 ) );
+
+ switch ( rFontSize.Which() )
+ {
+ case RES_CHRATR_FONTSIZE:
+ case RES_CHRATR_CJK_FONTSIZE:
+ m_pSerializer->singleElementNS( XML_w, XML_sz, FSNS( XML_w, XML_val ), fontSize.getStr(), FSEND );
+ break;
+ case RES_CHRATR_CTL_FONTSIZE:
+ m_pSerializer->singleElementNS( XML_w, XML_szCs, FSNS( XML_w, XML_val ), fontSize.getStr(), FSEND );
+ break;
+ }
+}
+
+void DocxAttributeOutput::CharKerning( const SvxKerningItem& rKerning )
+{
+ OString aKerning = OString::valueOf( ( sal_Int32 ) rKerning.GetValue() );
+ m_pSerializer->singleElementNS( XML_w, XML_kern, FSNS(XML_w, XML_val), aKerning.getStr(), FSEND );
+}
+
+void DocxAttributeOutput::CharLanguage( const SvxLanguageItem& rLanguage )
+{
+ if (!m_pCharLangAttrList)
+ m_pCharLangAttrList = m_pSerializer->createAttrList();
+
+ ::com::sun::star::lang::Locale xLocale= MsLangId::convertLanguageToLocale( rLanguage.GetLanguage( ) );
+ OString sLanguage = OUStringToOString(xLocale.Language, RTL_TEXTENCODING_UTF8);
+ OString sCountry = OUStringToOString(xLocale.Country, RTL_TEXTENCODING_UTF8);
+
+ OString aLanguageCode = sLanguage + "-" + sCountry;
+
+ switch ( rLanguage.Which() )
+ {
+ case RES_CHRATR_LANGUAGE:
+ m_pCharLangAttrList->add(FSNS(XML_w, XML_val), aLanguageCode);
+ break;
+ case RES_CHRATR_CJK_LANGUAGE:
+ m_pCharLangAttrList->add(FSNS(XML_w, XML_eastAsia), aLanguageCode);
+ break;
+ case RES_CHRATR_CTL_LANGUAGE:
+ m_pCharLangAttrList->add(FSNS(XML_w, XML_bidi), aLanguageCode);
+ break;
+ }
+}
+
+void DocxAttributeOutput::CharPosture( const SvxPostureItem& rPosture )
+{
+ if ( rPosture.GetPosture() != ITALIC_NONE )
+ m_pSerializer->singleElementNS( XML_w, XML_i, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_i, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::CharShadow( const SvxShadowedItem& rShadow )
+{
+ if ( rShadow.GetValue() )
+ m_pSerializer->singleElementNS( XML_w, XML_shadow, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_shadow, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline )
+{
+ const char *pUnderline;
+
+ switch ( rUnderline.GetLineStyle() )
+ {
+ case UNDERLINE_SINGLE: pUnderline = "single"; break;
+ case UNDERLINE_BOLD: pUnderline = "thick"; break;
+ case UNDERLINE_DOUBLE: pUnderline = "double"; break;
+ case UNDERLINE_DOTTED: pUnderline = "dotted"; break;
+ case UNDERLINE_DASH: pUnderline = "dash"; break;
+ case UNDERLINE_DASHDOT: pUnderline = "dotDash"; break;
+ case UNDERLINE_DASHDOTDOT: pUnderline = "dotDotDash"; break;
+ case UNDERLINE_WAVE: pUnderline = "wave"; break;
+ case UNDERLINE_BOLDDOTTED: pUnderline = "dottedHeavy"; break;
+ case UNDERLINE_BOLDDASH: pUnderline = "dashedHeavy"; break;
+ case UNDERLINE_LONGDASH: pUnderline = "dashLongHeavy"; break;
+ case UNDERLINE_BOLDLONGDASH: pUnderline = "dashLongHeavy"; break;
+ case UNDERLINE_BOLDDASHDOT: pUnderline = "dashDotHeavy"; break;
+ case UNDERLINE_BOLDDASHDOTDOT: pUnderline = "dashDotDotHeavy"; break;
+ case UNDERLINE_BOLDWAVE: pUnderline = "wavyHeavy"; break;
+ case UNDERLINE_DOUBLEWAVE: pUnderline = "wavyDouble"; break;
+ case UNDERLINE_NONE: // fall through
+ default: pUnderline = "none"; break;
+ }
+
+ m_pSerializer->singleElementNS( XML_w, XML_u, FSNS( XML_w, XML_val ), pUnderline, FSEND );
+}
+
+void DocxAttributeOutput::CharWeight( const SvxWeightItem& rWeight )
+{
+ if ( rWeight.GetWeight() == WEIGHT_BOLD )
+ m_pSerializer->singleElementNS( XML_w, XML_b, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_b, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::CharAutoKern( const SvxAutoKernItem& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::CharAutoKern()\n" );
+#endif
+}
+
+void DocxAttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink )
+{
+ if ( rBlink.GetValue() )
+ m_pSerializer->singleElementNS(XML_w, XML_effect, FSNS( XML_w, XML_val ), "blinkBackground", FSEND );
+ else
+ m_pSerializer->singleElementNS(XML_w, XML_effect, FSNS( XML_w, XML_val ), "none", FSEND );
+}
+
+void DocxAttributeOutput::CharBackground( const SvxBrushItem& rBrush )
+{
+ m_pSerializer->singleElementNS( XML_w, XML_shd,
+ FSNS( XML_w, XML_fill ), impl_ConvertColor( rBrush.GetColor() ).getStr(), FSEND );
+}
+
+void DocxAttributeOutput::CharFontCJK( const SvxFontItem& rFont )
+{
+ if (!m_pFontsAttrList)
+ m_pFontsAttrList = m_pSerializer->createAttrList();
+ OUString sFontName(rFont.GetFamilyName());
+ OString sFontNameUtf8 = OUStringToOString(sFontName, RTL_TEXTENCODING_UTF8);
+ m_pFontsAttrList->add(FSNS(XML_w, XML_eastAsia), sFontNameUtf8);
+}
+
+void DocxAttributeOutput::CharPostureCJK( const SvxPostureItem& rPosture )
+{
+ if ( rPosture.GetPosture() != ITALIC_NONE )
+ m_pSerializer->singleElementNS( XML_w, XML_i, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_i, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::CharWeightCJK( const SvxWeightItem& rWeight )
+{
+ if ( rWeight.GetWeight() == WEIGHT_BOLD )
+ m_pSerializer->singleElementNS( XML_w, XML_b, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_b, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::CharFontCTL( const SvxFontItem& rFont )
+{
+ if (!m_pFontsAttrList)
+ m_pFontsAttrList = m_pSerializer->createAttrList();
+ OUString sFontName(rFont.GetFamilyName());
+ OString sFontNameUtf8 = OUStringToOString(sFontName, RTL_TEXTENCODING_UTF8);
+ m_pFontsAttrList->add(FSNS(XML_w, XML_cs), sFontNameUtf8);
+
+}
+
+void DocxAttributeOutput::CharPostureCTL( const SvxPostureItem& rPosture)
+{
+ if ( rPosture.GetPosture() != ITALIC_NONE )
+ m_pSerializer->singleElementNS( XML_w, XML_iCs, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_iCs, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::CharWeightCTL( const SvxWeightItem& rWeight )
+{
+ if ( rWeight.GetWeight() == WEIGHT_BOLD )
+ m_pSerializer->singleElementNS( XML_w, XML_bCs, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_bCs, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::CharRotate( const SvxCharRotateItem& rRotate)
+{
+ if ( !rRotate.GetValue() )
+ return;
+
+ if (!m_pEastAsianLayoutAttrList)
+ m_pEastAsianLayoutAttrList = m_pSerializer->createAttrList();
+ OString sTrue((sal_Char *)"true");
+ m_pEastAsianLayoutAttrList->add(FSNS(XML_w, XML_vert), sTrue);
+
+ if (rRotate.IsFitToLine())
+ m_pEastAsianLayoutAttrList->add(FSNS(XML_w, XML_vertCompress), sTrue);
+}
+
+void DocxAttributeOutput::CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasisMark )
+{
+ const char *pEmphasis;
+
+ switch ( rEmphasisMark.GetValue() )
+ {
+ case EMPHASISMARK_NONE: pEmphasis = "none"; break;
+ case EMPHASISMARK_SIDE_DOTS: pEmphasis = "dot"; break;
+ case EMPHASISMARK_CIRCLE_ABOVE: pEmphasis = "circle"; break;
+ case EMPHASISMARK_DOTS_BELOW: pEmphasis = "underDot"; break;
+ default: pEmphasis = "comma"; break;
+ }
+
+ m_pSerializer->singleElementNS( XML_w, XML_em, FSNS( XML_w, XML_val ), pEmphasis, FSEND );
+}
+
+void DocxAttributeOutput::CharTwoLines( const SvxTwoLinesItem& rTwoLines )
+{
+ if ( !rTwoLines.GetValue() )
+ return;
+
+ if (!m_pEastAsianLayoutAttrList)
+ m_pEastAsianLayoutAttrList = m_pSerializer->createAttrList();
+ OString sTrue((sal_Char *)"true");
+ m_pEastAsianLayoutAttrList->add(FSNS(XML_w, XML_combine), sTrue);
+
+ sal_Unicode cStart = rTwoLines.GetStartBracket();
+ sal_Unicode cEnd = rTwoLines.GetEndBracket();
+
+ if (!cStart && !cEnd)
+ return;
+
+ OString sBracket;
+ if ((cStart == '{') || (cEnd == '}'))
+ sBracket = (sal_Char *)"curly";
+ else if ((cStart == '<') || (cEnd == '>'))
+ sBracket = (sal_Char *)"angle";
+ else if ((cStart == '[') || (cEnd == ']'))
+ sBracket = (sal_Char *)"square";
+ else
+ sBracket = (sal_Char *)"round";
+ m_pEastAsianLayoutAttrList->add(FSNS(XML_w, XML_combineBrackets), sBracket);
+}
+
+void DocxAttributeOutput::CharScaleWidth( const SvxCharScaleWidthItem& rScaleWidth )
+{
+ m_pSerializer->singleElementNS( XML_w, XML_w,
+ FSNS( XML_w, XML_val ), rtl::OString::valueOf( sal_Int32( rScaleWidth.GetValue() ) ).getStr(), FSEND );
+}
+
+void DocxAttributeOutput::CharRelief( const SvxCharReliefItem& rRelief )
+{
+ switch ( rRelief.GetValue() )
+ {
+ case RELIEF_EMBOSSED:
+ m_pSerializer->singleElementNS( XML_w, XML_emboss, FSEND );
+ break;
+ case RELIEF_ENGRAVED:
+ m_pSerializer->singleElementNS( XML_w, XML_imprint, FSEND );
+ break;
+ default:
+ m_pSerializer->singleElementNS( XML_w, XML_emboss, FSNS( XML_w, XML_val ), "off", FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_imprint, FSNS( XML_w, XML_val ), "off", FSEND );
+ break;
+ }
+}
+
+void DocxAttributeOutput::CharHidden( const SvxCharHiddenItem& rHidden )
+{
+ if ( rHidden.GetValue() )
+ m_pSerializer->singleElementNS( XML_w, XML_vanish, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_vanish, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+void DocxAttributeOutput::TextINetFormat( const SwFmtINetFmt& rLink )
+{
+ const SwTxtINetFmt* pINetFmt = rLink.GetTxtINetFmt();
+ const SwCharFmt* pCharFmt = pINetFmt->GetCharFmt();
+
+ OString aStyleId( "style" );
+ aStyleId += OString::valueOf( sal_Int32( m_rExport.GetId( *pCharFmt ) ) );
+
+ m_pSerializer->singleElementNS( XML_w, XML_rStyle, FSNS( XML_w, XML_val ), aStyleId.getStr(), FSEND );
+}
+
+void DocxAttributeOutput::TextCharFormat( const SwFmtCharFmt& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::TextCharFormat()\n" );
+#endif
+}
+
+void DocxAttributeOutput::RefField( const SwField& rFld, const String& rRef )
+{
+ USHORT nType = rFld.GetTyp( )->Which( );
+ if ( nType == RES_GETEXPFLD )
+ {
+ String sCmd = FieldString( ww::eREF );
+ sCmd.APPEND_CONST_ASC( "\"" );
+ sCmd += rRef;
+ sCmd.APPEND_CONST_ASC( "\" " );
+
+ m_rExport.OutputField( &rFld, ww::eREF, sCmd );
+ }
+
+ // There is nothing to do here for the set fields
+}
+
+void DocxAttributeOutput::HiddenField( const SwField& /*rFld*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::HiddenField()\n" );
+#endif
+}
+
+void DocxAttributeOutput::PostitField( const SwField* /* pFld*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::PostitField()\n" );
+#endif
+}
+
+bool DocxAttributeOutput::DropdownField( const SwField* pFld )
+{
+ bool bExpand = false;
+
+ ww::eField eType = ww::eFORMDROPDOWN;
+ String sCmd = FieldString( eType );
+ GetExport( ).OutputField( pFld, eType, sCmd );
+
+ return bExpand;
+}
+
+void DocxAttributeOutput::SetField( const SwField& rFld, ww::eField eType, const String& rCmd )
+{
+ // field bookmarks are handled in the EndRun method
+ GetExport().OutputField(&rFld, eType, rCmd );
+}
+
+void DocxAttributeOutput::WriteExpand( const SwField* pFld )
+{
+ // Will be written in the next End Run
+ String sCmd;
+ m_rExport.OutputField( pFld, ww::eUNKNOWN, sCmd );
+}
+
+void DocxAttributeOutput::WriteField_Impl( const SwField* pFld, ww::eField eType, const String& rFldCmd, BYTE nMode )
+{
+ struct FieldInfos infos;
+ infos.pField = pFld;
+ infos.sCmd = rFldCmd;
+ infos.eType = eType;
+ infos.bClose = WRITEFIELD_CLOSE & nMode;
+ infos.bOpen = WRITEFIELD_START & nMode;
+
+ m_Fields.push_back( infos );
+
+ if ( pFld )
+ {
+ USHORT nType = pFld->GetTyp( )->Which( );
+ USHORT nSubType = pFld->GetSubType();
+
+ // TODO Any other field types here ?
+ if ( ( nType == RES_SETEXPFLD ) && ( nSubType & nsSwGetSetExpType::GSE_STRING ) )
+ {
+ const SwSetExpField *pSet = ( const SwSetExpField* )( pFld );
+ m_sFieldBkm = pSet->GetPar1( );
+ }
+ else if ( nType == RES_DROPDOWN )
+ {
+ const SwDropDownField* pDropDown = ( const SwDropDownField* )( pFld );
+ m_sFieldBkm = pDropDown->GetName( );
+ }
+ }
+}
+
+void DocxAttributeOutput::WriteBookmarks_Impl( std::vector< OUString >& rStarts,
+ std::vector< OUString >& rEnds )
+{
+ for ( std::vector< OUString >::const_iterator it = rStarts.begin(), end = rStarts.end(); it < end; ++it )
+ {
+ OString rName = OUStringToOString( *it, RTL_TEXTENCODING_UTF8 ).getStr( );
+ m_rMarksStart.push_back( rName );
+ }
+ rStarts.clear();
+
+ for ( std::vector< OUString >::const_iterator it = rEnds.begin(), end = rEnds.end(); it < end; ++it )
+ {
+ OString rName = OUStringToOString( *it, RTL_TEXTENCODING_UTF8 ).getStr( );
+ m_rMarksEnd.push_back( rName );
+ }
+ rEnds.clear();
+}
+
+void DocxAttributeOutput::TextFootnote_Impl( const SwFmtFtn& rFootnote )
+{
+ const SwEndNoteInfo& rInfo = rFootnote.IsEndNote()?
+ m_rExport.pDoc->GetEndNoteInfo(): m_rExport.pDoc->GetFtnInfo();
+
+ // footnote/endnote run properties
+ const SwCharFmt* pCharFmt = rInfo.GetAnchorCharFmt( *m_rExport.pDoc );
+
+ OString aStyleId( "style" );
+ aStyleId += OString::valueOf( sal_Int32( m_rExport.GetId( *pCharFmt ) ) );
+
+ m_pSerializer->singleElementNS( XML_w, XML_rStyle, FSNS( XML_w, XML_val ), aStyleId.getStr(), FSEND );
+
+ // remember the footnote/endnote to
+ // 1) write the footnoteReference/endnoteReference in EndRunProperties()
+ // 2) be able to dump them all to footnotes.xml/endnotes.xml
+ if ( !rFootnote.IsEndNote() )
+ m_pFootnotesList->add( rFootnote );
+ else
+ m_pEndnotesList->add( rFootnote );
+}
+
+void DocxAttributeOutput::FootnoteEndnoteReference()
+{
+ sal_Int32 nId;
+ const SwFmtFtn *pFootnote = m_pFootnotesList->getCurrent( nId );
+
+ // both cannot be set at the same time - if they are, it's a bug
+ if ( !pFootnote )
+ pFootnote = m_pEndnotesList->getCurrent( nId );
+
+ if ( !pFootnote )
+ return;
+
+ sal_Int32 nToken = pFootnote->IsEndNote()? XML_endnoteReference: XML_footnoteReference;
+
+ // write it
+ if ( pFootnote->GetNumStr().Len() == 0 )
+ {
+ // autonumbered
+ m_pSerializer->singleElementNS( XML_w, nToken,
+ FSNS( XML_w, XML_id ), ::rtl::OString::valueOf( nId ).getStr(),
+ FSEND );
+ }
+ else
+ {
+ // not autonumbered
+ m_pSerializer->singleElementNS( XML_w, nToken,
+ FSNS( XML_w, XML_customMarkFollows ), "1",
+ FSNS( XML_w, XML_id ), ::rtl::OString::valueOf( nId ).getStr(),
+ FSEND );
+
+ RunText( pFootnote->GetNumStr() );
+ }
+}
+
+void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
+{
+ const FootnotesVector& rVector = bFootnotes? m_pFootnotesList->getVector(): m_pEndnotesList->getVector();
+
+ sal_Int32 nBody = bFootnotes? XML_footnotes: XML_endnotes;
+ sal_Int32 nItem = bFootnotes? XML_footnote: XML_endnote;
+
+ m_pSerializer->startElementNS( XML_w, nBody,
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSEND );
+
+ sal_Int32 nIndex = 0;
+
+ // separator
+ m_pSerializer->startElementNS( XML_w, nItem,
+ FSNS( XML_w, XML_id ), OString::valueOf( nIndex++ ).getStr(),
+ FSNS( XML_w, XML_type ), "separator",
+ FSEND );
+ m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_separator, FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+ m_pSerializer->endElementNS( XML_w, XML_p );
+ m_pSerializer->endElementNS( XML_w, nItem );
+
+ // separator
+ m_pSerializer->startElementNS( XML_w, nItem,
+ FSNS( XML_w, XML_id ), OString::valueOf( nIndex++ ).getStr(),
+ FSNS( XML_w, XML_type ), "continuationSeparator",
+ FSEND );
+ m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_continuationSeparator, FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+ m_pSerializer->endElementNS( XML_w, XML_p );
+ m_pSerializer->endElementNS( XML_w, nItem );
+
+ // footnotes/endnotes themselves
+ for ( FootnotesVector::const_iterator i = rVector.begin(); i != rVector.end(); ++i, ++nIndex )
+ {
+ m_pSerializer->startElementNS( XML_w, nItem,
+ FSNS( XML_w, XML_id ), OString::valueOf( nIndex ).getStr(),
+ FSEND );
+
+ const SwNodeIndex* pIndex = (*i)->GetTxtFtn()->GetStartNode();
+
+ m_rExport.WriteSpecialText( pIndex->GetIndex() + 1,
+ pIndex->GetNode().EndOfSectionIndex(),
+ bFootnotes? TXT_FTN: TXT_EDN );
+
+ m_pSerializer->endElementNS( XML_w, nItem );
+ }
+
+ m_pSerializer->endElementNS( XML_w, nBody );
+
+}
+
+void DocxAttributeOutput::TextHardBlank( const SwFmtHardBlank& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::TextHardBlank()\n" );
+#endif
+}
+
+void DocxAttributeOutput::ParaLineSpacing_Impl( short nSpace, short /*nMulti*/ )
+{
+ if ( !m_pSpacingAttrList )
+ m_pSpacingAttrList = m_pSerializer->createAttrList();
+
+ if ( nSpace < 0 )
+ {
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_lineRule ), "exact" );
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_line ), OString::valueOf( sal_Int32( -nSpace ) ) );
+ }
+ else if ( nSpace > 0 )
+ {
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_lineRule ), "atLeast" );
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_line ), OString::valueOf( sal_Int32( nSpace ) ) );
+ }
+ else
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_lineRule ), "auto" );
+}
+
+void DocxAttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust )
+{
+ const char *pAdjustString;
+
+ switch ( rAdjust.GetAdjust() )
+ {
+ case SVX_ADJUST_LEFT:
+ pAdjustString = "left";
+ break;
+ case SVX_ADJUST_RIGHT:
+ pAdjustString = "right";
+ break;
+ case SVX_ADJUST_BLOCKLINE:
+ case SVX_ADJUST_BLOCK:
+ pAdjustString = "both";
+ break;
+ case SVX_ADJUST_CENTER:
+ pAdjustString = "center";
+ break;
+ default:
+ return; // not supported attribute
+ }
+ m_pSerializer->singleElementNS( XML_w, XML_jc, FSNS( XML_w, XML_val ), pAdjustString, FSEND );
+}
+
+void DocxAttributeOutput::ParaSplit( const SvxFmtSplitItem& rSplit )
+{
+ if (rSplit.GetValue())
+ m_pSerializer->singleElementNS( XML_w, XML_keepLines, FSNS( XML_w, XML_val ), "off", FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_keepLines, FSEND );
+}
+
+void DocxAttributeOutput::ParaWidows( const SvxWidowsItem& rWidows )
+{
+ if (rWidows.GetValue())
+ m_pSerializer->singleElementNS( XML_w, XML_widowControl, FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_w, XML_widowControl, FSNS( XML_w, XML_val ), "off", FSEND );
+}
+
+static void impl_WriteTabElement( FSHelperPtr pSerializer,
+ const SvxTabStop& rTab, long nCurrentLeft )
+{
+ FastAttributeList *pTabElementAttrList = pSerializer->createAttrList();
+
+ switch (rTab.GetAdjustment())
+ {
+ case SVX_TAB_ADJUST_RIGHT:
+ pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( (sal_Char *)"right") );
+ break;
+ case SVX_TAB_ADJUST_DECIMAL:
+ pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( (sal_Char *)"decimal") );
+ break;
+ case SVX_TAB_ADJUST_CENTER:
+ pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( (sal_Char *)"center") );
+ break;
+ case SVX_TAB_ADJUST_DEFAULT:
+ case SVX_TAB_ADJUST_LEFT:
+ default:
+ pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( (sal_Char *)"left") );
+ break;
+ }
+
+ pTabElementAttrList->add( FSNS( XML_w, XML_pos ), OString::valueOf( rTab.GetTabPos() + nCurrentLeft ) );
+
+ sal_Unicode cFillChar = rTab.GetFill();
+
+ if (sal_Unicode('.') == cFillChar )
+ pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "dot" ) );
+ else if ( sal_Unicode('-') == cFillChar )
+ pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "hyphen" ) );
+ else if ( sal_Unicode(0xB7) == cFillChar ) // middle dot
+ pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "middleDot" ) );
+ else if ( sal_Unicode('_') == cFillChar )
+ pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "underscore" ) );
+ else
+ pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "none" ) );
+
+ pSerializer->singleElementNS( XML_w, XML_tab, pTabElementAttrList );
+}
+
+void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop )
+{
+ const SfxPoolItem* pLR = m_rExport.HasItem( RES_LR_SPACE );
+ long nCurrentLeft = pLR ? ((const SvxLRSpaceItem*)pLR)->GetTxtLeft() : 0;
+
+ m_pSerializer->startElementNS( XML_w, XML_tabs, FSEND );
+
+ sal_uInt16 nCount = rTabStop.Count();
+ for (sal_uInt16 i = 0; i < nCount; i++ )
+ impl_WriteTabElement( m_pSerializer, rTabStop[i], nCurrentLeft );
+
+ m_pSerializer->endElementNS( XML_w, XML_tabs );
+}
+
+void DocxAttributeOutput::ParaHyphenZone( const SvxHyphenZoneItem& rHyphenZone )
+{
+ m_pSerializer->singleElementNS( XML_w, XML_suppressAutoHyphens,
+ FSNS( XML_w, XML_val ), rHyphenZone.IsHyphen( ) ? "false" : "true" ,
+ FSEND );
+}
+
+void DocxAttributeOutput::ParaNumRule_Impl( const SwTxtNode* /*pTxtNd*/, sal_Int32 nLvl, sal_Int32 nNumId )
+{
+ if ( USHRT_MAX != nNumId && 0 != nNumId )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_numPr, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_ilvl, FSNS( XML_w, XML_val ), OString::valueOf( sal_Int32( nLvl )).getStr(), FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_numId, FSNS( XML_w, XML_val ), OString::valueOf( sal_Int32( nNumId )).getStr(), FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_numPr );
+ }
+}
+
+void DocxAttributeOutput::ParaScriptSpace( const SfxBoolItem& rScriptSpace )
+{
+ USHORT nXmlElement = 0;
+
+ switch ( rScriptSpace.Which( ) )
+ {
+ case RES_PARATR_SCRIPTSPACE:
+ nXmlElement = XML_autoSpaceDE;
+ break;
+ case RES_PARATR_HANGINGPUNCTUATION:
+ nXmlElement = XML_overflowPunct;
+ break;
+ case RES_PARATR_FORBIDDEN_RULES:
+ nXmlElement = XML_kinsoku;
+ break;
+ }
+
+ if ( nXmlElement )
+ {
+ m_pSerializer->singleElementNS( XML_w, nXmlElement,
+ FSNS( XML_w, XML_val ), rScriptSpace.GetValue( ) ? "true": "false",
+ FSEND );
+ }
+}
+
+void DocxAttributeOutput::ParaVerticalAlign( const SvxParaVertAlignItem& rAlign )
+{
+ const char *pAlignString;
+
+ switch ( rAlign.GetValue() )
+ {
+ case SvxParaVertAlignItem::BASELINE:
+ pAlignString = "baseline";
+ break;
+ case SvxParaVertAlignItem::TOP:
+ pAlignString = "top";
+ break;
+ case SvxParaVertAlignItem::CENTER:
+ pAlignString = "center";
+ break;
+ case SvxParaVertAlignItem::BOTTOM:
+ pAlignString = "bottom";
+ break;
+ case SvxParaVertAlignItem::AUTOMATIC:
+ pAlignString = "auto";
+ break;
+ default:
+ return; // not supported attribute
+ }
+ m_pSerializer->singleElementNS( XML_w, XML_textAlignment, FSNS( XML_w, XML_val ), pAlignString, FSEND );
+}
+
+void DocxAttributeOutput::ParaSnapToGrid( const SvxParaGridItem& rGrid )
+{
+ m_pSerializer->singleElementNS( XML_w, XML_snapToGrid,
+ FSNS( XML_w, XML_val ), rGrid.GetValue( ) ? "true": "false",
+ FSEND );
+}
+
+void DocxAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize )
+{
+ if ( m_rExport.bOutFlyFrmAttrs )
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatFrameSize() - Fly frames\n" );
+ #endif
+ }
+ else if ( m_rExport.bOutPageDescs )
+ {
+ FastAttributeList *attrList = m_pSerializer->createAttrList( );
+ if ( m_rExport.pAktPageDesc->GetLandscape( ) )
+ attrList->add( FSNS( XML_w, XML_orient ), "landscape" );
+
+
+ attrList->add( FSNS( XML_w, XML_w ), OString::valueOf( rSize.GetWidth( ) ) );
+ attrList->add( FSNS( XML_w, XML_h ), OString::valueOf( rSize.GetHeight( ) ) );
+
+ XFastAttributeListRef xAttrList( attrList );
+ attrList = NULL;
+
+ m_pSerializer->singleElementNS( XML_w, XML_pgSz, xAttrList );
+ }
+}
+
+void DocxAttributeOutput::FormatPaperBin( const SvxPaperBinItem& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatPaperBin()\n" );
+#endif
+}
+
+void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
+{
+ if ( m_rExport.bOutFlyFrmAttrs )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "DocxAttributeOutput::FormatLRSpace() - Fly frames\n" );
+#endif
+ }
+ else if ( m_rExport.bOutPageDescs )
+ {
+ if ( !m_pSpacingAttrList )
+ m_pSpacingAttrList = m_pSerializer->createAttrList();
+
+
+ USHORT nLDist, nRDist;
+ const SfxPoolItem* pItem = m_rExport.HasItem( RES_BOX );
+ if ( pItem )
+ {
+ nRDist = ((SvxBoxItem*)pItem)->CalcLineSpace( BOX_LINE_LEFT );
+ nLDist = ((SvxBoxItem*)pItem)->CalcLineSpace( BOX_LINE_RIGHT );
+ }
+ else
+ nLDist = nRDist = 0;
+ nLDist = nLDist + (USHORT)rLRSpace.GetLeft();
+ nRDist = nRDist + (USHORT)rLRSpace.GetRight();
+
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_left ), OString::valueOf( sal_Int32( nLDist ) ) );
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_right ), OString::valueOf( sal_Int32( nRDist ) ) );
+ }
+ else
+ {
+ FastAttributeList *pLRSpaceAttrList = m_pSerializer->createAttrList();
+
+ pLRSpaceAttrList->add( FSNS( XML_w, XML_left ), OString::valueOf( (sal_Int32) rLRSpace.GetTxtLeft() ) );
+ pLRSpaceAttrList->add( FSNS( XML_w, XML_right ), OString::valueOf( (sal_Int32) rLRSpace.GetRight() ) );
+
+ sal_Int32 nFirstLineAdjustment = rLRSpace.GetTxtFirstLineOfst();
+ if (nFirstLineAdjustment > 0)
+ pLRSpaceAttrList->add( FSNS( XML_w, XML_firstLine ), OString::valueOf( nFirstLineAdjustment ) );
+ else
+ pLRSpaceAttrList->add( FSNS( XML_w, XML_hanging ), OString::valueOf( - nFirstLineAdjustment ) );
+ m_pSerializer->singleElementNS( XML_w, XML_ind, pLRSpaceAttrList );
+ }
+}
+
+void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
+{
+ if (!m_pSpacingAttrList)
+ m_pSpacingAttrList = m_pSerializer->createAttrList();
+
+ if ( m_rExport.bOutFlyFrmAttrs )
+ {
+ }
+ else if (m_rExport.bOutPageDescs )
+ {
+ ASSERT( m_rExport.GetCurItemSet(), "Impossible" );
+ if ( !m_rExport.GetCurItemSet() )
+ return;
+
+ HdFtDistanceGlue aDistances( *m_rExport.GetCurItemSet() );
+
+ if ( aDistances.HasHeader() )
+ {
+ // Header top
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_header ),
+ OString::valueOf( sal_Int32( aDistances.dyaHdrTop ) ) );
+ }
+
+ // Page top
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_top ),
+ OString::valueOf( sal_Int32( aDistances.dyaTop ) ) );
+
+ if ( aDistances.HasFooter() )
+ {
+ // Footer bottom
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_footer ),
+ OString::valueOf( sal_Int32( aDistances.dyaHdrBottom ) ) );
+ }
+
+ // Page Bottom
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_bottom ),
+ OString::valueOf( sal_Int32( aDistances.dyaBottom ) ) );
+
+ }
+ else
+ {
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_before ),
+ OString::valueOf( (sal_Int32)rULSpace.GetUpper() ) );
+ m_pSpacingAttrList->add( FSNS( XML_w, XML_after ),
+ OString::valueOf( (sal_Int32)rULSpace.GetLower() ) );
+ }
+}
+
+void DocxAttributeOutput::FormatSurround( const SwFmtSurround& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatSurround()\n" );
+#endif
+}
+
+void DocxAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatVertOrientation()\n" );
+#endif
+}
+
+void DocxAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatHorizOrientation()\n" );
+#endif
+}
+
+void DocxAttributeOutput::FormatAnchor( const SwFmtAnchor& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatAnchor()\n" );
+#endif
+}
+
+void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
+{
+ if ( !m_rExport.bOutPageDescs )
+ {
+ OString sColor = impl_ConvertColor( rBrush.GetColor( ) );
+ m_pSerializer->singleElementNS( XML_w, XML_shd,
+ FSNS( XML_w, XML_fill ), sColor.getStr( ),
+ FSEND );
+ }
+
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatBackground()\n" );
+#endif
+}
+
+void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
+{
+
+ if ( !m_bOpenedSectPr )
+ {
+ // Normally open the borders tag for paragraphs
+ m_pSerializer->startElementNS( XML_w, XML_pBdr, FSEND );
+ }
+
+ impl_pageBorders( m_pSerializer, rBox );
+
+ if ( m_bOpenedSectPr )
+ {
+ // Special handling for pgBorder
+ m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+ m_pSerializer->mergeTopMarks( );
+ }
+ else
+ {
+ // Normally close the borders tag for paragraphs
+ m_pSerializer->endElementNS( XML_w, XML_pBdr );
+ }
+}
+
+void DocxAttributeOutput::FormatColumns_Impl( USHORT nCols, const SwFmtCol& rCol, bool bEven, SwTwips nPageSize )
+{
+ // Get the columns attributes
+ FastAttributeList *pColsAttrList = m_pSerializer->createAttrList();
+
+ pColsAttrList->add( FSNS( XML_w, XML_num ),
+ OString::valueOf( sal_Int32( nCols ) ). getStr( ) );
+
+ const char* pEquals = "false";
+ if ( bEven )
+ {
+ USHORT nWidth = rCol.GetGutterWidth( true );
+ pColsAttrList->add( FSNS( XML_w, XML_space ),
+ OString::valueOf( sal_Int32( nWidth ) ).getStr( ) );
+
+ pEquals = "true";
+ }
+
+ pColsAttrList->add( FSNS( XML_w, XML_equalWidth ), pEquals );
+
+ bool bHasSep = COLADJ_NONE == rCol.GetLineAdj( );
+ pColsAttrList->add( FSNS( XML_w, XML_sep ), bHasSep ? "true" : "false" );
+
+ // Write the element
+ m_pSerializer->startElementNS( XML_w, XML_cols, pColsAttrList );
+
+ // Write the columns width if non-equals
+ const SwColumns & rColumns = rCol.GetColumns( );
+ if ( !bEven )
+ {
+ for ( USHORT n = 0; n < nCols; ++n )
+ {
+ FastAttributeList *pColAttrList = m_pSerializer->createAttrList();
+ USHORT nWidth = rCol.CalcPrtColWidth( n, ( USHORT ) nPageSize );
+ pColAttrList->add( FSNS( XML_w, XML_w ),
+ OString::valueOf( sal_Int32( nWidth ) ).getStr( ) );
+
+ if ( n + 1 != nCols )
+ {
+ USHORT nSpacing = rColumns[n]->GetRight( ) + rColumns[n + 1]->GetLeft( );
+ pColAttrList->add( FSNS( XML_w, XML_space ),
+ OString::valueOf( sal_Int32( nSpacing ) ).getStr( ) );
+ }
+
+ m_pSerializer->singleElementNS( XML_w, XML_col, pColAttrList );
+ }
+ }
+
+ m_pSerializer->endElementNS( XML_w, XML_cols );
+}
+
+void DocxAttributeOutput::FormatKeep( const SvxFmtKeepItem& )
+{
+ m_pSerializer->singleElementNS( XML_w, XML_keepNext, FSEND );
+}
+
+void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxAttributeOutput::FormatTextGrid()\n" );
+#endif
+}
+
+void DocxAttributeOutput::FormatLineNumbering( const SwFmtLineNumber& rNumbering )
+{
+ if ( !rNumbering.IsCount( ) )
+ m_pSerializer->singleElementNS( XML_w, XML_suppressLineNumbers, FSEND );
+}
+
+void DocxAttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDirection )
+{
+ OString sTextFlow;
+ bool bBiDi = false;
+ short nDir = rDirection.GetValue();
+
+ if ( nDir == FRMDIR_ENVIRONMENT )
+ nDir = GetExport( ).GetDefaultFrameDirection( );
+
+ switch ( nDir )
+ {
+ default:
+ case FRMDIR_HORI_LEFT_TOP:
+ sTextFlow = OString( "lrTb" );
+ break;
+ case FRMDIR_HORI_RIGHT_TOP:
+ sTextFlow = OString( "lrTb" );
+ bBiDi = true;
+ break;
+ case FRMDIR_VERT_TOP_LEFT: // many things but not this one
+ case FRMDIR_VERT_TOP_RIGHT:
+ sTextFlow = OString( "tbRl" );
+ break;
+ }
+
+ if ( m_rExport.bOutPageDescs )
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_textDirection,
+ FSNS( XML_w, XML_val ), sTextFlow.getStr( ),
+ FSEND );
+ if ( bBiDi )
+ m_pSerializer->singleElementNS( XML_w, XML_bidi, FSEND );
+ }
+ else if ( !m_rExport.bOutFlyFrmAttrs )
+ {
+ if ( bBiDi )
+ m_pSerializer->singleElementNS( XML_w, XML_bidi, FSEND );
+ }
+}
+
+DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML )
+ : m_rExport( rExport ),
+ m_pSerializer( pSerializer ),
+ m_rDrawingML( *pDrawingML ),
+ m_pFontsAttrList( NULL ),
+ m_pEastAsianLayoutAttrList( NULL ),
+ m_pCharLangAttrList( NULL ),
+ m_pSpacingAttrList( NULL ),
+ m_pHyperlinkAttrList( NULL ),
+ m_pFootnotesList( new ::docx::FootnotesList() ),
+ m_pEndnotesList( new ::docx::FootnotesList() ),
+ m_pSectionInfo( NULL ),
+ m_pRedlineData( NULL ),
+ m_nRedlineId( 0 ),
+ m_bOpenedSectPr( false ),
+ m_sFieldBkm( ),
+ m_nNextMarkId( 0 ),
+ m_pTableWrt( NULL ),
+ m_bTableCellOpen( false ),
+ m_nTableDepth( 0 ),
+ m_bParagraphOpened( false ),
+ m_nColBreakStatus( COLBRK_NONE )
+{
+}
+
+DocxAttributeOutput::~DocxAttributeOutput()
+{
+ delete m_pFontsAttrList, m_pFontsAttrList = NULL;
+ delete m_pEastAsianLayoutAttrList, m_pEastAsianLayoutAttrList = NULL;
+ delete m_pCharLangAttrList, m_pCharLangAttrList = NULL;
+ delete m_pSpacingAttrList, m_pSpacingAttrList = NULL;
+ delete m_pHyperlinkAttrList, m_pHyperlinkAttrList = NULL;
+
+ delete m_pFootnotesList, m_pFootnotesList = NULL;
+ delete m_pEndnotesList, m_pEndnotesList = NULL;
+
+ delete m_pTableWrt, m_pTableWrt = NULL;
+}
+
+MSWordExportBase& DocxAttributeOutput::GetExport()
+{
+ return m_rExport;
+}
+
+bool DocxAttributeOutput::HasFootnotes()
+{
+ return !m_pFootnotesList->isEmpty();
+}
+
+bool DocxAttributeOutput::HasEndnotes()
+{
+ return !m_pEndnotesList->isEmpty();
+}
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
new file mode 100644
index 000000000000..71b1a452f440
--- /dev/null
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -0,0 +1,616 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DOCXATTRIBUTEOUTPUT_HXX_
+#define _DOCXATTRIBUTEOUTPUT_HXX_
+
+#include "attributeoutputbase.hxx"
+#include "fields.hxx"
+
+#include <sax/fshelper.hxx>
+#include <sax/fastattribs.hxx>
+#include <vcl/vclenum.hxx>
+
+#include <fldbas.hxx>
+
+#include <vector>
+
+class DocxExport;
+
+class SwGrfNode;
+
+namespace docx { class FootnotesList; }
+namespace oox { namespace drawingml { class DrawingML; } }
+
+struct FieldInfos
+{
+ const SwField* pField;
+ ww::eField eType;
+ bool bOpen;
+ bool bClose;
+ String sCmd;
+};
+
+enum DocxColBreakStatus
+{
+ COLBRK_NONE,
+ COLBRK_POSTPONE,
+ COLBRK_WRITE
+};
+
+class DocxAttributeOutput : public AttributeOutputBase
+{
+public:
+ /// Export the state of RTL/CJK.
+ virtual void RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript );
+
+ /// Start of the paragraph.
+ virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo );
+
+ /// End of the paragraph.
+ virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner );
+
+ /// Empty paragraph.
+ virtual void EmptyParagraph();
+
+ /// Called before we start outputting the attributes.
+ virtual void StartParagraphProperties( const SwTxtNode& rNode );
+
+ /// Called after we end outputting the attributes.
+ virtual void EndParagraphProperties();
+
+ /// Start of the text run.
+ virtual void StartRun( const SwRedlineData* pRedlineData );
+
+ /// End of the text run.
+ virtual void EndRun();
+
+ /// Called before we start outputting the attributes.
+ virtual void StartRunProperties();
+
+ /// Called after we end outputting the attributes.
+ virtual void EndRunProperties( const SwRedlineData* pRedlineData );
+
+ /// Output text (inside a run).
+ virtual void RunText( const String& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 );
+
+ /// Output text (without markup).
+ virtual void RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet );
+
+ /// Output ruby start.
+ virtual void StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby );
+
+ /// Output ruby end.
+ virtual void EndRuby();
+
+ /// Output URL start.
+ virtual bool StartURL( const String& rUrl, const String& rTarget );
+
+ /// Output URL end.
+ virtual bool EndURL();
+
+ virtual void FieldVanish( const String& rTxt, ww::eField eType );
+
+ /// Output redlining.
+ ///
+ /// The common attribute that can be among the run properties.
+ virtual void Redline( const SwRedlineData* pRedline );
+
+ /// Output redlining.
+ ///
+ /// Start of the tag that encloses the run, fills the info according to
+ /// the value of m_pRedlineData.
+ void StartRedline( const SwRedlineData* pRedlineData );
+
+ /// Output redlining.
+ ///
+ /// End of the tag that encloses the run.
+ void EndRedline();
+
+ virtual void FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, USHORT nStyle, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner );
+
+ /// Output style.
+ virtual void ParagraphStyle( USHORT nStyle );
+
+ virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo );
+
+ virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner );
+
+ virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableRowEnd( sal_uInt32 nDepth = 1 );
+
+ /// Start of the styles table.
+ virtual void StartStyles();
+
+ /// End of the styles table.
+ virtual void EndStyles( USHORT nNumberOfStyles );
+
+ /// Write default style.
+ virtual void DefaultStyle( USHORT nStyle );
+
+ /// Start of a style in the styles table.
+ virtual void StartStyle( const String& rName, bool bPapFmt,
+ USHORT nBase, USHORT nNext, USHORT nWwId, USHORT nId );
+
+ /// End of a style in the styles table.
+ virtual void EndStyle();
+
+ /// Start of (paragraph or run) properties of a style.
+ virtual void StartStyleProperties( bool bParProp, USHORT nStyle );
+
+ /// End of (paragraph or run) properties of a style.
+ virtual void EndStyleProperties( bool bParProp );
+
+ /// Numbering rule and Id.
+ virtual void OutlineNumbering( BYTE nLvl, const SwNumFmt &rNFmt, const SwFmt &rFmt );
+
+ /// Page break
+ /// As a paragraph property - the paragraph should be on the next page.
+ virtual void PageBreakBefore( bool bBreak );
+
+ /// Write a section break
+ /// msword::ColumnBreak or msword::PageBreak
+ virtual void SectionBreak( BYTE nC, const WW8_SepInfo* pSectionInfo = NULL );
+
+ /// Start of the section properties.
+ virtual void StartSection();
+
+ /// End of the section properties.
+ virtual void EndSection();
+
+ /// Protection of forms.
+ virtual void SectionFormProtection( bool bProtected );
+
+ /// Numbering of the lines in the document.
+ virtual void SectionLineNumbering( ULONG nRestartNo, const SwLineNumberInfo& rLnNumInfo );
+
+ /// Has different headers/footers for the title page.
+ virtual void SectionTitlePage();
+
+ /// Description of the page borders.
+ virtual void SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* pFirstPageFmt );
+
+ /// Columns populated from right/numbers on the right side?
+ virtual void SectionBiDi( bool bBiDi );
+
+ /// The style of the page numbers.
+ ///
+ /// nPageRestartNumberr being 0 means no restart.
+ virtual void SectionPageNumbering( USHORT nNumType, USHORT nPageRestartNumber );
+
+ /// The type of breaking.
+ virtual void SectionType( BYTE nBreakCode );
+
+ /// Start the font.
+ void StartFont( const String& rFamilyName ) const;
+
+ /// End the font.
+ void EndFont() const;
+
+ /// Alternate name for the font.
+ void FontAlternateName( const String& rName ) const;
+
+ /// Font charset.
+ void FontCharset( sal_uInt8 nCharSet ) const;
+
+ /// Font family.
+ void FontFamilyType( FontFamily eFamily ) const;
+
+ /// Font pitch.
+ void FontPitchType( FontPitch ePitch ) const;
+
+ /// Definition of a numbering instance.
+ virtual void NumberingDefinition( USHORT nId, const SwNumRule &rRule );
+
+ /// Start of the abstract numbering definition instance.
+ virtual void StartAbstractNumbering( USHORT nId );
+
+ /// End of the abstract numbering definition instance.
+ virtual void EndAbstractNumbering();
+
+ /// All the numbering level information.
+ virtual void NumberingLevel( BYTE nLevel,
+ USHORT nStart,
+ USHORT nNumberingType,
+ SvxAdjust eAdjust,
+ const BYTE *pNumLvlPos,
+ BYTE nFollow,
+ const wwFont *pFont,
+ const SfxItemSet *pOutSet,
+ sal_Int16 nIndentAt,
+ sal_Int16 nFirstLineIndex,
+ sal_Int16 nListTabPos,
+ const String &rNumberingString );
+
+ void WriteField_Impl( const SwField* pFld, ww::eField eType, const String& rFldCmd, BYTE nMode );
+
+ void WriteBookmarks_Impl( std::vector< rtl::OUString >& rStarts, std::vector< rtl::OUString >& rEnds );
+
+private:
+ /// Initialize the structures where we are going to collect some of the paragraph properties.
+ ///
+ /// Some of the properties have to be collected from more sources, and are
+ /// actually not written between StartParagraphProperties and
+ /// EndParagraphProperties. They are output in this method, which is
+ /// supposed to be called just before outputting </rPr> whenever it is done.
+ void InitCollectedParagraphProperties();
+
+ /// Output what we collected during the run properties output.
+ ///
+ /// @see WriteCollectedParagrapProperties().
+ void WriteCollectedParagraphProperties();
+
+ /// Initialize the structures where we are going to collect some of the run properties.
+ ///
+ /// This is an equivalent of InitCollectedParagraphProperties(), resp.
+ /// WriteCollectectedParagraphProperties().
+ ///
+ /// @see InitCollectedParagraphProperties().
+ void InitCollectedRunProperties();
+
+ /// Output what we collected during the run properties output.
+ ///
+ /// @see InitCollectedRunProperies(), WriteCollectedParagraphProperties()
+ void WriteCollectedRunProperties();
+
+ /// Output graphic fly frames.
+ void FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize );
+
+ void InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ void StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ void StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ void StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ void TableCellProperties( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ void EndTableCell( );
+
+ void EndTableRow( );
+
+ void EndTable();
+
+ /// End cell, row, and even the entire table if necessary.
+ void FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool bForceEmptyParagraph = false );
+
+protected:
+
+ /// Output frames - the implementation.
+ virtual void OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point& rNdTopLeft );
+
+ /// Sfx item Sfx item RES_CHRATR_CASEMAP
+ virtual void CharCaseMap( const SvxCaseMapItem& rCaseMap );
+
+ /// Sfx item Sfx item RES_CHRATR_COLOR
+ virtual void CharColor( const SvxColorItem& rColor);
+
+ /// Sfx item Sfx item RES_CHRATR_CONTOUR
+ virtual void CharContour( const SvxContourItem& rContour );
+
+ /// Sfx item RES_CHRATR_CROSSEDOUT
+ virtual void CharCrossedOut( const SvxCrossedOutItem& rCrossedOut );
+
+ /// Sfx item RES_CHRATR_ESCAPEMENT
+ virtual void CharEscapement( const SvxEscapementItem& rEscapement );
+
+ /// Sfx item RES_CHRATR_FONT
+ virtual void CharFont( const SvxFontItem& rFont );
+
+ /// Sfx item RES_CHRATR_FONTSIZE
+ virtual void CharFontSize( const SvxFontHeightItem& rFontSize );
+
+ /// Sfx item RES_CHRATR_KERNING
+ virtual void CharKerning( const SvxKerningItem& rKerning );
+
+ /// Sfx item RES_CHRATR_LANGUAGE
+ virtual void CharLanguage( const SvxLanguageItem& rLanguage );
+
+ /// Sfx item RES_CHRATR_POSTURE
+ virtual void CharPosture( const SvxPostureItem& rPosture );
+
+ /// Sfx item RES_CHRATR_SHADOWED
+ virtual void CharShadow( const SvxShadowedItem& rShadow );
+
+ /// Sfx item RES_CHRATR_UNDERLINE
+ virtual void CharUnderline( const SvxUnderlineItem& rUnderline );
+
+ /// Sfx item RES_CHRATR_WEIGHT
+ virtual void CharWeight( const SvxWeightItem& rWeight );
+
+ /// Sfx item RES_CHRATR_AUTOKERN
+ virtual void CharAutoKern( const SvxAutoKernItem& );
+
+ /// Sfx item RES_CHRATR_BLINK
+ virtual void CharAnimatedText( const SvxBlinkItem& rBlink );
+
+ /// Sfx item RES_CHRATR_BACKGROUND
+ virtual void CharBackground( const SvxBrushItem& rBrush );
+
+ /// Sfx item RES_CHRATR_CJK_FONT
+ virtual void CharFontCJK( const SvxFontItem& rFont );
+
+ /// Sfx item RES_CHRATR_CJK_FONTSIZE
+ virtual void CharFontSizeCJK( const SvxFontHeightItem& rFontSize ) { CharFontSize( rFontSize ); }
+
+ /// Sfx item RES_CHRATR_CJK_LANGUAGE
+ virtual void CharLanguageCJK( const SvxLanguageItem& rLanguageItem ) { CharLanguage( rLanguageItem ); }
+
+ /// Sfx item RES_CHRATR_CJK_POSTURE
+ virtual void CharPostureCJK( const SvxPostureItem& rPosture );
+
+ /// Sfx item RES_CHRATR_CJK_WEIGHT
+ virtual void CharWeightCJK( const SvxWeightItem& rWeight );
+
+ /// Sfx item RES_CHRATR_CTL_FONT
+ virtual void CharFontCTL( const SvxFontItem& rFont );
+
+ /// Sfx item RES_CHRATR_CTL_FONTSIZE
+ virtual void CharFontSizeCTL( const SvxFontHeightItem& rFontSize ) { CharFontSize( rFontSize ); }
+
+ /// Sfx item RES_CHRATR_CTL_LANGUAGE
+ virtual void CharLanguageCTL( const SvxLanguageItem& rLanguageItem ) { CharLanguage( rLanguageItem); }
+
+ /// Sfx item RES_CHRATR_CTL_POSTURE
+ virtual void CharPostureCTL( const SvxPostureItem& rWeight );
+
+ /// Sfx item RES_CHRATR_CTL_WEIGHT
+ virtual void CharWeightCTL( const SvxWeightItem& rWeight );
+
+ /// Sfx item RES_CHRATR_ROTATE
+ virtual void CharRotate( const SvxCharRotateItem& rRotate );
+
+ /// Sfx item RES_CHRATR_EMPHASIS_MARK
+ virtual void CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasisMark );
+
+ /// Sfx item RES_CHRATR_TWO_LINES
+ virtual void CharTwoLines( const SvxTwoLinesItem& rTwoLines );
+
+ /// Sfx item RES_CHRATR_SCALEW
+ virtual void CharScaleWidth( const SvxCharScaleWidthItem& rScaleWidth );
+
+ /// Sfx item RES_CHRATR_RELIEF
+ virtual void CharRelief( const SvxCharReliefItem& rRelief);
+
+ /// Sfx item RES_CHRATR_HIDDEN
+ virtual void CharHidden( const SvxCharHiddenItem& rHidden );
+
+ /// Sfx item RES_TXTATR_INETFMT
+ virtual void TextINetFormat( const SwFmtINetFmt& );
+
+ /// Sfx item RES_TXTATR_CHARFMT
+ virtual void TextCharFormat( const SwFmtCharFmt& );
+
+ /// Sfx item RES_TXTATR_FTN
+ virtual void TextFootnote_Impl( const SwFmtFtn& );
+
+ /// Output the footnote/endnote reference (if there's one to output).
+ void FootnoteEndnoteReference();
+
+ /// Sfx item RES_TXTATR_HARDBLANK
+ virtual void TextHardBlank( const SwFmtHardBlank& );
+
+ /// Sfx item RES_PARATR_LINESPACING
+ virtual void ParaLineSpacing_Impl( short nSpace, short nMulti );
+
+ /// Sfx item RES_PARATR_ADJUST
+ virtual void ParaAdjust( const SvxAdjustItem& rAdjust );
+
+ /// Sfx item RES_PARATR_SPLIT
+ virtual void ParaSplit( const SvxFmtSplitItem& rSplit );
+
+ /// Sfx item RES_PARATR_WIDOWS
+ virtual void ParaWidows( const SvxWidowsItem& rWidows );
+
+ /// Sfx item RES_PARATR_TABSTOP
+ virtual void ParaTabStop( const SvxTabStopItem& rTabStop );
+
+ /// Sfx item RES_PARATR_HYPHENZONE
+ virtual void ParaHyphenZone( const SvxHyphenZoneItem& );
+
+ /// Sfx item RES_PARATR_NUMRULE
+ virtual void ParaNumRule_Impl( const SwTxtNode *pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId );
+
+ /// Sfx item RES_PARATR_SCRIPTSPACE
+ virtual void ParaScriptSpace( const SfxBoolItem& );
+
+ /// Sfx item RES_PARATR_VERTALIGN
+ virtual void ParaVerticalAlign( const SvxParaVertAlignItem& rAlign );
+
+ /// Sfx item RES_PARATR_SNAPTOGRID
+ virtual void ParaSnapToGrid( const SvxParaGridItem& );
+
+ /// Sfx item RES_FRM_SIZE
+ virtual void FormatFrameSize( const SwFmtFrmSize& );
+
+ /// Sfx item RES_PAPER_BIN
+ virtual void FormatPaperBin( const SvxPaperBinItem& );
+
+ /// Sfx item RES_LR_SPACE
+ virtual void FormatLRSpace( const SvxLRSpaceItem& rLRSpace );
+
+ /// Sfx item RES_UL_SPACE
+ virtual void FormatULSpace( const SvxULSpaceItem& rULSpace );
+
+ /// Sfx item RES_SURROUND
+ virtual void FormatSurround( const SwFmtSurround& );
+
+ /// Sfx item RES_VERT_ORIENT
+ virtual void FormatVertOrientation( const SwFmtVertOrient& );
+
+ /// Sfx item RES_HORI_ORIENT
+ virtual void FormatHorizOrientation( const SwFmtHoriOrient& );
+
+ /// Sfx item RES_ANCHOR
+ virtual void FormatAnchor( const SwFmtAnchor& );
+
+ /// Sfx item RES_BACKGROUND
+ virtual void FormatBackground( const SvxBrushItem& );
+
+ /// Sfx item RES_BOX
+ virtual void FormatBox( const SvxBoxItem& );
+
+ /// Sfx item RES_COL
+ virtual void FormatColumns_Impl( USHORT nCols, const SwFmtCol & rCol, bool bEven, SwTwips nPageSize );
+
+ /// Sfx item RES_KEEP
+ virtual void FormatKeep( const SvxFmtKeepItem& );
+
+ /// Sfx item RES_TEXTGRID
+ virtual void FormatTextGrid( const SwTextGridItem& );
+
+ /// Sfx item RES_LINENUMBER
+ virtual void FormatLineNumbering( const SwFmtLineNumber& );
+
+ /// Sfx item RES_FRAMEDIR
+ virtual void FormatFrameDirection( const SvxFrameDirectionItem& );
+
+ /// Write the expanded field
+ virtual void WriteExpand( const SwField* pFld );
+
+ virtual void RefField( const SwField& rFld, const String& rRef );
+ virtual void HiddenField( const SwField& rFld );
+ virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd );
+ virtual void PostitField( const SwField* pFld );
+ virtual bool DropdownField( const SwField* pFld );
+
+ virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark );
+
+ /// Reference to the export, where to get the data from
+ DocxExport &m_rExport;
+
+ /// Fast serializer to output the data
+ ::sax_fastparser::FSHelperPtr m_pSerializer;
+
+ /// DrawingML access
+ oox::drawingml::DrawingML &m_rDrawingML;
+
+private:
+
+ void DoWriteBookmarks( );
+
+ void StartField_Impl( FieldInfos& rInfos, sal_Bool bWriteRun = sal_False );
+ void DoWriteCmd( String& rCmd );
+ void CmdField_Impl( FieldInfos& rInfos );
+ void EndField_Impl( FieldInfos& rInfos );
+
+ ::sax_fastparser::FastAttributeList *m_pFontsAttrList, *m_pEastAsianLayoutAttrList;
+ ::sax_fastparser::FastAttributeList *m_pCharLangAttrList;
+ ::sax_fastparser::FastAttributeList *m_pSpacingAttrList;
+ ::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList;
+
+ ::docx::FootnotesList *m_pFootnotesList;
+ ::docx::FootnotesList *m_pEndnotesList;
+
+ const WW8_SepInfo *m_pSectionInfo;
+
+ /// Redline data to remember in the text run.
+ const SwRedlineData *m_pRedlineData;
+
+ /// Id of the redline
+ sal_Int32 m_nRedlineId;
+
+ /// Flag indicating that the section properties are being written
+ sal_Bool m_bOpenedSectPr;
+
+ /// Field data to remember in the text run
+ std::vector< FieldInfos > m_Fields;
+ String m_sFieldBkm;
+ sal_Int32 m_nNextMarkId;
+
+ /// Bookmarks to output
+ std::vector<rtl::OString> m_rMarksStart;
+ std::vector<rtl::OString> m_rMarksEnd;
+
+ /// Maps of the bookmarks ids
+ std::map<rtl::OString, USHORT> m_rOpenedMarksIds;
+
+ /// The current table helper
+ SwWriteTable *m_pTableWrt;
+
+ /// Remember if we are in an open cell, or not.
+ bool m_bTableCellOpen;
+
+ /// Remember the current table depth.
+ sal_uInt32 m_nTableDepth;
+
+ bool m_bParagraphOpened;
+
+ // Remember that a column break has to be opened at the
+ // beginning of the next paragraph
+ DocxColBreakStatus m_nColBreakStatus;
+
+public:
+ DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML );
+
+ virtual ~DocxAttributeOutput();
+
+ /// Return the right export class.
+ virtual MSWordExportBase& GetExport();
+
+ /// For eg. the output of the styles, we need to switch the serializer to enother one.
+ void SetSerializer( ::sax_fastparser::FSHelperPtr pSerializer ) { m_pSerializer = pSerializer; }
+
+ /// Occasionnaly need to use this serializer from the outside
+ ::sax_fastparser::FSHelperPtr GetSerializer( ) { return m_pSerializer; }
+
+ /// Do we have any footnotes?
+ bool HasFootnotes();
+
+ /// Do we have any endnotes?
+ bool HasEndnotes();
+
+ /// Output the content of the footnotes.xml resp. endnotes.xml
+ void FootnotesEndnotes( bool bFootnotes );
+};
+
+#endif // _DOCXATTRIBUTEOUTPUT_HXX_
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
new file mode 100644
index 000000000000..6ad8d6fb6306
--- /dev/null
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -0,0 +1,812 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "docxexport.hxx"
+#include "docxexportfilter.hxx"
+
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/i18n/ScriptType.hdl>
+
+#include <oox/core/tokens.hxx>
+#include <oox/export/drawingml.hxx>
+#include <oox/export/vmlexport.hxx>
+
+#include <map>
+#include <algorithm>
+
+#include <IMark.hxx>
+#include <docsh.hxx>
+#include <ndtxt.hxx>
+#include <wrtww8.hxx>
+#include <fltini.hxx>
+#include <fmtline.hxx>
+#include <fmtpdsc.hxx>
+#include <frmfmt.hxx>
+#include <section.hxx>
+
+#include <docary.hxx>
+#include <numrule.hxx>
+#include <charfmt.hxx>
+
+#include "ww8par.hxx"
+#include "ww8scan.hxx"
+
+#include <comphelper/string.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <vcl/font.hxx>
+
+using namespace ::comphelper;
+using namespace ::com::sun::star;
+
+using oox::vml::VMLExport;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+
+using sw::mark::IMark;
+
+#define S( x ) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
+
+AttributeOutputBase& DocxExport::AttrOutput() const
+{
+ return *m_pAttrOutput;
+}
+
+MSWordSections& DocxExport::Sections() const
+{
+ return *m_pSections;
+}
+
+bool DocxExport::CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich )
+{
+ // TODO FIXME is this actually true for docx? - this is ~copied from WW8
+ if ( nScript == i18n::ScriptType::ASIAN )
+ {
+ // for asian in ww8, there is only one fontsize
+ // and one fontstyle (posture/weight)
+ switch ( nWhich )
+ {
+ case RES_CHRATR_FONTSIZE:
+ case RES_CHRATR_POSTURE:
+ case RES_CHRATR_WEIGHT:
+ return false;
+ default:
+ break;
+ }
+ }
+ else if ( nScript != i18n::ScriptType::COMPLEX )
+ {
+ // for western in ww8, there is only one fontsize
+ // and one fontstyle (posture/weight)
+ switch ( nWhich )
+ {
+ case RES_CHRATR_CJK_FONTSIZE:
+ case RES_CHRATR_CJK_POSTURE:
+ case RES_CHRATR_CJK_WEIGHT:
+ return false;
+ default:
+ break;
+ }
+ }
+ return true;
+}
+
+bool DocxExport::GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt,
+ xub_StrLen nEnd, IMarkVector& rArr )
+{
+ IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ ULONG nNd = rNd.GetIndex( );
+
+ const sal_Int32 nMarks = pMarkAccess->getMarksCount();
+ for ( sal_Int32 i = 0; i < nMarks; i++ )
+ {
+ IMark* pMark = ( pMarkAccess->getMarksBegin() + i )->get();
+
+ // Only keep the bookmarks starting or ending in this node
+ if ( pMark->GetMarkStart().nNode == nNd ||
+ pMark->GetMarkEnd().nNode == nNd )
+ {
+ xub_StrLen nBStart = pMark->GetMarkStart().nContent.GetIndex();
+ xub_StrLen nBEnd = pMark->GetMarkEnd().nContent.GetIndex();
+
+ // Keep only the bookmars starting or ending in the snippet
+ bool bIsStartOk = ( nBStart >= nStt ) && ( nBStart <= nEnd );
+ bool bIsEndOk = ( nBEnd >= nStt ) && ( nBEnd <= nEnd );
+
+ if ( bIsStartOk || bIsEndOk )
+ rArr.push_back( pMark );
+ }
+ }
+ return ( rArr.size() > 0 );
+}
+
+class CompareMarksEnd : public std::binary_function < const IMark *, const IMark *, bool >
+{
+public:
+ inline bool operator() ( const IMark * pOneB, const IMark * pTwoB ) const
+ {
+ xub_StrLen nOEnd = pOneB->GetMarkEnd().nContent.GetIndex();
+ xub_StrLen nTEnd = pTwoB->GetMarkEnd().nContent.GetIndex();
+
+ return nOEnd < nTEnd;
+ }
+};
+
+bool DocxExport::NearestBookmark( xub_StrLen& rNearest )
+{
+ bool bHasBookmark = false;
+
+ if ( m_rSortedMarksStart.size( ) > 0 )
+ {
+ IMark* pMarkStart = m_rSortedMarksStart.front();
+ rNearest = pMarkStart->GetMarkStart().nContent.GetIndex();
+ bHasBookmark = true;
+ }
+
+ if ( m_rSortedMarksEnd.size( ) > 0 )
+ {
+ IMark* pMarkEnd = m_rSortedMarksEnd[0];
+ if ( !bHasBookmark )
+ rNearest = pMarkEnd->GetMarkEnd().nContent.GetIndex();
+ else
+ rNearest = std::min( rNearest, pMarkEnd->GetMarkEnd().nContent.GetIndex() );
+ bHasBookmark = true;
+ }
+
+ return bHasBookmark;
+}
+
+xub_StrLen DocxExport::GetNextPos( SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos )
+{
+ // Get the bookmarks for the normal run
+ xub_StrLen nNextPos = MSWordExportBase::GetNextPos( pAttrIter, rNode, nAktPos );
+
+ GetSortedBookmarks( rNode, nAktPos, nNextPos - nAktPos );
+
+ xub_StrLen nNextBookmark = nNextPos;
+ NearestBookmark( nNextPos );
+
+ return std::min( nNextPos, nNextBookmark );
+}
+
+void DocxExport::UpdatePosition( SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd )
+{
+ xub_StrLen nNextPos;
+
+ // either no bookmark, or it is not at the current position
+ if ( !NearestBookmark( nNextPos ) || nNextPos > nAktPos )
+ {
+ MSWordExportBase::UpdatePosition( pAttrIter, nAktPos, nEnd );
+ }
+}
+
+void DocxExport::GetSortedBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen )
+{
+ IMarkVector aMarksStart;
+ if ( GetBookmarks( rNode, nAktPos, nAktPos + nLen, aMarksStart ) )
+ {
+ IMarkVector aSortedEnd;
+ IMarkVector aSortedStart;
+ for ( IMarkVector::const_iterator it = aMarksStart.begin(), end = aMarksStart.end();
+ it < end; ++it )
+ {
+ IMark* pMark = (*it);
+
+ // Remove the positions egals to the current pos
+ xub_StrLen nStart = pMark->GetMarkStart().nContent.GetIndex();
+ xub_StrLen nEnd = pMark->GetMarkEnd().nContent.GetIndex();
+
+ if ( nStart > nAktPos )
+ aSortedStart.push_back( pMark );
+
+ if ( nEnd > nAktPos )
+ aSortedEnd.push_back( pMark );
+ }
+
+ // Sort the bookmarks by end position
+ std::sort( aSortedEnd.begin(), aSortedEnd.end(), CompareMarksEnd() );
+
+ m_rSortedMarksStart.swap( aSortedStart );
+ m_rSortedMarksEnd.swap( aSortedEnd );
+ }
+ else
+ {
+ m_rSortedMarksStart.clear( );
+ m_rSortedMarksEnd.clear( );
+ }
+}
+
+void DocxExport::AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen )
+{
+ std::vector< OUString > aStarts;
+ std::vector< OUString > aEnds;
+
+ IMarkVector aMarks;
+ if ( GetBookmarks( rNode, nAktPos, nAktPos + nLen, aMarks ) )
+ {
+ for ( IMarkVector::const_iterator it = aMarks.begin(), end = aMarks.end();
+ it < end; ++it )
+ {
+ IMark* pMark = (*it);
+
+ xub_StrLen nStart = pMark->GetMarkStart().nContent.GetIndex();
+ xub_StrLen nEnd = pMark->GetMarkEnd().nContent.GetIndex();
+
+ if ( nStart == nAktPos )
+ aStarts.push_back( pMark->GetName() );
+
+ if ( nEnd == nAktPos )
+ aEnds.push_back( pMark->GetName() );
+ }
+ }
+
+ m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds );
+}
+
+void DocxExport::AppendBookmark( const OUString& rName, bool /*bSkip*/ )
+{
+ std::vector< OUString > aStarts;
+ std::vector< OUString > aEnds;
+
+ aStarts.push_back( rName );
+ aEnds.push_back( rName );
+
+ m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds );
+}
+
+::rtl::OString DocxExport::AddRelation( const OUString& rType, const OUString& rTarget, const OUString& rMode )
+{
+ OUString sId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ rType, rTarget, rMode );
+
+ return ::rtl::OUStringToOString( sId, RTL_TEXTENCODING_UTF8 );
+}
+
+bool DocxExport::DisallowInheritingOutlineNumbering( const SwFmt& rFmt )
+{
+ bool bRet( false );
+
+ if (SFX_ITEM_SET != rFmt.GetItemState(RES_PARATR_NUMRULE, false))
+ {
+ if (const SwFmt *pParent = rFmt.DerivedFrom())
+ {
+ if (((const SwTxtFmtColl*)pParent)->IsAssignedToListLevelOfOutlineStyle())
+ {
+ ::sax_fastparser::FSHelperPtr pSerializer = m_pAttrOutput->GetSerializer( );
+ // Level 9 disables the outline
+ pSerializer->singleElementNS( XML_w, XML_outlineLvl,
+ FSNS( XML_w, XML_val ), "9" ,
+ FSEND );
+
+ bRet = true;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+void DocxExport::WriteHeadersFooters( BYTE nHeadFootFlags,
+ const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt )
+{
+ // headers
+ if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_EVEN )
+ WriteHeaderFooter( rLeftFmt, true, "even" );
+
+ if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_ODD )
+ WriteHeaderFooter( rFmt, true, "default" );
+
+ if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_FIRST )
+ WriteHeaderFooter( rFirstPageFmt, true, "first" );
+
+ // footers
+ if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_EVEN )
+ WriteHeaderFooter( rLeftFmt, false, "even" );
+
+ if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_ODD )
+ WriteHeaderFooter( rFmt, false, "default" );
+
+ if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_FIRST )
+ WriteHeaderFooter( rFirstPageFmt, false, "first" );
+}
+
+void DocxExport::OutputField( const SwField* pFld, ww::eField eFldType, const String& rFldCmd, BYTE nMode )
+{
+ m_pAttrOutput->WriteField_Impl( pFld, eFldType, rFldCmd, nMode );
+}
+
+void DocxExport::WriteFormData( const ::sw::mark::IFieldmark& /*rFieldmark*/ )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxExport::WriteFormData()\n" );
+#endif
+}
+
+void DocxExport::DoComboBox(const rtl::OUString& rName,
+ const rtl::OUString& rHelp,
+ const rtl::OUString& rToolTip,
+ const rtl::OUString& rSelected,
+ uno::Sequence<rtl::OUString>& rListItems)
+{
+ m_pDocumentFS->startElementNS( XML_w, XML_ffData, FSEND );
+
+ m_pDocumentFS->singleElementNS( XML_w, XML_name,
+ FSNS( XML_w, XML_val ), OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+
+ m_pDocumentFS->singleElementNS( XML_w, XML_enabled, FSEND );
+
+ if ( rHelp.getLength( ) > 0 )
+ m_pDocumentFS->singleElementNS( XML_w, XML_helpText,
+ FSNS( XML_w, XML_val ), OUStringToOString( rHelp, RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+
+ if ( rToolTip.getLength( ) > 0 )
+ m_pDocumentFS->singleElementNS( XML_w, XML_statusText,
+ FSNS( XML_w, XML_val ), OUStringToOString( rToolTip, RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+
+ m_pDocumentFS->startElementNS( XML_w, XML_ddList, FSEND );
+
+ // Output the 0-based index of the selected value
+ sal_uInt32 nListItems = rListItems.getLength();
+ sal_Int32 nId = 0;
+ sal_uInt32 nI = 0;
+ while ( ( nI < nListItems ) && ( nId == 0 ) )
+ {
+ if ( rListItems[nI] == rSelected )
+ nId = nI;
+ nI++;
+ }
+
+ m_pDocumentFS->singleElementNS( XML_w, XML_result,
+ FSNS( XML_w, XML_val ), rtl::OString::valueOf( nId ).getStr( ),
+ FSEND );
+
+ // Loop over the entries
+
+ for (sal_uInt32 i = 0; i < nListItems; i++)
+ {
+ m_pDocumentFS->singleElementNS( XML_w, XML_listEntry,
+ FSNS( XML_w, XML_val ), OUStringToOString( rListItems[i], RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+ }
+
+ m_pDocumentFS->endElementNS( XML_w, XML_ddList );
+
+ m_pDocumentFS->endElementNS( XML_w, XML_ffData );
+}
+
+void DocxExport::DoFormText(const SwInputField* /*pFld*/)
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxExport::ForFormText()\n" );
+#endif
+}
+
+void DocxExport::ExportDocument_Impl()
+{
+ InitStyles();
+
+ // init sections
+ m_pSections = new MSWordSections( *this );
+
+ WriteMainText();
+
+ WriteFootnotesEndnotes();
+
+ WriteNumbering();
+
+ WriteFonts();
+
+ delete pStyles, pStyles = NULL;
+ delete m_pSections, m_pSections = NULL;
+}
+
+void DocxExport::OutputPageSectionBreaks( const SwTxtNode& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxExport::OutputPageSectionBreaks( const SwTxtNode& )\n" );
+#endif
+}
+
+
+void DocxExport::AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, ULONG nLnNum )
+{
+ AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() );
+ m_pSections->AppendSep( pPageDesc, pFmt, nLnNum );
+}
+
+void DocxExport::OutputEndNode( const SwEndNode& rEndNode )
+{
+ MSWordExportBase::OutputEndNode( rEndNode );
+
+ if ( TXT_MAINTEXT == nTxtTyp && rEndNode.StartOfSectionNode()->IsSectionNode() )
+ {
+ // this originally comes from WW8Export::WriteText(), and looks like it
+ // could have some code common with SectionNode()...
+
+ const SwSection& rSect = rEndNode.StartOfSectionNode()->GetSectionNode()->GetSection();
+ if ( bStartTOX && TOX_CONTENT_SECTION == rSect.GetType() )
+ bStartTOX = false;
+
+ SwNodeIndex aIdx( rEndNode, 1 );
+ const SwNode& rNd = aIdx.GetNode();
+ if ( rNd.IsEndNode() && rNd.StartOfSectionNode()->IsSectionNode() )
+ return;
+
+ if ( !rNd.IsSectionNode() && !bIsInTable ) // No sections in table
+ {
+ const SwSectionFmt* pParentFmt = rSect.GetFmt()->GetParent();
+ if( !pParentFmt )
+ pParentFmt = (SwSectionFmt*)0xFFFFFFFF;
+
+ ULONG nRstLnNum;
+ if( rNd.IsCntntNode() )
+ nRstLnNum = const_cast< SwCntntNode* >( rNd.GetCntntNode() )->GetSwAttrSet().GetLineNumber().GetStartValue();
+ else
+ nRstLnNum = 0;
+
+ AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo( ) );
+ m_pSections->AppendSep( pAktPageDesc, pParentFmt, nRstLnNum );
+ }
+ }
+}
+
+void DocxExport::OutputTableNode( const SwTableNode& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxExport::OutputTableNode( const SwTableNode& )\n" );
+#endif
+}
+
+void DocxExport::OutputGrfNode( const SwGrfNode& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxExport::OutputGrfNode( const SwGrfNode& )\n" );
+#endif
+}
+
+void DocxExport::OutputOLENode( const SwOLENode& )
+{
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO DocxExport::OutputOLENode( const SwOLENode& )\n" );
+#endif
+}
+
+ULONG DocxExport::ReplaceCr( BYTE )
+{
+ // Completely unused for Docx export... only here for code sharing
+ // purpose with binary export
+ return 0;
+}
+
+void DocxExport::PrepareNewPageDesc( const SfxItemSet* pSet,
+ const SwNode& rNd, const SwFmtPageDesc* pNewPgDescFmt,
+ const SwPageDesc* pNewPgDesc )
+{
+ // tell the attribute output that we are ready to write the section
+ // break [has to be output inside paragraph properties]
+ AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() );
+
+ const SwSectionFmt* pFmt = GetSectionFormat( rNd );
+ const ULONG nLnNm = GetSectionLineNo( pSet, rNd );
+
+ ASSERT( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." );
+
+ if ( pNewPgDescFmt )
+ {
+ m_pSections->AppendSep( *pNewPgDescFmt, rNd, pFmt, nLnNm );
+ }
+ else if ( pNewPgDesc )
+ {
+ m_pSections->AppendSep( pNewPgDesc, rNd, pFmt, nLnNm );
+ }
+
+}
+
+void DocxExport::InitStyles()
+{
+ pStyles = new MSWordStyles( *this );
+
+ // setup word/styles.xml and the relations + content type
+ m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" ),
+ S( "styles.xml" ) );
+
+ ::sax_fastparser::FSHelperPtr pStylesFS =
+ m_pFilter->openOutputStreamWithSerializer( S( "word/styles.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" ) );
+
+ // switch the serializer to redirect the output to word/styles.xml
+ m_pAttrOutput->SetSerializer( pStylesFS );
+
+ // do the work
+ pStyles->OutputStylesTable();
+
+ // switch the serializer back
+ m_pAttrOutput->SetSerializer( m_pDocumentFS );
+}
+
+void DocxExport::WriteFootnotesEndnotes()
+{
+ if ( m_pAttrOutput->HasFootnotes() )
+ {
+ // setup word/styles.xml and the relations + content type
+ m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" ),
+ S( "footnotes.xml" ) );
+
+ ::sax_fastparser::FSHelperPtr pFootnotesFS =
+ m_pFilter->openOutputStreamWithSerializer( S( "word/footnotes.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" ) );
+
+ // switch the serializer to redirect the output to word/footnotes.xml
+ m_pAttrOutput->SetSerializer( pFootnotesFS );
+
+ // do the work
+ m_pAttrOutput->FootnotesEndnotes( true );
+
+ // switch the serializer back
+ m_pAttrOutput->SetSerializer( m_pDocumentFS );
+ }
+
+ if ( m_pAttrOutput->HasEndnotes() )
+ {
+ // setup word/styles.xml and the relations + content type
+ m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" ),
+ S( "endnotes.xml" ) );
+
+ ::sax_fastparser::FSHelperPtr pEndnotesFS =
+ m_pFilter->openOutputStreamWithSerializer( S( "word/endnotes.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" ) );
+
+ // switch the serializer to redirect the output to word/endnotes.xml
+ m_pAttrOutput->SetSerializer( pEndnotesFS );
+
+ // do the work
+ m_pAttrOutput->FootnotesEndnotes( false );
+
+ // switch the serializer back
+ m_pAttrOutput->SetSerializer( m_pDocumentFS );
+ }
+}
+
+void DocxExport::WriteNumbering()
+{
+ if ( !pUsedNumTbl )
+ return; // no numbering is used
+
+ m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" ),
+ S( "numbering.xml" ) );
+
+ ::sax_fastparser::FSHelperPtr pNumberingFS = m_pFilter->openOutputStreamWithSerializer( S( "word/numbering.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" ) );
+
+ // switch the serializer to redirect the output to word/nubering.xml
+ m_pAttrOutput->SetSerializer( pNumberingFS );
+
+ pNumberingFS->startElementNS( XML_w, XML_numbering,
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSEND );
+
+ AbstractNumberingDefinitions();
+
+ NumberingDefinitions();
+
+ pNumberingFS->endElementNS( XML_w, XML_numbering );
+
+ // switch the serializer back
+ m_pAttrOutput->SetSerializer( m_pDocumentFS );
+}
+
+void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pType )
+{
+ // setup the xml stream
+ OUString aRelId;
+ ::sax_fastparser::FSHelperPtr pFS;
+ if ( bHeader )
+ {
+ OUString aName( OUStringBuffer().appendAscii( "header" ).append( ++m_nHeaders ).appendAscii( ".xml" ).makeStringAndClear() );
+
+ aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" ),
+ aName );
+
+ pFS = m_pFilter->openOutputStreamWithSerializer( OUStringBuffer().appendAscii( "word/" ).append( aName ).makeStringAndClear(),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ) );
+
+ pFS->startElementNS( XML_w, XML_hdr,
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSEND );
+ }
+ else
+ {
+ OUString aName( OUStringBuffer().appendAscii( "footer" ).append( ++m_nFooters ).appendAscii( ".xml" ).makeStringAndClear() );
+
+ aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" ),
+ aName );
+
+ pFS = m_pFilter->openOutputStreamWithSerializer( OUStringBuffer().appendAscii( "word/" ).append( aName ).makeStringAndClear(),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ) );
+
+ pFS->startElementNS( XML_w, XML_ftr,
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSEND );
+ }
+
+ // switch the serializer to redirect the output to word/styles.xml
+ m_pAttrOutput->SetSerializer( pFS );
+
+ // do the work
+ WriteHeaderFooterText( rFmt, bHeader );
+
+ // switch the serializer back
+ m_pAttrOutput->SetSerializer( m_pDocumentFS );
+
+ // close the tag
+ sal_Int32 nReference;
+ if ( bHeader )
+ {
+ pFS->endElementNS( XML_w, XML_hdr );
+ nReference = XML_headerReference;
+ }
+ else
+ {
+ pFS->endElementNS( XML_w, XML_ftr );
+ nReference = XML_footerReference;
+ }
+
+ // and write the reference
+ m_pDocumentFS->singleElementNS( XML_w, nReference,
+ FSNS( XML_w, XML_type ), pType,
+ FSNS( XML_r, XML_id ), rtl::OUStringToOString( aRelId, RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+}
+
+void DocxExport::WriteFonts()
+{
+ m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" ),
+ S( "fontTable.xml" ) );
+
+ ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openOutputStreamWithSerializer(
+ S( "word/fontTable.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" ) );
+
+ pFS->startElementNS( XML_w, XML_fonts,
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSEND );
+
+ // switch the serializer to redirect the output to word/styles.xml
+ m_pAttrOutput->SetSerializer( pFS );
+
+ // do the work
+ maFontHelper.WriteFontTable( *m_pAttrOutput );
+
+ // switch the serializer back
+ m_pAttrOutput->SetSerializer( m_pDocumentFS );
+
+ pFS->endElementNS( XML_w, XML_fonts );
+}
+
+
+void DocxExport::WriteProperties( )
+{
+ // Write the core properties
+ SwDocShell* pDocShell( pDoc->GetDocShell( ) );
+ uno::Reference<document::XDocumentProperties> xDocProps;
+ if ( pDocShell )
+ {
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDocShell->GetModel( ), uno::UNO_QUERY );
+ xDocProps = xDPS->getDocumentProperties();
+ }
+
+ m_pFilter->exportDocumentProperties( xDocProps );
+}
+
+VMLExport& DocxExport::VMLExporter()
+{
+ return *m_pVMLExport;
+}
+
+void DocxExport::WriteMainText()
+{
+ // setup the namespaces
+ m_pDocumentFS->startElementNS( XML_w, XML_document,
+ FSNS( XML_xmlns, XML_o ), "urn:schemas-microsoft-com:office:office",
+ FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
+ FSNS( XML_xmlns, XML_v ), "urn:schemas-microsoft-com:vml",
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSNS( XML_xmlns, XML_w10 ), "urn:schemas-microsoft-com:office:word",
+ FSNS( XML_xmlns, XML_wp ), "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
+ FSEND );
+
+ // body
+ m_pDocumentFS->startElementNS( XML_w, XML_body, FSEND );
+
+ pCurPam->GetPoint()->nNode = pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex();
+
+ // the text
+ WriteText();
+
+ // the last section info
+ const WW8_SepInfo *pSectionInfo = m_pSections? m_pSections->CurrentSectionInfo(): NULL;
+ if ( pSectionInfo )
+ SectionProperties( *pSectionInfo );
+
+ // finish body and document
+ m_pDocumentFS->endElementNS( XML_w, XML_body );
+ m_pDocumentFS->endElementNS( XML_w, XML_document );
+}
+
+DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam )
+ : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ),
+ m_pFilter( pFilter ),
+ m_pAttrOutput( NULL ),
+ m_pSections( NULL ),
+ m_nHeaders( 0 ),
+ m_nFooters( 0 ),
+ m_pVMLExport( NULL )
+{
+ // Write the document properies
+ WriteProperties( );
+
+ // relations for the document
+ m_pFilter->addRelation( S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ),
+ S( "word/document.xml" ) );
+
+ // the actual document
+ m_pDocumentFS = m_pFilter->openOutputStreamWithSerializer( S( "word/document.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" ) );
+
+ // the DrawingML access
+ m_pDrawingML = new oox::drawingml::DrawingML( m_pDocumentFS, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX );
+
+ // the attribute output for the document
+ m_pAttrOutput = new DocxAttributeOutput( *this, m_pDocumentFS, m_pDrawingML );
+
+ // the related VMLExport
+ m_pVMLExport = new VMLExport( m_pDocumentFS );
+}
+
+DocxExport::~DocxExport()
+{
+ delete m_pVMLExport, m_pVMLExport = NULL;
+ delete m_pAttrOutput, m_pAttrOutput = NULL;
+ delete m_pDrawingML, m_pDrawingML = NULL;
+}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
new file mode 100644
index 000000000000..d27eaa4bb2ce
--- /dev/null
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DOCXEXPORT_HXX_
+#define _DOCXEXPORT_HXX_
+
+#include "docxattributeoutput.hxx"
+#include "wrtww8.hxx"
+
+#include <sax/fshelper.hxx>
+#include <rtl/ustring.hxx>
+
+#include <cstdio>
+#include <vector>
+
+class DocxExportFilter;
+class SwNode;
+class SwEndNode;
+class SwTableNode;
+class SwTxtNode;
+class SwGrfNode;
+class SwOLENode;
+class SwSectionNode;
+class SwNumRuleTbl;
+
+namespace oox {
+ namespace drawingml { class DrawingML; }
+ namespace vml { class VMLExport; }
+}
+
+/// The class that does all the actual DOCX export-related work.
+class DocxExport : public MSWordExportBase
+{
+ /// Pointer to the filter that owns us.
+ DocxExportFilter *m_pFilter;
+
+ /// Fast serializer for the document output.
+ ::sax_fastparser::FSHelperPtr m_pDocumentFS;
+
+ /// Access to the DrawingML writer.
+ oox::drawingml::DrawingML *m_pDrawingML;
+
+ /// Attribute output for document.
+ DocxAttributeOutput *m_pAttrOutput;
+
+ /// Sections/headers/footers
+ MSWordSections *m_pSections;
+
+ /// Header counter.
+ sal_Int32 m_nHeaders;
+
+ /// Footer counter.
+ sal_Int32 m_nFooters;
+
+ /// Used to split the runs according to the bookmarks start and ends
+ typedef std::vector< ::sw::mark::IMark* > IMarkVector;
+ IMarkVector m_rSortedMarksStart;
+ IMarkVector m_rSortedMarksEnd;
+
+ /// Exporter of the VML shapes.
+ oox::vml::VMLExport *m_pVMLExport;
+
+public:
+ /// Access to the attribute output class.
+ virtual AttributeOutputBase& AttrOutput() const;
+
+ /// Access to the sections/headers/footres.
+ virtual MSWordSections& Sections() const;
+
+ /// Hack, unfortunately necessary at some places for now.
+ /// FIXME remove it when possible.
+ virtual bool HackIsWW8OrHigher() const { return true; }
+
+ /// Guess the script (asian/western).
+ virtual bool CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich );
+
+ virtual void AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen );
+
+ virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false );
+
+ /// Returns the relationd id
+ rtl::OString AddRelation( const rtl::OUString& rType, const rtl::OUString& rTarget, const rtl::OUString& rMode );
+
+ virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/ ) { /* FIXME no-op for docx, most probably should not even be in MSWordExportBase */ }
+ virtual void WriteChar( sal_Unicode ) { /* FIXME */ fprintf( stderr, "HACK! WriteChar() has nothing to do for docx.\n" ); }
+
+ /// Return value indicates if an inherited outline numbering is suppressed.
+ virtual bool DisallowInheritingOutlineNumbering( const SwFmt &rFmt );
+
+ /// Output the actual headers and footers.
+ virtual void WriteHeadersFooters( BYTE nHeadFootFlags,
+ const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt );
+
+ /// Write the field
+ virtual void OutputField( const SwField* pFld, ww::eField eFldType,
+ const String& rFldCmd, BYTE nMode = nsFieldFlags::WRITEFIELD_ALL );
+
+ /// Write the data of the form field
+ virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark );
+
+ virtual void DoComboBox(const rtl::OUString &rName,
+ const rtl::OUString &rHelp,
+ const rtl::OUString &ToolTip,
+ const rtl::OUString &rSelected,
+ com::sun::star::uno::Sequence<rtl::OUString> &rListItems);
+
+ virtual void DoFormText(const SwInputField * pFld);
+
+ virtual ULONG ReplaceCr( BYTE nChar );
+
+protected:
+ /// Format-dependant part of the actual export.
+ virtual void ExportDocument_Impl();
+
+ /// Output page/section breaks
+ virtual void OutputPageSectionBreaks( const SwTxtNode& );
+
+ /// Output SwEndNode
+ virtual void OutputEndNode( const SwEndNode& );
+
+ /// Output SwTableNode
+ virtual void OutputTableNode( const SwTableNode& );
+
+ /// Output SwGrfNode
+ virtual void OutputGrfNode( const SwGrfNode& );
+
+ /// Output SwOLENode
+ virtual void OutputOLENode( const SwOLENode& );
+
+
+ virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, ULONG nLnNum );
+
+ virtual void SectionBreaksAndFrames( const SwTxtNode& rNode ) {}
+
+ /// Get ready for a new section.
+ virtual void PrepareNewPageDesc( const SfxItemSet* pSet,
+ const SwNode& rNd,
+ const SwFmtPageDesc* pNewPgDescFmt = 0,
+ const SwPageDesc* pNewPgDesc = 0 );
+
+ /// Get the next position in the text node to output
+ virtual xub_StrLen GetNextPos( SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos );
+
+ /// Update the information for GetNextPos().
+ virtual void UpdatePosition( SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd );
+
+private:
+ /// Find the nearest bookmark from the current position.
+ ///
+ /// Returns false when there is no bookmark.
+ bool NearestBookmark( xub_StrLen& rNearest );
+
+ void GetSortedBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos,
+ xub_StrLen nLen );
+
+ bool GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, xub_StrLen nEnd,
+ IMarkVector& rArr );
+
+ /// Setup pStyles and write styles.xml
+ void InitStyles();
+
+ /// Write footnotes.xml and endnotes.xml.
+ void WriteFootnotesEndnotes();
+
+ /// Write the numbering table.
+ virtual void WriteNumbering();
+
+ /// Write reference to a header/foorter + the actual xml containing the text.
+ void WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pType );
+
+ /// Write word/fontTable.xml.
+ void WriteFonts();
+
+ /// Write docProps/core.xml
+ void WriteProperties();
+
+public:
+ /// FIXME this is temporary, remotely reminding the method of the same
+ /// name in WW8Export.
+ void WriteMainText();
+
+ /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class.
+ DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument,
+ SwPaM *pCurrentPam, SwPaM *pOriginalPam );
+
+ /// Destructor.
+ virtual ~DocxExport();
+
+ /// Reference to the VMLExport instance for the main document.
+ oox::vml::VMLExport& VMLExporter();
+
+private:
+ /// No copying.
+ DocxExport( const DocxExport& );
+
+ /// No copying.
+ DocxExport& operator=( const DocxExport& );
+};
+
+#endif // _DOCXEXPORT_HXX_
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx
new file mode 100644
index 000000000000..b09cf8a22b3f
--- /dev/null
+++ b/sw/source/filter/ww8/docxexportfilter.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "docxexportfilter.hxx"
+#include "docxexport.hxx"
+
+#include <docsh.hxx>
+#include <pam.hxx>
+#include <unotxdoc.hxx>
+
+#include <cppuhelper/factory.hxx>
+
+using namespace ::comphelper;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+#define S( x ) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
+
+DocxExportFilter::DocxExportFilter( const uno::Reference< lang::XMultiServiceFactory >& rMSF )
+ : oox::core::XmlFilterBase( rMSF )
+{
+}
+
+bool DocxExportFilter::exportDocument()
+{
+ fprintf( stderr, "DocxExportFilter::exportDocument()\n" ); // DEBUG remove me
+
+ // get SwDoc*
+ uno::Reference< uno::XInterface > xIfc( getModel(), uno::UNO_QUERY );
+ SwXTextDocument *pTxtDoc = dynamic_cast< SwXTextDocument * >( xIfc.get() );
+ if ( !pTxtDoc )
+ return false;
+
+ SwDoc *pDoc = pTxtDoc->GetDocShell()->GetDoc();
+ if ( !pDoc )
+ return false;
+
+ // get SwPaM*
+ // FIXME so far we get SwPaM for the entire document; probably we should
+ // be able to output just the selection as well - though no idea how to
+ // get the correct SwPaM* then...
+ SwPaM aPam( pDoc->GetNodes().GetEndOfContent() );
+ aPam.SetMark();
+ aPam.Move( fnMoveBackward, fnGoDoc );
+
+ SwPaM *pCurPam = new SwPaM( *aPam.End(), *aPam.Start() );
+
+ // export the document
+ // (in a separate block so that it's destructed before the commit)
+ {
+ DocxExport aExport( this, pDoc, pCurPam, &aPam );
+ aExport.ExportDocument( true ); // FIXME support exporting selection only
+ }
+
+ commit();
+
+ // delete the pCurPam
+ if ( pCurPam )
+ {
+ while ( pCurPam->GetNext() != pCurPam )
+ delete pCurPam->GetNext();
+ delete pCurPam;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// UNO stuff so that the filter is registered
+//////////////////////////////////////////////////////////////////////////
+
+#define IMPL_NAME "com.sun.star.comp.Writer.DocxExport"
+
+OUString DocxExport_getImplementationName()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME ) );
+}
+
+OUString DocxExportFilter::implGetImplementationName() const
+{
+ return DocxExport_getImplementationName();
+}
+
+uno::Sequence< OUString > SAL_CALL DocxExport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL DocxExport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*) new DocxExportFilter( rSMgr );
+}
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ uno::Reference< registry::XRegistryKey > xNewKey1(
+ static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
+ OUString::createFromAscii( IMPL_NAME "/UNO/SERVICES/" ) ) );
+ xNewKey1->createKey( DocxExport_getSupportedServiceNames().getConstArray()[0] );
+
+ bRet = sal_True;
+ }
+ catch( registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+{
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+ void* pRet = 0;
+
+ if ( rtl_str_compare( pImplName, IMPL_NAME ) == 0 )
+ {
+ const OUString aServiceName( OUString::createFromAscii( IMPL_NAME ) );
+
+ xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
+ reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
+ DocxExport_getImplementationName(),
+ DocxExport_createInstance,
+ DocxExport_getSupportedServiceNames() ) );
+ }
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexportfilter.hxx b/sw/source/filter/ww8/docxexportfilter.hxx
new file mode 100644
index 000000000000..19d10260787b
--- /dev/null
+++ b/sw/source/filter/ww8/docxexportfilter.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DOCXEXPORTFILTER_HXX_
+#define _DOCXEXPORTFILTER_HXX_
+
+#include <oox/core/xmlfilterbase.hxx>
+#include <oox/drawingml/chart/chartconverter.hxx>
+#include <oox/vml/drawing.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+/// The physical access to the DOCX document (for writing).
+class DocxExportFilter : public oox::core::XmlFilterBase
+{
+public:
+ DocxExportFilter( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rMSF );
+
+ // FIXME these should not even exist for the export-only filter!
+ // For now, let's just do empty implementations of those.
+ virtual bool importDocument() { return false; }
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const { return NULL; }
+ virtual sal_Int32 getSchemeClr( sal_Int32 ) const { return 0; }
+ virtual const ::oox::vml::DrawingPtr getDrawings() { return ::oox::vml::DrawingPtr(); }
+ virtual ::oox::drawingml::chart::ChartConverter& getChartConverter() { static ::oox::drawingml::chart::ChartConverter aConverter; return aConverter; }
+ virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() { return ::oox::drawingml::table::TableStyleListPtr(); }
+
+ // Actual export of the DOCX document
+ virtual bool exportDocument();
+
+private:
+
+ /// Implementatio of the filter abstract method.
+ virtual ::rtl::OUString implGetImplementationName() const;
+};
+
+#endif // _DOCXEXPORTFILTER_HXX_
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxfootnotes.hxx b/sw/source/filter/ww8/docxfootnotes.hxx
new file mode 100644
index 000000000000..b885c3fe51e4
--- /dev/null
+++ b/sw/source/filter/ww8/docxfootnotes.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DOCXFOOTNOTES_HXX_
+#define _DOCXFOOTNOTES_HXX_
+
+#include <fmtftn.hxx>
+
+#include <oox/core/tokens.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <sax/fshelper.hxx>
+
+#include <vector>
+
+namespace docx {
+
+typedef ::std::vector< const SwFmtFtn* > FootnotesVector;
+
+/** Remember footnotes/endnotes so that we can dump them in one go.
+
+ Also rememeber the last added footnote Id to be able to write it in the
+ DocxAttributeOutput::EndRunProperties() method.
+*/
+class FootnotesList {
+ /// The current footnote, that was not written yet.
+ sal_Int32 m_nCurrent;
+
+ /// List of the footnotes.
+ FootnotesVector m_aFootnotes;
+
+public:
+ FootnotesList() : m_nCurrent( -1 ) {}
+
+ void add( const SwFmtFtn& rFootnote )
+ {
+ m_aFootnotes.push_back( &rFootnote );
+ m_nCurrent = m_aFootnotes.size() - 1;
+ }
+
+ /// Return the current footnote/endnote and clear the 'current' state.
+ const SwFmtFtn* getCurrent( sal_Int32& rId )
+ {
+ // skip ids 0 and 1 - they are reserved for separator and
+ // continuationSeparator
+ rId = m_nCurrent + 2;
+
+ // anything to write at all?
+ if ( m_nCurrent < 0 )
+ {
+ rId = -1;
+ return NULL;
+ }
+
+ const SwFmtFtn *pFootnote = m_aFootnotes[m_nCurrent];
+ m_nCurrent = -1;
+
+ return pFootnote;
+ }
+
+ /// Return all the footnotes/endnotes.
+ const FootnotesVector& getVector() const
+ {
+ return m_aFootnotes;
+ }
+
+ /// Do we have any footnotes/endnotes at all?
+ bool isEmpty() const
+ {
+ return m_aFootnotes.empty();
+ }
+};
+
+} // namespace docx
+
+#endif // _DOCXFOOTNOTES_HXX_
diff --git a/sw/source/filter/ww8/dump/ww8scan.hxx b/sw/source/filter/ww8/dump/ww8scan.hxx
index f6eba4d0ff27..6df865fbfced 100644
--- a/sw/source/filter/ww8/dump/ww8scan.hxx
+++ b/sw/source/filter/ww8/dump/ww8scan.hxx
@@ -811,7 +811,8 @@ public:
-
+/** FIB - File Information Block
+*/
class WW8Fib
{
public:
@@ -1267,7 +1268,9 @@ public:
};
-class WW8Dop // Document Properties
+/** Document Properties
+*/
+class WW8Dop
{
public:
/*
diff --git a/sw/source/filter/ww8/escher.hxx b/sw/source/filter/ww8/escher.hxx
index 0ca507f50b46..0fb39dcc7a02 100644
--- a/sw/source/filter/ww8/escher.hxx
+++ b/sw/source/filter/ww8/escher.hxx
@@ -96,7 +96,7 @@ class SwBasicEscherEx : public EscherEx
private:
void Init();
protected:
- SwWW8Writer& rWrt;
+ WW8Export& rWrt;
SvStream* pEscherStrm;
SvStream* pPictStrm;
long mnEmuMul, mnEmuDiv;
@@ -121,7 +121,7 @@ protected:
SdrLayerID GetInvisibleHellId() const;
public:
- SwBasicEscherEx(SvStream* pStrm, SwWW8Writer& rWrt, UINT32 nDrawings = 1);
+ SwBasicEscherEx(SvStream* pStrm, WW8Export& rWrt, UINT32 nDrawings = 1);
INT32 WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId);
INT32 WriteOLEFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId);
void WriteEmptyFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId);
@@ -161,7 +161,7 @@ private:
virtual void SetPicId(const SdrObject &rSdrObj, UINT32 nShapeId,
EscherPropertyContainer &rPropOpt);
public:
- SwEscherEx( SvStream* pStrm, SwWW8Writer& rWW8Wrt );
+ SwEscherEx( SvStream* pStrm, WW8Export& rWW8Wrt );
virtual ~SwEscherEx();
void FinishEscher();
virtual void WritePictures();
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 6aec829b8649..2ad32c7be689 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -164,20 +164,6 @@ namespace
return aRet;
}
- /*
- Utility to extract flyfmts from a document, potentially from a
- selection, and with bAll off ignores the drawing objects
- */
- sw::Frames GetFrames(const SwDoc &rDoc, SwPaM *pPaM, bool /*bAll*/)
- {
- SwPosFlyFrms aFlys;
- rDoc.GetAllFlyFmts(aFlys, pPaM, true);
- sw::Frames aRet(SwPosFlyFrmsToFrames(aFlys));
- for (USHORT i = aFlys.Count(); i > 0;)
- delete aFlys[--i];
- return aRet;
- }
-
//Utility to test if a frame is anchored at a given node index
class anchoredto: public std::unary_function<const sw::Frame&, bool>
{
@@ -570,14 +556,18 @@ namespace sw
}
// <--
- Frames GetAllFrames(const SwDoc &rDoc, SwPaM *pPaM)
- {
- return GetFrames(rDoc, pPaM, true);
- }
-
- Frames GetNonDrawingFrames(const SwDoc &rDoc, SwPaM *pPaM)
- {
- return GetFrames(rDoc, pPaM, false);
+ /*
+ Utility to extract flyfmts from a document, potentially from a
+ selection.
+ */
+ Frames GetFrames(const SwDoc &rDoc, SwPaM *pPaM /*, bool bAll*/)
+ {
+ SwPosFlyFrms aFlys;
+ rDoc.GetAllFlyFmts(aFlys, pPaM, true);
+ sw::Frames aRet(SwPosFlyFrmsToFrames(aFlys));
+ for (USHORT i = aFlys.Count(); i > 0;)
+ delete aFlys[--i];
+ return aRet;
}
Frames GetFramesBetweenNodes(const Frames &rFrames,
diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx
index fa8a17fd5312..18e73b1e2d56 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -39,13 +39,14 @@
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <sfx2/objsh.hxx>
-# include "types.hxx"
-# include <svtools/itempool.hxx> //SfxItemPool
-# include <svtools/itemset.hxx> //SfxItemSet
-# include <format.hxx> //SwFmt
-# include <node.hxx> //SwCntntNode
-# include <pam.hxx> //SwPaM
-# include <tools/poly.hxx> //Polygon, PolyPolygon
+#include "types.hxx"
+#include <svtools/itempool.hxx> //SfxItemPool
+#include <svtools/itemset.hxx> //SfxItemSet
+#include <format.hxx> //SwFmt
+#include <node.hxx> //SwCntntNode
+#include <pam.hxx> //SwPaM
+#include <tools/poly.hxx> //Polygon, PolyPolygon
+#include <doc.hxx> //SwDoc
//Uncomment to dump debugging streams of graphics
#if OSL_DEBUG_LEVEL > 1
@@ -633,8 +634,6 @@ namespace sw
need them to have something to be anchored to. So this method
returns all the floating elements in a document as a STL container
of sw::Frames which are guaranteed to have an appropiate anchor.
- This will include drawing objects, use GetNonDrawingFrames if
- you are not interested in the drawing objects.
@param rDoc
The SwDoc document to get the styles from
@@ -648,31 +647,7 @@ namespace sw
@author
<a href="mailto:cmc@openoffice.org">Caol&aacute;n McNamara</a>
*/
- Frames GetAllFrames(const SwDoc &rDoc, SwPaM *pPaM = 0);
-
- /** Get the Floating elements in a SwDoc
-
- Writer's FrmFmts may or may not be anchored to some text content,
- e.g. Page Anchored elements will not be. For the winword export we
- need them to have something to be anchored to. So this method
- returns all the floating elements in a document as a STL container
- of sw::Frames which are guaranteed to have an appropiate anchor.
- This will not include drawing objects, use GetAllFrames if you
- are interested in the drawing objects.
-
- @param rDoc
- The SwDoc document to get the styles from
-
- @param pPaM
- The SwPam to describe the selection in the document to get the
- elements from. 0 means the entire document.
-
- @return A Frames containing the selections Floating elements
-
- @author
- <a href="mailto:cmc@openoffice.org">Caol&aacute;n McNamara</a>
- */
- Frames GetNonDrawingFrames(const SwDoc &rDoc, SwPaM *pPaM = 0);
+ Frames GetFrames(const SwDoc &rDoc, SwPaM *pPaM = 0);
/** Get the Frames anchored to a given node
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index fa83fde06733..dfc3f8f92d94 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2,6 +2,7 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -99,9 +100,8 @@
#include <pagedesc.hxx>
#include <ww8par.hxx>
#include <breakit.hxx>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
+#include "ww8attributeoutput.hxx"
#include "writerhelper.hxx"
#include "writerwordglue.hxx"
#include "wrtww8.hxx"
@@ -117,7 +117,7 @@ using namespace sw::types;
using namespace nsFieldFlags;
//#110185# get a part fix for this type of element
-bool SwWW8Writer::MiserableFormFieldExportHack(const SwFrmFmt& rFrmFmt)
+bool WW8Export::MiserableFormFieldExportHack(const SwFrmFmt& rFrmFmt)
{
ASSERT(bWrtWW8, "Not allowed");
if (!bWrtWW8)
@@ -149,7 +149,7 @@ bool SwWW8Writer::MiserableFormFieldExportHack(const SwFrmFmt& rFrmFmt)
}
-void SwWW8Writer::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet)
+void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet)
{
rtl::OUString sSelected;
uno::Sequence<rtl::OUString> aListItems;
@@ -191,7 +191,7 @@ void SwWW8Writer::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet)
DoComboBox(sName, sHelp, sToolTip, sSelected, aListItems);
}
-void SwWW8Writer::DoComboBox(const rtl::OUString &rName,
+void WW8Export::DoComboBox(const rtl::OUString &rName,
const rtl::OUString &rHelp,
const rtl::OUString &rToolTip,
const rtl::OUString &rSelected,
@@ -200,7 +200,7 @@ void SwWW8Writer::DoComboBox(const rtl::OUString &rName,
ASSERT(bWrtWW8, "Not allowed");
if (!bWrtWW8)
return;
- OutField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
+ OutputField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
WRITEFIELD_START | WRITEFIELD_CMD_START);
// write the refence to the "picture" structure
ULONG nDataStt = pDataStrm->Tell();
@@ -220,7 +220,7 @@ void SwWW8Writer::DoComboBox(const rtl::OUString &rName,
pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof(aArr1), aArr1);
- OutField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
+ OutputField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
WRITEFIELD_CLOSE);
::sw::WW8FFData aFFData;
@@ -240,15 +240,14 @@ void SwWW8Writer::DoComboBox(const rtl::OUString &rName,
}
aFFData.Write(pDataStrm);
-
}
-void SwWW8Writer::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet)
+void WW8Export::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet)
{
uno::Reference<beans::XPropertySetInfo> xPropSetInfo =
xPropSet->getPropertySetInfo();
- OutField(0, ww::eFORMCHECKBOX, FieldString(ww::eFORMCHECKBOX),
+ OutputField(0, ww::eFORMCHECKBOX, FieldString(ww::eFORMCHECKBOX),
WRITEFIELD_START | WRITEFIELD_CMD_START);
// write the refence to the "picture" structure
ULONG nDataStt = pDataStrm->Tell();
@@ -318,12 +317,12 @@ void SwWW8Writer::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet)
aFFData.Write(pDataStrm);
- OutField(0, ww::eFORMCHECKBOX, aEmptyStr, WRITEFIELD_CLOSE);
+ OutputField(0, ww::eFORMCHECKBOX, aEmptyStr, WRITEFIELD_CLOSE);
}
-void SwWW8Writer::DoFormText(const SwInputField * pFld)
+void WW8Export::DoFormText(const SwInputField * pFld)
{
- OutField(0, ww::eFORMTEXT, FieldString(ww::eFORMTEXT),
+ OutputField(0, ww::eFORMTEXT, FieldString(ww::eFORMTEXT),
WRITEFIELD_START | WRITEFIELD_CMD_START);
// write the refence to the "picture" structure
ULONG nDataStt = pDataStrm->Tell();
@@ -351,7 +350,7 @@ void SwWW8Writer::DoFormText(const SwInputField * pFld)
aFFData.setStatus(pFld->GetToolTip());
aFFData.Write(pDataStrm);
- OutField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CMD_END);
+ OutputField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CMD_END);
SwWW8Writer::WriteString16(Strm(), pFld->Expand(), false);
@@ -366,7 +365,7 @@ void SwWW8Writer::DoFormText(const SwInputField * pFld)
pChpPlc->AppendFkpEntry(Strm().Tell(),
sizeof( aArr2 ), aArr2 );
- OutField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CLOSE);
+ OutputField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CLOSE);
}
PlcDrawObj::~PlcDrawObj()
@@ -429,7 +428,7 @@ bool RTLDrawingsHack(long &rLeft, long /*nWidth*/,
return bRet;
}
-bool SwWW8Writer::MiserableRTLFrmFmtHack(SwTwips &rLeft, SwTwips &rRight,
+bool WW8Export::MiserableRTLFrmFmtHack(SwTwips &rLeft, SwTwips &rRight,
const sw::Frame &rFrmFmt)
{
//Require nasty bidi swap
@@ -465,7 +464,7 @@ bool SwWW8Writer::MiserableRTLFrmFmtHack(SwTwips &rLeft, SwTwips &rRight,
return bRet;
}
-void PlcDrawObj::WritePlc(SwWW8Writer& rWrt) const
+void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
{
if (8 > rWrt.pFib->nVersion) // Cannot export drawobject in vers 7-
return;
@@ -690,8 +689,8 @@ DrawObj& DrawObj::operator=(const DrawObj& rOther)
return *this;
}
-bool PlcDrawObj::Append(SwWW8Writer& rWrt, WW8_CP nCp, const sw::Frame& rFmt,
- const Point& rNdTopLeft)
+bool PlcDrawObj::Append( WW8Export& rWrt, WW8_CP nCp, const sw::Frame& rFmt,
+ const Point& rNdTopLeft )
{
bool bRet = false;
const SwFrmFmt &rFormat = rFmt.GetFrmFmt();
@@ -722,7 +721,7 @@ void DrawObj::SetShapeDetails(UINT32 nId, INT32 nThick)
mnThick = nThick;
}
-bool WW8_WrPlcTxtBoxes::WriteTxt(SwWW8Writer& rWrt)
+bool WW8_WrPlcTxtBoxes::WriteTxt( WW8Export& rWrt )
{
bool bRet = false;
rWrt.bInWriteEscher = true;
@@ -756,7 +755,7 @@ const SvULongs* WW8_WrPlcTxtBoxes::GetShapeIdArr() const
/* */
-UINT32 SwWW8Writer::GetSdrOrdNum( const SwFrmFmt& rFmt ) const
+UINT32 WW8Export::GetSdrOrdNum( const SwFrmFmt& rFmt ) const
{
UINT32 nOrdNum;
const SdrObject* pObj = rFmt.FindRealSdrObject();
@@ -775,7 +774,7 @@ UINT32 SwWW8Writer::GetSdrOrdNum( const SwFrmFmt& rFmt ) const
return nOrdNum;
}
-void SwWW8Writer::AppendFlyInFlys(const sw::Frame& rFrmFmt,
+void WW8Export::AppendFlyInFlys(const sw::Frame& rFrmFmt,
const Point& rNdTopLeft)
{
ASSERT(bWrtWW8, "this has gone horribly wrong");
@@ -790,7 +789,7 @@ void SwWW8Writer::AppendFlyInFlys(const sw::Frame& rFrmFmt,
if (rFrmFmt.IsInline())
{
- OutField(0, ww::eSHAPE, FieldString(ww::eSHAPE),
+ OutputField(0, ww::eSHAPE, FieldString(ww::eSHAPE),
WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END);
}
@@ -818,10 +817,10 @@ void SwWW8Writer::AppendFlyInFlys(const sw::Frame& rFrmFmt,
}
if (rFrmFmt.IsInline())
- OutField(0, ww::eSHAPE, aEmptyStr, WRITEFIELD_CLOSE);
+ OutputField(0, ww::eSHAPE, aEmptyStr, WRITEFIELD_CLOSE);
}
-class WW8_SdrAttrIter : public WW8_AttrIter
+class WW8_SdrAttrIter : public MSWordAttrIter
{
private:
const EditTextObject* pEditObj;
@@ -843,8 +842,8 @@ private:
WW8_SdrAttrIter(const WW8_SdrAttrIter&);
WW8_SdrAttrIter& operator=(const WW8_SdrAttrIter&);
public:
- WW8_SdrAttrIter(SwWW8Writer& rWr, const EditTextObject& rEditObj,
- BYTE nType);
+ WW8_SdrAttrIter( WW8Export& rWr, const EditTextObject& rEditObj,
+ BYTE nType );
void NextPara( USHORT nPar );
void OutParaAttr(bool bCharAttr);
void OutEEField(const SfxPoolItem& rHt);
@@ -863,9 +862,9 @@ public:
};
-WW8_SdrAttrIter::WW8_SdrAttrIter(SwWW8Writer& rWr,
- const EditTextObject& rEditObj, BYTE nTyp)
- : WW8_AttrIter( rWr ), pEditObj(&rEditObj), pEditPool(0),
+WW8_SdrAttrIter::WW8_SdrAttrIter( WW8Export& rWr,
+ const EditTextObject& rEditObj, BYTE nTyp )
+ : MSWordAttrIter( rWr ), pEditObj(&rEditObj), pEditPool(0),
aTxtAtrArr( 0, 4 ), aChrTxtAtrArr( 0, 4 ), aChrSetArr( 0, 4 ),
mnTyp(nTyp)
{
@@ -978,16 +977,16 @@ void WW8_SdrAttrIter::OutEEField(const SfxPoolItem& rHt)
const SvxFieldData *pFld = rField.GetField();
if (pFld && pFld->ISA(SvxURLField))
{
- BYTE nOldTxtTyp = rWrt.nTxtTyp;
- rWrt.nTxtTyp = mnTyp;
+ BYTE nOldTxtTyp = m_rExport.nTxtTyp;
+ m_rExport.nTxtTyp = mnTyp;
const SvxURLField *pURL = (const SvxURLField *)pFld;
- StartURL(pURL->GetURL(), pURL->GetTargetFrame());
+ m_rExport.AttrOutput().StartURL( pURL->GetURL(), pURL->GetTargetFrame() );
const String &rStr = pURL->GetRepresentation();
- rWrt.OutSwString(rStr, 0, rStr.Len(), true, GetNodeCharSet());
+ m_rExport.AttrOutput().RawText( rStr, true, GetNodeCharSet() ); // FIXME kendy: is the 'true' actually correct here? It was here before, but... ;-)
- EndURL();
- rWrt.nTxtTyp = nOldTxtTyp;
+ m_rExport.AttrOutput().EndURL();
+ m_rExport.nTxtTyp = nOldTxtTyp;
}
}
@@ -997,15 +996,14 @@ void WW8_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
if( aTxtAtrArr.Count() )
{
- const SwModify* pOldMod = rWrt.pOutFmtNode;
- rWrt.pOutFmtNode = 0;
+ const SwModify* pOldMod = m_rExport.pOutFmtNode;
+ m_rExport.pOutFmtNode = 0;
const SfxItemPool* pSrcPool = pEditPool;
- const SfxItemPool& rDstPool = rWrt.pDoc->GetAttrPool();
+ const SfxItemPool& rDstPool = m_rExport.pDoc->GetAttrPool();
nTmpSwPos = nSwPos;
USHORT i, nWhich, nSlotId;
- FnAttrOut pOut;
for( i = 0; i < aTxtAtrArr.Count(); i++ )
{
const EECharAttrib& rHt = aTxtAtrArr[ i ];
@@ -1019,7 +1017,7 @@ void WW8_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
}
else if (nWhich == EE_FEATURE_TAB)
{
- rWrt.WriteChar(0x9);
+ m_rExport.WriteChar(0x9);
continue;
}
nSlotId = pSrcPool->GetSlotId(nWhich);
@@ -1029,16 +1027,13 @@ void WW8_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
nWhich = rDstPool.GetWhich(nSlotId);
if (nWhich && nWhich != nSlotId &&
nWhich < RES_UNKNOWNATR_BEGIN &&
- 0 != (pOut = aWW8AttrFnTab[nWhich - RES_CHRATR_BEGIN]))
+ m_rExport.CollapseScriptsforWordOk(nScript,nWhich))
{
- if (rWrt.CollapseScriptsforWordOk(nScript,nWhich))
- {
- // use always the SW-Which Id !
- SfxPoolItem* pI = rHt.pAttr->Clone();
- pI->SetWhich( nWhich );
- (*pOut)( rWrt, *pI );
- delete pI;
- }
+ // use always the SW-Which Id !
+ SfxPoolItem* pI = rHt.pAttr->Clone();
+ pI->SetWhich( nWhich );
+ m_rExport.AttrOutput().OutputItem( *pI );
+ delete pI;
}
}
}
@@ -1048,7 +1043,7 @@ void WW8_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
}
nTmpSwPos = 0; // HasTextItem nur in dem obigen Bereich erlaubt
- rWrt.pOutFmtNode = pOldMod;
+ m_rExport.pOutFmtNode = pOldMod;
}
}
@@ -1081,7 +1076,7 @@ const SfxPoolItem* WW8_SdrAttrIter::HasTextItem(USHORT nWhich) const
{
const SfxPoolItem* pRet = 0;
nWhich = sw::hack::TransformWhichBetweenPools(*pEditPool,
- rWrt.pDoc->GetAttrPool(), nWhich);
+ m_rExport.pDoc->GetAttrPool(), nWhich);
if (nWhich)
{
for (USHORT i = 0; i < aTxtAtrArr.Count(); ++i)
@@ -1109,7 +1104,7 @@ const SfxPoolItem& WW8_SdrAttrIter::GetItem( USHORT nWhich ) const
if (!pRet)
{
SfxItemSet aSet(pEditObj->GetParaAttribs(nPara));
- nWhich = GetSetWhichFromSwDocWhich(aSet, *rWrt.pDoc, nWhich);
+ nWhich = GetSetWhichFromSwDocWhich(aSet, *m_rExport.pDoc, nWhich);
ASSERT(nWhich, "Impossible, catastrophic failure imminent");
pRet = &aSet.Get(nWhich);
}
@@ -1121,42 +1116,38 @@ void WW8_SdrAttrIter::OutParaAttr(bool bCharAttr)
SfxItemSet aSet( pEditObj->GetParaAttribs( nPara ));
if( aSet.Count() )
{
- const SfxItemSet* pOldSet = rWrt.GetCurItemSet();
- rWrt.SetCurItemSet( &aSet );
+ const SfxItemSet* pOldSet = m_rExport.GetCurItemSet();
+ m_rExport.SetCurItemSet( &aSet );
SfxItemIter aIter( aSet );
const SfxPoolItem* pItem = aIter.GetCurItem();
- FnAttrOut pOut;
const SfxItemPool* pSrcPool = pEditPool,
- * pDstPool = &rWrt.pDoc->GetAttrPool();
+ * pDstPool = &m_rExport.pDoc->GetAttrPool();
do {
- USHORT nWhich = pItem->Which(),
- nSlotId = pSrcPool->GetSlotId( nWhich );
- if( nSlotId && nWhich != nSlotId &&
- 0 != ( nWhich = pDstPool->GetWhich( nSlotId ) ) &&
- nWhich != nSlotId &&
- 0 != ( pOut = aWW8AttrFnTab[ nWhich - RES_CHRATR_BEGIN ] )
- && ( bCharAttr ? ( nWhich >= RES_CHRATR_BEGIN
- && nWhich < RES_TXTATR_END)
- : (nWhich >= RES_PARATR_BEGIN
- && nWhich < RES_FRMATR_END) ) )
- {
- // use always the SW-Which Id !
- SfxPoolItem* pI = pItem->Clone();
- pI->SetWhich( nWhich );
- if (rWrt.CollapseScriptsforWordOk(nScript,nWhich))
- (*pOut)( rWrt, *pI );
- delete pI;
- }
-
+ USHORT nWhich = pItem->Which(),
+ nSlotId = pSrcPool->GetSlotId( nWhich );
+
+ if ( nSlotId && nWhich != nSlotId &&
+ 0 != ( nWhich = pDstPool->GetWhich( nSlotId ) ) &&
+ nWhich != nSlotId &&
+ ( bCharAttr ? ( nWhich >= RES_CHRATR_BEGIN && nWhich < RES_TXTATR_END )
+ : ( nWhich >= RES_PARATR_BEGIN && nWhich < RES_FRMATR_END ) ) )
+ {
+ // use always the SW-Which Id !
+ SfxPoolItem* pI = pItem->Clone();
+ pI->SetWhich( nWhich );
+ if (m_rExport.CollapseScriptsforWordOk(nScript,nWhich))
+ m_rExport.AttrOutput().OutputItem( *pI );
+ delete pI;
+ }
} while( !aIter.IsAtEnd() && 0 != ( pItem = aIter.NextItem() ) );
- rWrt.SetCurItemSet( pOldSet );
+ m_rExport.SetCurItemSet( pOldSet );
}
}
-void SwWW8Writer::WriteSdrTextObj(const SdrObject& rObj, BYTE nTyp)
+void WW8Export::WriteSdrTextObj(const SdrObject& rObj, BYTE nTyp)
{
const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, &rObj);
ASSERT(pTxtObj, "That is no SdrTextObj!");
@@ -1189,7 +1180,7 @@ void SwWW8Writer::WriteSdrTextObj(const SdrObject& rObj, BYTE nTyp)
}
}
-void SwWW8Writer::WriteOutliner(const OutlinerParaObject& rParaObj, BYTE nTyp)
+void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, BYTE nTyp)
{
bool bAnyWrite = false;
const EditTextObject& rEditObj = rParaObj.GetTextObject();
@@ -1290,7 +1281,7 @@ void WinwordAnchoring::WriteData( EscherEx& rEx ) const
/* */
-void SwWW8Writer::CreateEscher()
+void WW8Export::CreateEscher()
{
SfxItemState eBackSet =
(const_cast<const SwDoc*>(pDoc))->GetPageDesc(0).GetMaster().
@@ -1304,7 +1295,7 @@ void SwWW8Writer::CreateEscher()
}
}
-void SwWW8Writer::WriteEscher()
+void WW8Export::WriteEscher()
{
if (pEscher)
{
@@ -1339,7 +1330,7 @@ void SwEscherEx::WritePictures()
// Output- Routines for Escher Export
-SwBasicEscherEx::SwBasicEscherEx(SvStream* pStrm, SwWW8Writer& rWW8Wrt,
+SwBasicEscherEx::SwBasicEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt,
UINT32 nDrawings)
: EscherEx(*pStrm, nDrawings), rWrt(rWW8Wrt), pEscherStrm(pStrm),
pPictStrm(0)
@@ -1938,7 +1929,7 @@ void SwBasicEscherEx::WritePictures()
}
}
-SwEscherEx::SwEscherEx(SvStream* pStrm, SwWW8Writer& rWW8Wrt)
+SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt)
: SwBasicEscherEx(pStrm, rWW8Wrt, rWW8Wrt.pHFSdrObjs->size() ? 2 : 1),
pTxtBxs(0)
{
@@ -2824,10 +2815,8 @@ UINT32 SwEscherEx::QueryTextID(
return nId;
}
-bool SwMSConvertControls::ExportControl(Writer &rWrt, const SdrObject *pObj)
+bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrObject *pObj)
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
-
if (!rWW8Wrt.bWrtWW8)
return false;
@@ -2846,7 +2835,7 @@ bool SwMSConvertControls::ExportControl(Writer &rWrt, const SdrObject *pObj)
aSize.Height = TWIPS_TO_MM(aRect.Bottom());
//Open the ObjectPool
- SvStorageRef xObjPool = rWW8Wrt.GetStorage().OpenSotStorage(
+ SvStorageRef xObjPool = rWW8Wrt.GetWriter().GetStorage().OpenSotStorage(
CREATE_CONST_ASC(SL::aObjectPool), STREAM_READWRITE |
STREAM_SHARE_DENYALL);
@@ -2879,13 +2868,13 @@ bool SwMSConvertControls::ExportControl(Writer &rWrt, const SdrObject *pObj)
sFld += sName;
sFld.APPEND_CONST_ASC(".1 \\s ");
- rWW8Wrt.OutField(0, ww::eCONTROL, sFld,
+ rWW8Wrt.OutputField(0, ww::eCONTROL, sFld,
WRITEFIELD_START|WRITEFIELD_CMD_START|WRITEFIELD_CMD_END);
rWW8Wrt.pChpPlc->AppendFkpEntry(rWW8Wrt.Strm().Tell(),sizeof(aSpecOLE),
aSpecOLE);
rWW8Wrt.WriteChar( 0x1 );
- rWW8Wrt.OutField(0, ww::eCONTROL, aEmptyStr, WRITEFIELD_END | WRITEFIELD_CLOSE);
+ rWW8Wrt.OutputField(0, ww::eCONTROL, aEmptyStr, WRITEFIELD_END | WRITEFIELD_CLOSE);
return true;
}
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 132be6f5d123..d42a389e3704 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -32,7 +32,6 @@
#include "precompiled_sw.hxx"
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
-
#include <vector>
#include <list>
#include <utility>
@@ -53,9 +52,7 @@
#include <svx/ulspitem.hxx>
#include <svx/brkitem.hxx>
#include <svx/frmdiritem.hxx>
-#ifndef _SVX_TSTPITEM_HXX
#include <svx/tstpitem.hxx>
-#endif
#include "svtools/urihelper.hxx"
#include <svtools/whiter.hxx>
#include <fmtpdsc.hxx>
@@ -93,18 +90,21 @@
#include <txtatr.hxx>
#include <fmtsrnd.hxx>
#include <fmtrowsplt.hxx>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
-#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HDL_
#include <com/sun/star/i18n/WordType.hpp>
-#endif
+
+#include <writerfilter/doctok/sprmids.hxx>
+
#include "writerhelper.hxx"
#include "writerwordglue.hxx"
#include <numrule.hxx>
#include "wrtww8.hxx"
#include "ww8par.hxx"
#include <IMark.hxx>
+#include "ww8attributeoutput.hxx"
+
+#include <ndgrf.hxx>
+#include <ndole.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::i18n;
@@ -114,18 +114,18 @@ using namespace nsFieldFlags;
/* */
-WW8_AttrIter::WW8_AttrIter(SwWW8Writer& rWr)
- : pOld(rWr.pChpIter), rWrt(rWr)
+MSWordAttrIter::MSWordAttrIter( MSWordExportBase& rExport )
+ : pOld( rExport.pChpIter ), m_rExport( rExport )
{
- rWrt.pChpIter = this;
+ m_rExport.pChpIter = this;
}
-WW8_AttrIter::~WW8_AttrIter()
+MSWordAttrIter::~MSWordAttrIter()
{
- rWrt.pChpIter = pOld;
+ m_rExport.pChpIter = pOld;
}
-// Die Klasse WW8_SwAttrIter ist eine Hilfe zum Aufbauen der Fkp.chpx.
+// Die Klasse SwAttrIter ist eine Hilfe zum Aufbauen der Fkp.chpx.
// Dabei werden nur Zeichen-Attribute beachtet; Absatz-Attribute brauchen
// diese Behandlung nicht.
// Die Absatz- und Textattribute des Writers kommen rein, und es wird
@@ -135,7 +135,7 @@ WW8_AttrIter::~WW8_AttrIter()
// Mit OutAttr() werden die Attribute an der angegebenen SwPos
// ausgegeben.
-class WW8_SwAttrIter : public WW8_AttrIter
+class SwAttrIter : public MSWordAttrIter
{
private:
const SwTxtNode& rNd;
@@ -161,18 +161,15 @@ private:
xub_StrLen SearchNext( xub_StrLen nStartPos );
void FieldVanish( const String& rTxt );
- void OutSwFmtINetFmt(const SwFmtINetFmt& rAttr, bool bStart);
void OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool bStart);
- void OutSwTOXMark(const SwTOXMark& rAttr, bool bStart);
- void OutSwFmtRuby(const SwFmtRuby& rRuby, bool bStart);
void IterToCurrent();
//No copying
- WW8_SwAttrIter(const WW8_SwAttrIter&);
- WW8_SwAttrIter& operator=(const WW8_SwAttrIter&);
+ SwAttrIter(const SwAttrIter&);
+ SwAttrIter& operator=(const SwAttrIter&);
public:
- WW8_SwAttrIter( SwWW8Writer& rWr, const SwTxtNode& rNd );
+ SwAttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd );
bool IsTxtAttr( xub_StrLen nSwPos );
bool IsRedlineAtEnd( xub_StrLen nPos ) const;
@@ -185,7 +182,7 @@ public:
virtual const SfxPoolItem* HasTextItem( USHORT nWhich ) const;
virtual const SfxPoolItem& GetItem( USHORT nWhich ) const;
int OutAttrWithRange(xub_StrLen nPos);
- void OutRedlines(xub_StrLen nPos);
+ const SwRedlineData* GetRedline( xub_StrLen nPos );
void OutFlys(xub_StrLen nSwPos);
xub_StrLen WhereNext() const { return nAktSwPos; }
@@ -198,24 +195,6 @@ public:
const SwFmtDrop& GetSwFmtDrop() const { return mrSwFmtDrop; }
};
-void SwWW8Writer::push_charpropstart(xub_StrLen nPos)
-{
- maCurrentCharPropStarts.push(nPos);
-}
-
-void SwWW8Writer::pop_charpropstart()
-{
- ASSERT(!maCurrentCharPropStarts.empty(), "cannot be empty!");
- if (!maCurrentCharPropStarts.empty())
- maCurrentCharPropStarts.pop();
-}
-
-xub_StrLen SwWW8Writer::top_charpropstart() const
-{
- ASSERT(!maCurrentCharPropStarts.empty(), "cannot be empty!");
- return maCurrentCharPropStarts.empty() ? 0 : maCurrentCharPropStarts.top();
-}
-
class sortswflys :
public std::binary_function<const sw::Frame&, const sw::Frame&, bool>
{
@@ -226,7 +205,7 @@ public:
}
};
-void WW8_SwAttrIter::IterToCurrent()
+void SwAttrIter::IterToCurrent()
{
ASSERT(maCharRuns.begin() != maCharRuns.end(), "Impossible");
mnScript = maCharRunIter->mnScript;
@@ -234,10 +213,10 @@ void WW8_SwAttrIter::IterToCurrent()
mbCharIsRTL = maCharRunIter->mbRTL;
}
-WW8_SwAttrIter::WW8_SwAttrIter(SwWW8Writer& rWr, const SwTxtNode& rTxtNd) :
- WW8_AttrIter(rWr),
+SwAttrIter::SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
+ MSWordAttrIter(rWr),
rNd(rTxtNd),
- maCharRuns(GetPseudoCharRuns(rTxtNd, 0, !rWr.bWrtWW8)),
+ maCharRuns(GetPseudoCharRuns(rTxtNd, 0, !rWr.HackIsWW8OrHigher())),
pCurRedline(0),
nAktSwPos(0),
nCurRedlinePos(USHRT_MAX),
@@ -260,14 +239,13 @@ WW8_SwAttrIter::WW8_SwAttrIter(SwWW8Writer& rWr, const SwTxtNode& rTxtNd) :
maFlyFrms = GetFramesInNode(rWr.maFrames, rNd);
std::sort(maFlyFrms.begin(), maFlyFrms.end(), sortswflys());
-
/*
#i18480#
If we are inside a frame then anything anchored inside this frame can
only be supported by word anchored inline ("as character"), so force
this in the supportable case.
*/
- if (rWr.bWrtWW8 && rWr.bInWriteEscher)
+ if (rWr.HackIsWW8OrHigher() && rWr.bInWriteEscher)
{
std::for_each(maFlyFrms.begin(), maFlyFrms.end(),
std::mem_fun_ref(&sw::Frame::ForceTreatAsInline));
@@ -275,16 +253,16 @@ WW8_SwAttrIter::WW8_SwAttrIter(SwWW8Writer& rWr, const SwTxtNode& rTxtNd) :
maFlyIter = maFlyFrms.begin();
- if (rWrt.pDoc->GetRedlineTbl().Count())
+ if ( m_rExport.pDoc->GetRedlineTbl().Count() )
{
SwPosition aPosition( rNd, SwIndex( (SwTxtNode*)&rNd ) );
- pCurRedline = rWrt.pDoc->GetRedline( aPosition, &nCurRedlinePos );
+ pCurRedline = m_rExport.pDoc->GetRedline( aPosition, &nCurRedlinePos );
}
nAktSwPos = SearchNext(1);
}
-xub_StrLen WW8_SwAttrIter::SearchNext( xub_StrLen nStartPos )
+xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos )
{
xub_StrLen nPos;
xub_StrLen nMinPos = STRING_MAXLEN;
@@ -309,16 +287,16 @@ xub_StrLen WW8_SwAttrIter::SearchNext( xub_StrLen nStartPos )
nMinPos = i;
}
- if( nCurRedlinePos < rWrt.pDoc->GetRedlineTbl().Count() )
+ if ( nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().Count() )
{
// nCurRedlinePos point to the next redline
nPos = nCurRedlinePos;
if( pCurRedline )
++nPos;
- for( ; nPos < rWrt.pDoc->GetRedlineTbl().Count(); ++nPos )
+ for ( ; nPos < m_rExport.pDoc->GetRedlineTbl().Count(); ++nPos )
{
- const SwRedline* pRedl = rWrt.pDoc->GetRedlineTbl()[ nPos ];
+ const SwRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nPos ];
const SwPosition* pStt = pRedl->Start();
const SwPosition* pEnd = pStt == pRedl->GetPoint()
@@ -417,28 +395,16 @@ xub_StrLen WW8_SwAttrIter::SearchNext( xub_StrLen nStartPos )
return nMinPos;
}
-void WW8_SwAttrIter::OutAttr(xub_StrLen nSwPos)
+void SwAttrIter::OutAttr( xub_StrLen nSwPos )
{
- if (rWrt.bWrtWW8 && IsCharRTL())
- {
- rWrt.InsUInt16(0x85a);
- rWrt.pO->Insert((BYTE)1, rWrt.pO->Count());
- }
-
- // #i46087# patch from james_clark; complex texts needs the undocumented SPRM 0x0882 with param 0x81.
- if (rWrt.bWrtWW8 && GetScript() == i18n::ScriptType::COMPLEX && !IsCharRTL())
- {
- rWrt.InsUInt16(0x882);
- rWrt.pO->Insert((BYTE)0x81, rWrt.pO->Count());
- rWrt.pDop->bUseThaiLineBreakingRules=true;
- }
+ m_rExport.AttrOutput().RTLAndCJKState( IsCharRTL(), GetScript() );
/*
Depending on whether text is in CTL/CJK or Western, get the id of that
script, the idea is that the font that is actually in use to render this
range of text ends up in pFont
*/
- sal_uInt16 nFontId = GetWhichOfScript(RES_CHRATR_FONT, GetScript());
+ sal_uInt16 nFontId = GetWhichOfScript( RES_CHRATR_FONT, GetScript() );
const SvxFontItem &rParentFont = ItemGet<SvxFontItem>(
(const SwTxtFmtColl&)rNd.GetAnyFmtColl(), nFontId);
@@ -508,34 +474,34 @@ void WW8_SwAttrIter::OutAttr(xub_StrLen nSwPos)
this for us like writer does
*/
const SwFmtCharFmt *pCharFmtItem =
- HasItem<SwFmtCharFmt>(aRangeItems, RES_TXTATR_CHARFMT);
- if (pCharFmtItem)
- ClearOverridesFromSet(*pCharFmtItem, aExportSet);
+ HasItem< SwFmtCharFmt >( aRangeItems, RES_TXTATR_CHARFMT );
+ if ( pCharFmtItem )
+ ClearOverridesFromSet( *pCharFmtItem, aExportSet );
sw::PoolItems aExportItems;
- GetPoolItems(aExportSet, aExportItems);
+ GetPoolItems( aExportSet, aExportItems );
sw::cPoolItemIter aEnd = aRangeItems.end();
- for (sw::cPoolItemIter aI = aRangeItems.begin(); aI != aEnd; ++aI)
+ for ( sw::cPoolItemIter aI = aRangeItems.begin(); aI != aEnd; ++aI )
aExportItems[aI->first] = aI->second;
- if (!aExportItems.empty())
+ if ( !aExportItems.empty() )
{
- const SwModify* pOldMod = rWrt.pOutFmtNode;
- rWrt.pOutFmtNode = &rNd;
- rWrt.push_charpropstart(nSwPos);
+ const SwModify* pOldMod = m_rExport.pOutFmtNode;
+ m_rExport.pOutFmtNode = &rNd;
+ m_rExport.m_aCurrentCharPropStarts.push( nSwPos );
- rWrt.ExportPoolItemsToCHP(aExportItems, GetScript());
+ m_rExport.ExportPoolItemsToCHP( aExportItems, GetScript() );
// HasTextItem nur in dem obigen Bereich erlaubt
- rWrt.pop_charpropstart();
- rWrt.pOutFmtNode = pOldMod;
+ m_rExport.m_aCurrentCharPropStarts.pop();
+ m_rExport.pOutFmtNode = pOldMod;
}
- ASSERT(pFont, "must be *some* font associated with this txtnode");
- if (pFont)
+ ASSERT( pFont, "must be *some* font associated with this txtnode" );
+ if ( pFont )
{
- SvxFontItem aFont(*pFont);
+ SvxFontItem aFont( *pFont );
/*
If we are a nonunicode aware format then we set the charset we want to
@@ -547,40 +513,37 @@ void WW8_SwAttrIter::OutAttr(xub_StrLen nSwPos)
this makes older nonunicode aware versions of word display the correct
characters.
*/
- if (!rWrt.bWrtWW8)
+ if ( !m_rExport.HackIsWW8OrHigher() )
aFont.GetCharSet() = GetCharSet();
- if (rParentFont != aFont)
- Out(aWW8AttrFnTab, aFont, rWrt);
+ if ( rParentFont != aFont )
+ m_rExport.AttrOutput().OutputItem( aFont );
}
-
- OutRedlines(nSwPos);
}
-void WW8_SwAttrIter::OutFlys(xub_StrLen nSwPos)
+void SwAttrIter::OutFlys(xub_StrLen nSwPos)
{
/*
#i2916#
May have an anchored graphic to be placed, loop through sorted array
and output all at this position
*/
- while (maFlyIter != maFlyFrms.end())
+ while ( maFlyIter != maFlyFrms.end() )
{
const SwPosition &rAnchor = maFlyIter->GetPosition();
xub_StrLen nPos = rAnchor.nContent.GetIndex();
- if (nPos != nSwPos)
+ if ( nPos != nSwPos )
break;
else
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- rWrtWW8.OutFlyFrm(*maFlyIter);
+ m_rExport.AttrOutput().OutputFlyFrame( *maFlyIter );
++maFlyIter;
}
}
}
-bool WW8_SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
+bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
{
// search for attrs without end position
if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
@@ -596,7 +559,7 @@ bool WW8_SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
return false;
}
-bool WW8_SwAttrIter::IsDropCap( int nSwPos )
+bool SwAttrIter::IsDropCap( int nSwPos )
{
// see if the current position falls on a DropCap
int nDropChars = mrSwFmtDrop.GetChars();
@@ -615,14 +578,14 @@ bool WW8_SwAttrIter::IsDropCap( int nSwPos )
return false;
}
-bool WW8_SwAttrIter::RequiresImplicitBookmark()
+bool SwAttrIter::RequiresImplicitBookmark()
{
- SwImplBookmarksIter bkmkIterEnd = rWrt.maImplicitBookmarks.end();
- for (SwImplBookmarksIter aIter = rWrt.maImplicitBookmarks.begin(); aIter != bkmkIterEnd; ++aIter)
+ SwImplBookmarksIter bkmkIterEnd = m_rExport.maImplicitBookmarks.end();
+ for ( SwImplBookmarksIter aIter = m_rExport.maImplicitBookmarks.begin(); aIter != bkmkIterEnd; ++aIter )
{
ULONG sample = aIter->second;
- if(sample == rNd.GetIndex())
+ if ( sample == rNd.GetIndex() )
return true;
}
return false;
@@ -634,11 +597,11 @@ bool WW8_SwAttrIter::RequiresImplicitBookmark()
// Attribut-Anfangposition fragen kann.
// Es koennen nur Attribute mit Ende abgefragt werden.
// Es wird mit bDeep gesucht
-const SfxPoolItem* WW8_SwAttrIter::HasTextItem( USHORT nWhich ) const
+const SfxPoolItem* SwAttrIter::HasTextItem( USHORT nWhich ) const
{
const SfxPoolItem* pRet = 0;
const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
- xub_StrLen nTmpSwPos = rWrt.top_charpropstart();
+ xub_StrLen nTmpSwPos = m_rExport.m_aCurrentCharPropStarts.top();
if (pTxtAttrs)
{
for (USHORT i = 0; i < pTxtAttrs->Count(); ++i)
@@ -660,162 +623,152 @@ const SfxPoolItem* WW8_SwAttrIter::HasTextItem( USHORT nWhich ) const
return pRet;
}
-void SwWW8Writer::GetCurrentItems(WW8Bytes& rItems) const
+void WW8Export::GetCurrentItems(WW8Bytes& rItems) const
{
USHORT nEnd = pO ? pO->Count() : 0;
for (USHORT nI = 0; nI < nEnd; ++nI)
rItems.Insert((*pO)[nI], rItems.Count());
}
-const SfxPoolItem& WW8_SwAttrIter::GetItem(USHORT nWhich) const
+const SfxPoolItem& SwAttrIter::GetItem(USHORT nWhich) const
{
const SfxPoolItem* pRet = HasTextItem(nWhich);
return pRet ? *pRet : rNd.SwCntntNode::GetAttr(nWhich);
}
-void WW8_SwAttrIter::OutSwFmtRuby(const SwFmtRuby& rRuby, bool bStart)
+void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby )
{
- if (bStart)
- {
- String aStr(FieldString(ww::eEQ));
- aStr.APPEND_CONST_ASC("\\* jc");
- sal_Int32 nJC=0;
- sal_Char cDirective=0;
- switch(rRuby.GetAdjustment())
- {
- case 0:
- nJC = 3;
- cDirective = 'l';
- break;
- case 1:
- //defaults to 0
- break;
- case 2:
- nJC = 4;
- cDirective = 'r';
- break;
- case 3:
- nJC = 1;
- cDirective = 'd';
- break;
- case 4:
- nJC = 2;
- cDirective = 'd';
- break;
- default:
- ASSERT(!this,"Unhandled Ruby justication code");
- break;
- }
- aStr += String::CreateFromInt32(nJC);
-
- /*
- MS needs to know the name and size of the font used in the ruby item,
- but we coud have written it in a mixture of asian and western
- scripts, and each of these can be a different font and size than the
- other, so we make a guess based upon the first character of the text,
- defaulting to asian.
- */
- USHORT nRubyScript;
- if( pBreakIt->xBreak.is() )
- nRubyScript = pBreakIt->xBreak->getScriptType( rRuby.GetText(), 0);
- else
- nRubyScript = i18n::ScriptType::ASIAN;
-
- const SwTxtRuby* pRubyTxt = rRuby.GetTxtRuby();
- const SwCharFmt* pFmt = pRubyTxt ? pRubyTxt->GetCharFmt() : 0;
- String sFamilyName;
- long nHeight;
- if (pFmt)
- {
- const SvxFontItem &rFont = ItemGet<SvxFontItem>(*pFmt,
- GetWhichOfScript(RES_CHRATR_FONT,nRubyScript));
- sFamilyName = rFont.GetFamilyName();
+ String aStr( FieldString( ww::eEQ ) );
+ aStr.APPEND_CONST_ASC( "\\* jc" );
+ sal_Int32 nJC = 0;
+ sal_Char cDirective = 0;
+ switch ( rRuby.GetAdjustment() )
+ {
+ case 0:
+ nJC = 3;
+ cDirective = 'l';
+ break;
+ case 1:
+ //defaults to 0
+ break;
+ case 2:
+ nJC = 4;
+ cDirective = 'r';
+ break;
+ case 3:
+ nJC = 1;
+ cDirective = 'd';
+ break;
+ case 4:
+ nJC = 2;
+ cDirective = 'd';
+ break;
+ default:
+ ASSERT( !this,"Unhandled Ruby justication code" );
+ break;
+ }
+ aStr += String::CreateFromInt32( nJC );
- const SvxFontHeightItem &rHeight = ItemGet<SvxFontHeightItem>(*pFmt,
- GetWhichOfScript(RES_CHRATR_FONTSIZE,nRubyScript));
- nHeight = rHeight.GetHeight();
- }
- else
- {
- /*Get defaults if no formatting on ruby text*/
+ /*
+ MS needs to know the name and size of the font used in the ruby item,
+ but we coud have written it in a mixture of asian and western
+ scripts, and each of these can be a different font and size than the
+ other, so we make a guess based upon the first character of the text,
+ defaulting to asian.
+ */
+ USHORT nRubyScript;
+ if ( pBreakIt->xBreak.is() )
+ nRubyScript = pBreakIt->xBreak->getScriptType( rRuby.GetText(), 0);
+ else
+ nRubyScript = i18n::ScriptType::ASIAN;
- const SfxItemPool *pPool = rNd.GetSwAttrSet().GetPool();
- const SfxItemPool &rPool =
- pPool ? *pPool : rWrt.pDoc->GetAttrPool();
+ const SwTxtRuby* pRubyTxt = rRuby.GetTxtRuby();
+ const SwCharFmt* pFmt = pRubyTxt ? pRubyTxt->GetCharFmt() : 0;
+ String sFamilyName;
+ long nHeight;
+ if ( pFmt )
+ {
+ const SvxFontItem &rFont = ItemGet< SvxFontItem >( *pFmt,
+ GetWhichOfScript(RES_CHRATR_FONT,nRubyScript) );
+ sFamilyName = rFont.GetFamilyName();
- const SvxFontItem &rFont = DefaultItemGet<SvxFontItem>(rPool,
- GetWhichOfScript(RES_CHRATR_FONT,nRubyScript));
- sFamilyName = rFont.GetFamilyName();
+ const SvxFontHeightItem &rHeight = ItemGet< SvxFontHeightItem >( *pFmt,
+ GetWhichOfScript( RES_CHRATR_FONTSIZE, nRubyScript ) );
+ nHeight = rHeight.GetHeight();
+ }
+ else
+ {
+ /*Get defaults if no formatting on ruby text*/
- const SvxFontHeightItem &rHeight = DefaultItemGet<SvxFontHeightItem>
- (rPool, GetWhichOfScript(RES_CHRATR_FONTSIZE,nRubyScript));
- nHeight = rHeight.GetHeight();
- }
- nHeight = (nHeight + 5)/10;
-
- aStr.APPEND_CONST_ASC(" \\* \"Font:");
- aStr.Append(sFamilyName);
- aStr.APPEND_CONST_ASC("\" \\* hps");
- aStr += String::CreateFromInt32(nHeight);
- aStr.APPEND_CONST_ASC(" \\o");
- if (cDirective)
- {
- aStr.APPEND_CONST_ASC("\\a");
- aStr.Append(cDirective);
- }
- aStr.APPEND_CONST_ASC("(\\s\\up ");
+ const SfxItemPool *pPool = rNode.GetSwAttrSet().GetPool();
+ const SfxItemPool &rPool = pPool ? *pPool : m_rWW8Export.pDoc->GetAttrPool();
+ const SvxFontItem &rFont = DefaultItemGet< SvxFontItem >( rPool,
+ GetWhichOfScript( RES_CHRATR_FONT,nRubyScript ) );
+ sFamilyName = rFont.GetFamilyName();
- if( pBreakIt->xBreak.is() )
- nRubyScript = pBreakIt->xBreak->getScriptType( rNd.GetTxt(),
- *(pRubyTxt->GetStart()));
- else
- nRubyScript = i18n::ScriptType::ASIAN;
-
- const SwAttrSet& rSet = rNd.GetSwAttrSet();
- const SvxFontHeightItem &rHeightItem =
- (const SvxFontHeightItem&)rSet.Get(
- GetWhichOfScript(RES_CHRATR_FONTSIZE,nRubyScript));
- nHeight = (rHeightItem.GetHeight() + 10)/20-1;
- aStr += String::CreateFromInt32(nHeight);
- aStr += '(';
- aStr += rRuby.GetText();
- aStr.APPEND_CONST_ASC(");");
- rWrt.OutField(0, ww::eEQ, aStr,
- WRITEFIELD_START | WRITEFIELD_CMD_START);
+ const SvxFontHeightItem &rHeight = DefaultItemGet< SvxFontHeightItem >
+ ( rPool, GetWhichOfScript( RES_CHRATR_FONTSIZE, nRubyScript ) );
+ nHeight = rHeight.GetHeight();
}
- else
+ nHeight = (nHeight + 5)/10;
+
+ aStr.APPEND_CONST_ASC( " \\* \"Font:" );
+ aStr.Append( sFamilyName );
+ aStr.APPEND_CONST_ASC( "\" \\* hps" );
+ aStr += String::CreateFromInt32( nHeight );
+ aStr.APPEND_CONST_ASC( " \\o" );
+ if ( cDirective )
{
- rWrt.WriteChar(')');
- rWrt.OutField(0, ww::eEQ, aEmptyStr, WRITEFIELD_END | WRITEFIELD_CLOSE);
+ aStr.APPEND_CONST_ASC( "\\a" );
+ aStr.Append( cDirective );
}
+ aStr.APPEND_CONST_ASC( "(\\s\\up " );
+
+
+ if ( pBreakIt->xBreak.is() )
+ nRubyScript = pBreakIt->xBreak->getScriptType( rNode.GetTxt(),
+ *( pRubyTxt->GetStart() ) );
+ else
+ nRubyScript = i18n::ScriptType::ASIAN;
+
+ const SwAttrSet& rSet = rNode.GetSwAttrSet();
+ const SvxFontHeightItem &rHeightItem =
+ ( const SvxFontHeightItem& )rSet.Get(
+ GetWhichOfScript( RES_CHRATR_FONTSIZE, nRubyScript ) );
+ nHeight = (rHeightItem.GetHeight() + 10)/20-1;
+ aStr += String::CreateFromInt32(nHeight);
+ aStr += '(';
+ aStr += rRuby.GetText();
+ aStr.APPEND_CONST_ASC( ");" );
+ m_rWW8Export.OutputField( 0, ww::eEQ, aStr,
+ WRITEFIELD_START | WRITEFIELD_CMD_START );
}
-void WW8_SwAttrIter::OutSwFmtINetFmt(const SwFmtINetFmt& rINet, bool bStart)
+void WW8AttributeOutput::EndRuby()
{
- if( bStart )
- StartURL(rINet.GetValue(), rINet.GetTargetFrame());
- else
- EndURL();
+ m_rWW8Export.WriteChar( ')' );
+ m_rWW8Export.OutputField( 0, ww::eEQ, aEmptyStr, WRITEFIELD_END | WRITEFIELD_CLOSE );
}
/*#i15387# Better ideas welcome*/
-String &TruncateBookmark(String &rRet)
+String &TruncateBookmark( String &rRet )
{
- if (rRet.Len() > 40)
- rRet.Erase(40);
- ASSERT(rRet.Len() <= 40, "Word cannot have bookmarks longer than 40 chars");
+ if ( rRet.Len() > 40 )
+ rRet.Erase( 40 );
+ ASSERT( rRet.Len() <= 40, "Word cannot have bookmarks longer than 40 chars" );
return rRet;
}
-void WW8_AttrIter::StartURL(const String &rUrl, const String &rTarget)
+bool AttributeOutputBase::AnalyzeURL( const String& rUrl, const String& /*rTarget*/, String* pLinkURL, String* pMark )
{
bool bBookMarkOnly = false;
- INetURLObject aURL(rUrl);
- String sURL;
+
+ INetURLObject aURL( rUrl );
String sMark;
+ String sURL;
- if (rUrl.Len() > 1 && rUrl.GetChar(0) == INET_MARK_TOKEN)
+ if ( rUrl.Len() > 1 && rUrl.GetChar(0) == INET_MARK_TOKEN )
{
sMark = BookmarkToWriter( rUrl.Copy(1) );
@@ -825,58 +778,92 @@ void WW8_AttrIter::StartURL(const String &rUrl, const String &rTarget)
sRefType.EraseAllChars();
// i21465 Only interested in outline references
- if(sRefType.EqualsAscii( pMarkToOutline ) )
+ if ( sRefType.EqualsAscii( pMarkToOutline ) )
{
String sLink = sMark.Copy(0, nPos);
- SwImplBookmarksIter bkmkIterEnd = rWrt.maImplicitBookmarks.end();
- for (SwImplBookmarksIter aIter = rWrt.maImplicitBookmarks.begin(); aIter != bkmkIterEnd; ++aIter)
+ SwImplBookmarksIter bkmkIterEnd = GetExport().maImplicitBookmarks.end();
+ for ( SwImplBookmarksIter aIter = GetExport().maImplicitBookmarks.begin(); aIter != bkmkIterEnd; ++aIter )
{
String bkmkName = aIter->first;
- if(bkmkName == sLink)
+ if ( bkmkName == sLink )
{
- sMark = String(RTL_CONSTASCII_STRINGPARAM("_toc"));
- sMark += String::CreateFromInt32(aIter->second);
+ sMark = String( RTL_CONSTASCII_STRINGPARAM( "_toc" ) );
+ sMark += String::CreateFromInt32( aIter->second );
}
}
}
}
else
{
- sURL = aURL.GetURLNoMark(INetURLObject::DECODE_UNAMBIGUOUS);
- sMark = aURL.GetMark(INetURLObject::DECODE_UNAMBIGUOUS);
+ sURL = aURL.GetURLNoMark( INetURLObject::DECODE_UNAMBIGUOUS );
+ sMark = aURL.GetMark( INetURLObject::DECODE_UNAMBIGUOUS );
- sURL = URIHelper::simpleNormalizedMakeRelative(rWrt.GetBaseURL(),
- sURL);
}
- if (sMark.Len() && !sURL.Len())
+ if ( sMark.Len() && !sURL.Len() )
bBookMarkOnly = true;
- if (bBookMarkOnly)
- sURL = FieldString(ww::eHYPERLINK);
+
+
+ *pMark = sMark;
+ *pLinkURL = sURL;
+ return bBookMarkOnly;
+}
+
+bool WW8AttributeOutput::AnalyzeURL( const String& rUrl, const String& rTarget, String* pLinkURL, String* pMark )
+{
+ bool bBookMarkOnly = AttributeOutputBase::AnalyzeURL( rUrl, rTarget, pLinkURL, pMark );
+
+ String sURL = *pLinkURL;
+ String sMark = *pMark;
+
+ if ( sURL.Len() )
+ sURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), sURL );
+
+ if ( bBookMarkOnly )
+ sURL = FieldString( ww::eHYPERLINK );
else
{
- String sFld(FieldString(ww::eHYPERLINK));
- sFld.APPEND_CONST_ASC("\"");
- sURL.Insert(sFld, 0);
+ String sFld( FieldString( ww::eHYPERLINK ) );
+ sFld.APPEND_CONST_ASC( "\"" );
+ sURL.Insert( sFld, 0 );
sURL += '\"';
}
- if (sMark.Len())
- (( sURL.APPEND_CONST_ASC(" \\l \"") ) += sMark) += '\"';
+ if ( sMark.Len() )
+ ( ( sURL.APPEND_CONST_ASC( " \\l \"" ) ) += sMark ) += '\"';
+
+ if ( rTarget.Len() )
+ ( sURL.APPEND_CONST_ASC( " \\n " ) ) += rTarget;
+
+ *pLinkURL = sURL;
+ *pMark = sMark;
+
+ return bBookMarkOnly;
+}
+
+bool WW8AttributeOutput::StartURL( const String &rUrl, const String &rTarget )
+{
+ // hyperlinks only in WW8
+ if ( !m_rWW8Export.bWrtWW8 )
+ return false;
+
+ INetURLObject aURL( rUrl );
+ String sURL;
+ String sMark;
+
+ bool bBookMarkOnly = AnalyzeURL( rUrl, rTarget, &sURL, &sMark );
- if (rTarget.Len())
- (sURL.APPEND_CONST_ASC(" \\n ")) += rTarget;
- rWrt.OutField(0, ww::eHYPERLINK, sURL, WRITEFIELD_START | WRITEFIELD_CMD_START);
+ m_rWW8Export.OutputField( 0, ww::eHYPERLINK, sURL, WRITEFIELD_START | WRITEFIELD_CMD_START );
// write the refence to the "picture" structure
- ULONG nDataStt = rWrt.pDataStrm->Tell();
- rWrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell() );
+ ULONG nDataStt = m_rWW8Export.pDataStrm->Tell();
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell() );
// WinWord 2000 doesn't write this - so its a temp solution by W97 ?
- rWrt.WriteChar( 0x01 );
+ m_rWW8Export.WriteChar( 0x01 );
static BYTE aArr1[] = {
0x03, 0x6a, 0,0,0,0, // sprmCPicLocation
@@ -888,9 +875,9 @@ void WW8_AttrIter::StartURL(const String &rUrl, const String &rTarget)
BYTE* pDataAdr = aArr1 + 2;
Set_UInt32( pDataAdr, nDataStt );
- rWrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(), sizeof( aArr1 ), aArr1 );
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), sizeof( aArr1 ), aArr1 );
- rWrt.OutField(0, ww::eHYPERLINK, sURL, WRITEFIELD_CMD_END);
+ m_rWW8Export.OutputField( 0, ww::eHYPERLINK, sURL, WRITEFIELD_CMD_END );
// now write the picture structur
sURL = aURL.GetURLNoMark();
@@ -913,22 +900,24 @@ void WW8_AttrIter::StartURL(const String &rUrl, const String &rTarget)
0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B
};
- rWrt.pDataStrm->Write( aURLData1, sizeof(aURLData1) );
- BYTE nAnchor=0x00;
- if( sMark.Len() )
- nAnchor=0x08;
- rWrt.pDataStrm->Write( &nAnchor, 1 );
- rWrt.pDataStrm->Write( MAGIC_A, sizeof(MAGIC_A) );
- SwWW8Writer::WriteLong( *rWrt.pDataStrm, 0x00000002);
+ m_rWW8Export.pDataStrm->Write( aURLData1, sizeof( aURLData1 ) );
+ BYTE nAnchor = 0x00;
+ if ( sMark.Len() )
+ nAnchor = 0x08;
+ m_rWW8Export.pDataStrm->Write( &nAnchor, 1 );
+ m_rWW8Export.pDataStrm->Write( MAGIC_A, sizeof(MAGIC_A) );
+ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 0x00000002);
UINT32 nFlag = bBookMarkOnly ? 0 : 0x01;
- if (bAbsolute) nFlag |= 0x02;
- if( sMark.Len() ) nFlag |= 0x08;
- SwWW8Writer::WriteLong( *rWrt.pDataStrm, nFlag );
+ if ( bAbsolute )
+ nFlag |= 0x02;
+ if ( sMark.Len() )
+ nFlag |= 0x08;
+ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, nFlag );
INetProtocol eProto = aURL.GetProtocol();
- if (eProto == INET_PROT_FILE)
+ if ( eProto == INET_PROT_FILE )
{
-// version 1 (for a document)
+ // version 1 (for a document)
static BYTE __READONLY_DATA MAGIC_C[] = {
0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -943,7 +932,7 @@ void WW8_AttrIter::StartURL(const String &rUrl, const String &rTarget)
};
// save the links to files as relative
- sURL = URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), sURL );
+ sURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), sURL );
if ( sURL.EqualsAscii( "/", 0, 1 ) )
sURL = aURL.PathToFileName();
@@ -958,18 +947,18 @@ void WW8_AttrIter::StartURL(const String &rUrl, const String &rTarget)
sURL.SearchAndReplaceAll( '/', '\\' );
}
- rWrt.pDataStrm->Write( MAGIC_C, sizeof(MAGIC_C) );
- SwWW8Writer::WriteLong( *rWrt.pDataStrm, sURL.Len()+1 );
- SwWW8Writer::WriteString8( *rWrt.pDataStrm, sURL, true,
+ m_rWW8Export.pDataStrm->Write( MAGIC_C, sizeof(MAGIC_C) );
+ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, sURL.Len()+1 );
+ SwWW8Writer::WriteString8( *m_rWW8Export.pDataStrm, sURL, true,
RTL_TEXTENCODING_MS_1252 );
- rWrt.pDataStrm->Write( MAGIC_D, sizeof( MAGIC_D) );
+ m_rWW8Export.pDataStrm->Write( MAGIC_D, sizeof( MAGIC_D ) );
- SwWW8Writer::WriteLong( *rWrt.pDataStrm, 2*sURL.Len()+6);
- SwWW8Writer::WriteLong( *rWrt.pDataStrm, 2*sURL.Len());
- SwWW8Writer::WriteShort( *rWrt.pDataStrm, 3 );
- SwWW8Writer::WriteString16(*rWrt.pDataStrm, sURL, false);
+ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 2*sURL.Len() + 6 );
+ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 2*sURL.Len() );
+ SwWW8Writer::WriteShort( *m_rWW8Export.pDataStrm, 3 );
+ SwWW8Writer::WriteString16( *m_rWW8Export.pDataStrm, sURL, false );
}
- else if (eProto != INET_PROT_NOT_VALID)
+ else if ( eProto != INET_PROT_NOT_VALID )
{
// version 2 (simple url)
// an write some data to the data stream, but dont ask
@@ -981,23 +970,31 @@ void WW8_AttrIter::StartURL(const String &rUrl, const String &rTarget)
0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B
};
- rWrt.pDataStrm->Write( MAGIC_B, sizeof(MAGIC_B) );
- SwWW8Writer::WriteLong( *rWrt.pDataStrm, 2 * (sURL.Len()+1) );
- SwWW8Writer::WriteString16( *rWrt.pDataStrm, sURL, true);
+ m_rWW8Export.pDataStrm->Write( MAGIC_B, sizeof(MAGIC_B) );
+ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 2 * ( sURL.Len() + 1 ) );
+ SwWW8Writer::WriteString16( *m_rWW8Export.pDataStrm, sURL, true );
}
- if (sMark.Len())
+ if ( sMark.Len() )
{
- SwWW8Writer::WriteLong( *rWrt.pDataStrm, sMark.Len()+1 );
- SwWW8Writer::WriteString16( *rWrt.pDataStrm, sMark, true);
+ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, sMark.Len()+1 );
+ SwWW8Writer::WriteString16( *m_rWW8Export.pDataStrm, sMark, true );
}
- SwWW8Writer::WriteLong( *rWrt.pDataStrm, nDataStt,
- rWrt.pDataStrm->Tell() - nDataStt );
+ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, nDataStt,
+ m_rWW8Export.pDataStrm->Tell() - nDataStt );
+
+ return true;
}
-void WW8_AttrIter::EndURL()
+bool WW8AttributeOutput::EndURL()
{
- rWrt.OutField(0, ww::eHYPERLINK, aEmptyStr, WRITEFIELD_CLOSE);
+ // hyperlinks only in WW8
+ if ( !m_rWW8Export.bWrtWW8 )
+ return false;
+
+ m_rWW8Export.OutputField( 0, ww::eHYPERLINK, aEmptyStr, WRITEFIELD_CLOSE );
+
+ return true;
}
String BookmarkToWord(const String &rBookmark)
@@ -1014,21 +1011,21 @@ String BookmarkToWriter(const String &rBookmark)
INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_ASCII_US);
}
-void WW8_SwAttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool)
+void SwAttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool)
{
- if( rWrt.HasRefToObject( REF_SETREFATTR, &rAttr.GetRefName(), 0 ))
- rWrt.AppendBookmark( rWrt.GetBookmarkName( REF_SETREFATTR,
+ if ( m_rExport.HasRefToObject( REF_SETREFATTR, &rAttr.GetRefName(), 0 ) )
+ m_rExport.AppendBookmark( m_rExport.GetBookmarkName( REF_SETREFATTR,
&rAttr.GetRefName(), 0 ));
}
-void WW8_SwAttrIter::FieldVanish( const String& rTxt )
+void WW8AttributeOutput::FieldVanish( const String& rTxt, ww::eField /*eType*/ )
{
WW8Bytes aItems;
- rWrt.GetCurrentItems(aItems);
+ m_rWW8Export.GetCurrentItems( aItems );
// sprmCFFldVanish
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( aItems, 0x802 );
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CFFldVanish );
else
aItems.Insert( 67, aItems.Count() );
aItems.Insert( 1, aItems.Count() );
@@ -1036,152 +1033,153 @@ void WW8_SwAttrIter::FieldVanish( const String& rTxt )
USHORT nStt_sprmCFSpec = aItems.Count();
// sprmCFSpec -- fSpec-Attribut true
- if( rWrt.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
SwWW8Writer::InsUInt16( aItems, 0x855 );
else
aItems.Insert( 117, aItems.Count() );
aItems.Insert( 1, aItems.Count() );
- rWrt.WriteChar( '\x13' );
- rWrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(), aItems.Count(),
+ m_rWW8Export.WriteChar( '\x13' );
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), aItems.Count(),
aItems.GetData() );
- rWrt.OutSwString( rTxt, 0, rTxt.Len(), rWrt.IsUnicode(),
+ m_rWW8Export.OutSwString( rTxt, 0, rTxt.Len(), m_rWW8Export.IsUnicode(),
RTL_TEXTENCODING_MS_1252 );
- rWrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(), nStt_sprmCFSpec,
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), nStt_sprmCFSpec,
aItems.GetData() );
- rWrt.WriteChar( '\x15' );
- rWrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(), aItems.Count(),
+ m_rWW8Export.WriteChar( '\x15' );
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), aItems.Count(),
aItems.GetData() );
}
-void WW8_SwAttrIter::OutSwTOXMark(const SwTOXMark& rAttr,
- bool
-#ifdef DBG_UTIL
- bStart
-#endif
- )
+void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAttr )
{
// its a field; so get the Text form the Node and build the field
-#ifdef DBG_UTIL
- ASSERT( bStart, "calls only with the startposition!" );
-#endif
String sTxt;
+ ww::eField eType = ww::eNONE;
const SwTxtTOXMark& rTxtTOXMark = *rAttr.GetTxtTOXMark();
const xub_StrLen* pTxtEnd = rTxtTOXMark.GetEnd();
- if( pTxtEnd ) // has range?
- sTxt = rNd.GetExpandTxt( *rTxtTOXMark.GetStart(),
- *pTxtEnd - *rTxtTOXMark.GetStart() );
+ if ( pTxtEnd ) // has range?
+ {
+ sTxt = rNode.GetExpandTxt( *rTxtTOXMark.GetStart(),
+ *pTxtEnd - *rTxtTOXMark.GetStart() );
+ }
else
sTxt = rAttr.GetAlternativeText();
- switch( rAttr.GetTOXType()->GetType() )
+ switch ( rAttr.GetTOXType()->GetType() )
{
- case TOX_INDEX:
- if( rAttr.GetPrimaryKey().Len() )
- {
- sTxt.Insert( ':', 0 );
- sTxt.Insert( rAttr.GetPrimaryKey(), 0 );
- }
- sTxt.InsertAscii( " XE \"", 0 );
- sTxt.InsertAscii( "\" " );
- break;
+ case TOX_INDEX:
+ eType = ww::eXE;
+ if ( rAttr.GetPrimaryKey().Len() )
+ {
+ if ( rAttr.GetSecondaryKey().Len() )
+ {
+ sTxt.Insert( ':', 0 );
+ sTxt.Insert( rAttr.GetSecondaryKey(), 0 );
+ }
- case TOX_USER:
- ( sTxt.APPEND_CONST_ASC( "\" \\f \"" ))
- += (sal_Char)( 'A' + rWrt.GetId( *rAttr.GetTOXType() ));
- // kein break;
- case TOX_CONTENT:
- {
- sTxt.InsertAscii( " TC \"", 0 );
- USHORT nLvl = rAttr.GetLevel();
- if (nLvl > WW8ListManager::nMaxLevel)
- nLvl = WW8ListManager::nMaxLevel;
+ sTxt.Insert( ':', 0 );
+ sTxt.Insert( rAttr.GetPrimaryKey(), 0 );
+ }
+ sTxt.InsertAscii( " XE \"", 0 );
+ sTxt.InsertAscii( "\" " );
+ break;
- ((sTxt.APPEND_CONST_ASC( "\" \\l " ))
- += String::CreateFromInt32( nLvl )) += ' ';
- }
- break;
- default:
- ASSERT(!this, "Unhandled option for toc export");
- break;
+ case TOX_USER:
+ ( sTxt.APPEND_CONST_ASC( "\" \\f \"" ) )
+ += (sal_Char)( 'A' + GetExport( ).GetId( *rAttr.GetTOXType() ) );
+ // fall through - no break;
+ case TOX_CONTENT:
+ {
+ eType = ww::eTC;
+ sTxt.InsertAscii( " TC \"", 0 );
+ USHORT nLvl = rAttr.GetLevel();
+ if (nLvl > WW8ListManager::nMaxLevel)
+ nLvl = WW8ListManager::nMaxLevel;
+
+ ((sTxt.APPEND_CONST_ASC( "\" \\l " ))
+ += String::CreateFromInt32( nLvl )) += ' ';
+ }
+ break;
+ default:
+ ASSERT( !this, "Unhandled option for toc export" );
+ break;
}
- if( sTxt.Len() )
- FieldVanish( sTxt );
+ if ( sTxt.Len() )
+ FieldVanish( sTxt, eType );
}
-int WW8_SwAttrIter::OutAttrWithRange(xub_StrLen nPos)
+int SwAttrIter::OutAttrWithRange(xub_StrLen nPos)
{
int nRet = 0;
- if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
+ if ( const SwpHints* pTxtAttrs = rNd.GetpSwpHints() )
{
- rWrt.push_charpropstart(nPos);
+ m_rExport.m_aCurrentCharPropStarts.push( nPos );
const xub_StrLen* pEnd;
- for (USHORT i = 0; i < pTxtAttrs->Count(); ++i )
+ for ( USHORT i = 0; i < pTxtAttrs->Count(); ++i )
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
const SfxPoolItem* pItem = &pHt->GetAttr();
- switch( pItem->Which() )
+ switch ( pItem->Which() )
{
- case RES_TXTATR_INETFMT:
- if( rWrt.bWrtWW8 ) // nur WW8 kann Hyperlinks
- {
- if( nPos == *pHt->GetStart() )
+ case RES_TXTATR_INETFMT:
+ if ( nPos == *pHt->GetStart() )
+ {
+ const SwFmtINetFmt *rINet = static_cast< const SwFmtINetFmt* >( pItem );
+ if ( m_rExport.AttrOutput().StartURL( rINet->GetValue(), rINet->GetTargetFrame() ) )
+ ++nRet;
+ }
+ if ( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
+ {
+ if ( m_rExport.AttrOutput().EndURL() )
+ --nRet;
+ }
+ break;
+ case RES_TXTATR_REFMARK:
+ if ( nPos == *pHt->GetStart() )
{
- OutSwFmtINetFmt((SwFmtINetFmt&)*pItem, true);
+ OutSwFmtRefMark( *static_cast< const SwFmtRefMark* >( pItem ), true );
++nRet;
}
- if( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
+ if ( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
{
- OutSwFmtINetFmt((SwFmtINetFmt&)*pItem, false);
+ OutSwFmtRefMark( *static_cast< const SwFmtRefMark* >( pItem ), false );
--nRet;
}
- }
- break;
- case RES_TXTATR_REFMARK:
- if( nPos == *pHt->GetStart() )
- {
- OutSwFmtRefMark((SwFmtRefMark&)*pItem, true);
- ++nRet;
- }
- if( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
- {
- OutSwFmtRefMark((SwFmtRefMark&)*pItem, false);
- --nRet;
- }
- break;
- case RES_TXTATR_TOXMARK:
- if (nPos == *pHt->GetStart())
- OutSwTOXMark((SwTOXMark&)*pItem, true);
- break;
- case RES_TXTATR_CJK_RUBY:
- if( nPos == *pHt->GetStart() )
- {
- OutSwFmtRuby((SwFmtRuby&)*pItem, true);
- ++nRet;
- }
- if( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
- {
- OutSwFmtRuby((SwFmtRuby&)*pItem, false);
- --nRet;
- }
- break;
+ break;
+ case RES_TXTATR_TOXMARK:
+ if ( nPos == *pHt->GetStart() )
+ m_rExport.AttrOutput().TOXMark( rNd, *static_cast< const SwTOXMark* >( pItem ) );
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ if ( nPos == *pHt->GetStart() )
+ {
+ m_rExport.AttrOutput().StartRuby( rNd, *static_cast< const SwFmtRuby* >( pItem ) );
+ ++nRet;
+ }
+ if ( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
+ {
+ m_rExport.AttrOutput().EndRuby();
+ --nRet;
+ }
+ break;
}
}
- rWrt.pop_charpropstart();//HasTextItem nur in dem obigen Bereich erlaubt
+ m_rExport.m_aCurrentCharPropStarts.pop(); // HasTextItem nur in dem obigen Bereich erlaubt
}
return nRet;
}
-bool WW8_SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
+bool SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
{
bool bRet = false;
// search next Redline
for( USHORT nPos = nCurRedlinePos;
- nPos < rWrt.pDoc->GetRedlineTbl().Count(); ++nPos )
+ nPos < m_rExport.pDoc->GetRedlineTbl().Count(); ++nPos )
{
- const SwPosition* pEnd = rWrt.pDoc->GetRedlineTbl()[ nPos ]->End();
+ const SwPosition* pEnd = m_rExport.pDoc->GetRedlineTbl()[ nPos ]->End();
if( pEnd->nNode == rNd )
{
if( pEnd->nContent.GetIndex() == nEnd )
@@ -1196,7 +1194,7 @@ bool WW8_SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
return bRet;
}
-void WW8_SwAttrIter::OutRedlines( xub_StrLen nPos )
+const SwRedlineData* SwAttrIter::GetRedline( xub_StrLen nPos )
{
if( pCurRedline )
{
@@ -1208,17 +1206,19 @@ void WW8_SwAttrIter::OutRedlines( xub_StrLen nPos )
++nCurRedlinePos;
}
else
+ {
// write data of current redline
- rWrt.OutRedline( pCurRedline->GetRedlineData() );
+ return &( pCurRedline->GetRedlineData() );
+ }
}
if( !pCurRedline )
{
// search next Redline
- for( ; nCurRedlinePos < rWrt.pDoc->GetRedlineTbl().Count();
+ for( ; nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().Count();
++nCurRedlinePos )
{
- const SwRedline* pRedl = rWrt.pDoc->GetRedlineTbl()[ nCurRedlinePos ];
+ const SwRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nCurRedlinePos ];
const SwPosition* pStt = pRedl->Start();
const SwPosition* pEnd = pStt == pRedl->GetPoint()
@@ -1233,7 +1233,7 @@ void WW8_SwAttrIter::OutRedlines( xub_StrLen nPos )
{
// write data of this redline
pCurRedline = pRedl;
- rWrt.OutRedline( pCurRedline->GetRedlineData() );
+ return &( pCurRedline->GetRedlineData() );
}
break;
}
@@ -1249,34 +1249,62 @@ void WW8_SwAttrIter::OutRedlines( xub_StrLen nPos )
}
}
}
+ return NULL;
}
/* */
-short SwWW8Writer::GetCurrentPageDirection() const
+short MSWordExportBase::GetCurrentPageDirection() const
{
const SwFrmFmt &rFmt = pAktPageDesc
? pAktPageDesc->GetMaster()
- : const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetMaster();
+ : const_cast<const SwDoc *>( pDoc )->GetPageDesc( 0 ).GetMaster();
return rFmt.GetFrmDir().GetValue();
}
-short SwWW8Writer::TrueFrameDirection(const SwFrmFmt &rFlyFmt) const
+short MSWordExportBase::GetDefaultFrameDirection( ) const
+{
+ short nDir = FRMDIR_ENVIRONMENT;
+
+ if ( bOutPageDescs )
+ nDir = GetCurrentPageDirection( );
+ else if ( pOutFmtNode )
+ {
+ if ( bOutFlyFrmAttrs ) //frame
+ {
+ nDir = TrueFrameDirection( *( const SwFrmFmt * ) pOutFmtNode );
+ }
+ else if ( pOutFmtNode->ISA( SwCntntNode ) ) //pagagraph
+ {
+ const SwCntntNode *pNd = ( const SwCntntNode * ) pOutFmtNode;
+ SwPosition aPos( *pNd );
+ nDir = pDoc->GetTextDirection( aPos );
+ }
+ else if ( pOutFmtNode->ISA( SwTxtFmtColl ) )
+ nDir = FRMDIR_HORI_LEFT_TOP; //what else can we do :-(
+ }
+
+ if ( nDir == FRMDIR_ENVIRONMENT )
+ nDir = FRMDIR_HORI_LEFT_TOP; //Set something
+
+ return nDir;
+}
+
+short MSWordExportBase::TrueFrameDirection( const SwFrmFmt &rFlyFmt ) const
{
const SwFrmFmt *pFlyFmt = &rFlyFmt;
const SvxFrameDirectionItem* pItem = 0;
- while (pFlyFmt)
+ while ( pFlyFmt )
{
pItem = &pFlyFmt->GetFrmDir();
- if (FRMDIR_ENVIRONMENT == pItem->GetValue())
+ if ( FRMDIR_ENVIRONMENT == pItem->GetValue() )
{
pItem = 0;
const SwFmtAnchor* pAnchor = &pFlyFmt->GetAnchor();
- if (FLY_PAGE != pAnchor->GetAnchorId() &&
- pAnchor->GetCntntAnchor())
+ if ( FLY_PAGE != pAnchor->GetAnchorId() &&
+ pAnchor->GetCntntAnchor() )
{
- pFlyFmt =
- pAnchor->GetCntntAnchor()->nNode.GetNode().GetFlyFmt();
+ pFlyFmt = pAnchor->GetCntntAnchor()->nNode.GetNode().GetFlyFmt();
}
else
pFlyFmt = 0;
@@ -1286,16 +1314,16 @@ short SwWW8Writer::TrueFrameDirection(const SwFrmFmt &rFlyFmt) const
}
short nRet;
- if (pItem)
+ if ( pItem )
nRet = pItem->GetValue();
else
nRet = GetCurrentPageDirection();
- ASSERT(nRet != FRMDIR_ENVIRONMENT, "leaving with environment direction");
+ ASSERT( nRet != FRMDIR_ENVIRONMENT, "leaving with environment direction" );
return nRet;
}
-const SvxBrushItem* SwWW8Writer::GetCurrentPageBgBrush() const
+const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const
{
const SwFrmFmt &rFmt = pAktPageDesc
? pAktPageDesc->GetMaster()
@@ -1314,7 +1342,7 @@ const SvxBrushItem* SwWW8Writer::GetCurrentPageBgBrush() const
return pRet;
}
-SvxBrushItem SwWW8Writer::TrueFrameBgBrush(const SwFrmFmt &rFlyFmt) const
+SvxBrushItem WW8Export::TrueFrameBgBrush(const SwFrmFmt &rFlyFmt) const
{
const SwFrmFmt *pFlyFmt = &rFlyFmt;
const SvxBrushItem* pRet = 0;
@@ -1361,7 +1389,7 @@ Convert characters that need to be converted, the basic replacements and the
ridicously complicated title case attribute mapping to hardcoded upper case
because word doesn't have the feature
*/
-String WW8_SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
+String SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
xub_StrLen nLen) const
{
String aSnippet(rStr, nAktPos, nLen);
@@ -1375,7 +1403,7 @@ String WW8_SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
aSnippet.SearchAndReplaceAll(CHAR_HARDHYPHEN, 0x1e);
aSnippet.SearchAndReplaceAll(CHAR_SOFTHYPHEN, 0x1f);
- rWrt.push_charpropstart(nAktPos);
+ m_rExport.m_aCurrentCharPropStarts.push( nAktPos );
const SfxPoolItem &rItem = GetItem(RES_CHRATR_CASEMAP);
if (SVX_CASEMAP_TITEL == ((const SvxCaseMapItem&)rItem).GetValue())
@@ -1414,7 +1442,7 @@ String WW8_SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
aSnippet.SetChar(0, rStr.GetChar(nAktPos));
}
}
- rWrt.pop_charpropstart();
+ m_rExport.m_aCurrentCharPropStarts.pop();
return aSnippet;
}
@@ -1425,14 +1453,13 @@ String WW8_SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
the track changes have to be analysed. A deletion, starting in paragraph A
with style A, ending in paragraph B with style B, needs a hack.
*/
-
-SwTxtFmtColl& lcl_getFormatCollection( Writer& rWrt, SwTxtNode* pTxtNode )
+static SwTxtFmtColl& lcl_getFormatCollection( MSWordExportBase& rExport, const SwTxtNode* pTxtNode )
{
USHORT nPos = 0;
- USHORT nMax = rWrt.pDoc->GetRedlineTbl().Count();
+ USHORT nMax = rExport.pDoc->GetRedlineTbl().Count();
while( nPos < nMax )
{
- const SwRedline* pRedl = rWrt.pDoc->GetRedlineTbl()[ nPos++ ];
+ const SwRedline* pRedl = rExport.pDoc->GetRedlineTbl()[ nPos++ ];
const SwPosition* pStt = pRedl->Start();
const SwPosition* pEnd = pStt == pRedl->GetPoint()
? pRedl->GetMark()
@@ -1450,47 +1477,162 @@ SwTxtFmtColl& lcl_getFormatCollection( Writer& rWrt, SwTxtNode* pTxtNode )
return static_cast<SwTxtFmtColl&>( pTxtNode->GetAnyFmtColl() );
}
-Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
+void WW8AttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rSwFmtDrop, USHORT nStyle,
+ ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner )
{
+ short nDropLines = rSwFmtDrop.GetLines();
+ short nDistance = rSwFmtDrop.GetDistance();
+ int rFontHeight, rDropHeight, rDropDescent;
+
+ SVBT16 nSty;
+ ShortToSVBT16( nStyle, nSty );
+ m_rWW8Export.pO->Insert( (BYTE*)&nSty, 2, m_rWW8Export.pO->Count() ); // Style #
+
+ if ( m_rWW8Export.bWrtWW8 )
+ {
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PPc ); // Alignment (sprmPPc)
+ m_rWW8Export.pO->Insert( 0x20, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PWr ); // Wrapping (sprmPWr)
+ m_rWW8Export.pO->Insert( 0x02, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDcs ); // Dropcap (sprmPDcs)
+ int nDCS = ( nDropLines << 3 ) | 0x01;
+ m_rWW8Export.InsUInt16( static_cast< UINT16 >( nDCS ) );
+
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDxaFromText ); // Distance from text (sprmPDxaFromText)
+ m_rWW8Export.InsUInt16( nDistance );
+
+ if ( rNode.GetDropSize( rFontHeight, rDropHeight, rDropDescent ) )
+ {
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDyaLine ); // Line spacing
+ m_rWW8Export.InsUInt16( static_cast< UINT16 >( -rDropHeight ) );
+ m_rWW8Export.InsUInt16( 0 );
+ }
+ }
+ else
+ {
+ m_rWW8Export.pO->Insert( 29, m_rWW8Export.pO->Count() ); // Alignment (sprmPPc)
+ m_rWW8Export.pO->Insert( 0x20, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.pO->Insert( 37, m_rWW8Export.pO->Count() ); // Wrapping (sprmPWr)
+ m_rWW8Export.pO->Insert( 0x02, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.pO->Insert( 46, m_rWW8Export.pO->Count() ); // Dropcap (sprmPDcs)
+ int nDCS = ( nDropLines << 3 ) | 0x01;
+ m_rWW8Export.InsUInt16( static_cast< UINT16 >( nDCS ) );
+
+ m_rWW8Export.pO->Insert( 49, m_rWW8Export.pO->Count() ); // Distance from text (sprmPDxaFromText)
+ m_rWW8Export.InsUInt16( nDistance );
+
+ if (rNode.GetDropSize(rFontHeight, rDropHeight, rDropDescent))
+ {
+ m_rWW8Export.pO->Insert( 20, m_rWW8Export.pO->Count() ); // Line spacing
+ m_rWW8Export.InsUInt16( static_cast< UINT16 >( -rDropHeight ) );
+ m_rWW8Export.InsUInt16( 0 );
+ }
+ }
+
+ m_rWW8Export.WriteCR( pTextNodeInfoInner );
+
+ if ( pTextNodeInfo.get() != NULL )
+ {
#ifdef DEBUG
- ::std::clog << "<OutWW8_SwTxtNode>" << ::std::endl;
+ ::std::clog << pTextNodeInfo->toString() << ::std::endl;
#endif
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- SwTxtNode* pNd = &((SwTxtNode&)rNode);
+ TableInfoCell( pTextNodeInfoInner );
+ }
- bool bFlyInTable = rWW8Wrt.mpParentFrame && rWW8Wrt.bIsInTable;
+ m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(), m_rWW8Export.pO->GetData() );
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() );
- // akt. Style
- if( !bFlyInTable )
+ if ( rNode.GetDropSize( rFontHeight, rDropHeight, rDropDescent ) )
{
- rWW8Wrt.nStyleBeforeFly
- = rWW8Wrt.GetId( lcl_getFormatCollection( rWrt, pNd ) );
+ if ( m_rWW8Export.bWrtWW8 )
+ {
+ const SwCharFmt *pSwCharFmt = rSwFmtDrop.GetCharFmt();
+ if ( pSwCharFmt )
+ {
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CIstd );
+ m_rWW8Export.InsUInt16( m_rWW8Export.GetId( *pSwCharFmt ) );
+ }
+
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CHpsPos ); // Lower the chars
+ m_rWW8Export.InsUInt16( static_cast< UINT16 >( -((nDropLines - 1)*rDropDescent) / 10 ) );
+
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CHps ); // Font Size
+ m_rWW8Export.InsUInt16( static_cast< UINT16 >( rFontHeight / 10 ) );
+ }
+ else
+ {
+ const SwCharFmt *pSwCharFmt = rSwFmtDrop.GetCharFmt();
+ if ( pSwCharFmt )
+ {
+ m_rWW8Export.InsUInt16( 80 );
+ m_rWW8Export.InsUInt16( m_rWW8Export.GetId( *pSwCharFmt ) );
+ }
+
+ m_rWW8Export.pO->Insert( 101, m_rWW8Export.pO->Count() ); // Lower the chars
+ m_rWW8Export.InsUInt16( static_cast< UINT16 >( -((nDropLines - 1)*rDropDescent) / 10 ) );
+
+ m_rWW8Export.pO->Insert( 99, m_rWW8Export.pO->Count() ); // Font Size
+ m_rWW8Export.InsUInt16( static_cast< UINT16 >( rFontHeight / 10 ) );
+ }
}
- SVBT16 nSty;
- ShortToSVBT16( rWW8Wrt.nStyleBeforeFly, nSty );
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(), m_rWW8Export.pO->GetData() );
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() );
+}
+
+xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode& /*rNode*/, xub_StrLen /*nAktPos*/ )
+{
+ return aAttrIter->WhereNext();
+}
+
+void MSWordExportBase::UpdatePosition( SwAttrIter* aAttrIter, xub_StrLen /*nAktPos*/, xub_StrLen /*nEnd*/ )
+{
+ aAttrIter->NextPos();
+}
+
+void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
+{
+#ifdef DEBUG
+ ::std::clog << "<OutWW8_SwTxtNode>" << ::std::endl;
+#endif
- WW8Bytes* pO = rWW8Wrt.pO;
- WW8_SwAttrIter aAttrIter( rWW8Wrt, *pNd );
+ ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo( mpTableInfo->getTableNodeInfo( &rNode ) );
+
+ AttrOutput().StartParagraph( pTextNodeInfo );
+
+ bool bFlyInTable = mpParentFrame && bIsInTable;
+
+ if ( !bFlyInTable )
+ nStyleBeforeFly = GetId( lcl_getFormatCollection( *this, &rNode ) );
+
+ // nStyleBeforeFly may change when we recurse into another node, so we
+ // have to remember it in nStyle
+ USHORT nStyle = nStyleBeforeFly;
+
+ SwAttrIter aAttrIter( *this, rNode );
rtl_TextEncoding eChrSet = aAttrIter.GetCharSet();
- if( rWW8Wrt.bStartTOX )
+ if ( bStartTOX )
{
// ignore TOX header section
const SwSectionNode* pSectNd = rNode.FindSectionNode();
- if( TOX_CONTENT_SECTION == pSectNd->GetSection().GetType() )
+ if ( pSectNd && TOX_CONTENT_SECTION == pSectNd->GetSection().GetType() )
{
- rWW8Wrt.StartTOX( pSectNd->GetSection() );
- rWW8Wrt.push_charpropstart(0);
+ AttrOutput().StartTOX( pSectNd->GetSection() );
+ m_aCurrentCharPropStarts.push( 0 );
}
}
const SwSection* pTOXSect = 0;
- if( rWW8Wrt.bInWriteTOX )
+ if( bInWriteTOX )
{
// check for end of TOX
- SwNodeIndex aIdx( *pNd, 1 );
+ SwNodeIndex aIdx( rNode, 1 );
if( !aIdx.GetNode().IsTxtNode() )
{
const SwSectionNode* pTOXSectNd = rNode.FindSectionNode();
@@ -1502,349 +1644,221 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
}
}
- if (aAttrIter.RequiresImplicitBookmark())
+ if ( aAttrIter.RequiresImplicitBookmark() )
{
- String sBkmkName = String(RTL_CONSTASCII_STRINGPARAM("_toc"));
- sBkmkName += String::CreateFromInt32(pNd->GetIndex());
- rWW8Wrt.AddBookmark(sBkmkName);
+ String sBkmkName = String( RTL_CONSTASCII_STRINGPARAM( "_toc" ) );
+ sBkmkName += String::CreateFromInt32( rNode.GetIndex() );
+ AppendWordBookmark( sBkmkName );
}
- ASSERT( !pO->Count(), " pO ist am Zeilenanfang nicht leer" );
+ //Would need to move into WW8Export, probably not worth it
+ //ASSERT( pO->Count(), " pO ist am Zeilenanfang nicht leer" );
- String aStr( pNd->GetTxt() );
-
- ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo(rWW8Wrt.mpTableInfo->getTableNodeInfo(pNd));
- ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner;
-
- if (pTextNodeInfo.get() != NULL)
- pTextNodeInfoInner = pTextNodeInfo->getFirstInner();
+ String aStr( rNode.GetTxt() );
xub_StrLen nAktPos = 0;
xub_StrLen nEnd = aStr.Len();
- bool bUnicode = rWW8Wrt.bWrtWW8, bRedlineAtEnd = false;
+ bool bRedlineAtEnd = false;
int nOpenAttrWithRange = 0;
+ ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner;
+ if ( pTextNodeInfo.get() != NULL )
+ pTextNodeInfoInner = pTextNodeInfo->getFirstInner();
+
do {
- xub_StrLen nNextAttr = aAttrIter.WhereNext();
+ const SwRedlineData* pRedlineData = aAttrIter.GetRedline( nAktPos );
+
+ AttrOutput().StartRun( pRedlineData );
+
+ xub_StrLen nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
if( nNextAttr > nEnd )
nNextAttr = nEnd;
- aAttrIter.OutFlys(nAktPos);
+ aAttrIter.OutFlys( nAktPos );
//Append bookmarks in this range after flys, exclusive of final
//position of this range
- rWW8Wrt.AppendBookmarks( *pNd, nAktPos, nNextAttr - nAktPos );
+ AppendBookmarks( rNode, nAktPos, nNextAttr - nAktPos );
bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
nOpenAttrWithRange += aAttrIter.OutAttrWithRange(nAktPos);
xub_StrLen nLen = nNextAttr - nAktPos;
- if (!bTxtAtr && nLen)
- {
- sal_Unicode ch=aStr.GetChar(nAktPos);
- int ofs=(ch==CH_TXT_ATR_FIELDSTART || ch==CH_TXT_ATR_FIELDEND || ch==CH_TXT_ATR_FORMELEMENT?1:0);
- IDocumentMarkAccess* const pMarkAccess = rWW8Wrt.pDoc->getIDocumentMarkAccess();
- if(ch==CH_TXT_ATR_FIELDSTART)
- {
- SwPosition aPosition(*pNd, SwIndex((SwTxtNode*)pNd, nAktPos+1));
- ::sw::mark::IFieldmark const * const pFieldmark=pMarkAccess->getFieldmarkFor(aPosition);
- OSL_ENSURE(pFieldmark,
- "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??");
- if(pFieldmark)
- rWW8Wrt.AppendBookmark(pFieldmark->GetName(), 1);
- rWW8Wrt.OutField(NULL, ww::eFORMTEXT, String::CreateFromAscii(" FORMTEXT "), WRITEFIELD_START | WRITEFIELD_CMD_START);
- if(pFieldmark)
- rWW8Wrt.WriteFormData(*pFieldmark);
- rWW8Wrt.OutField(NULL, ww::eFORMTEXT, String(), WRITEFIELD_CMD_END);
- }
- else if (ch==CH_TXT_ATR_FIELDEND)
- {
- SwPosition aPosition(*pNd, SwIndex((SwTxtNode*)pNd, nAktPos));
- ::sw::mark::IFieldmark const * const pFieldmark=pMarkAccess->getFieldmarkFor(aPosition);
- OSL_ENSURE(pFieldmark,
- "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??");
- rWW8Wrt.OutField(NULL, ww::eFORMTEXT, String(), WRITEFIELD_CLOSE);
- if (pFieldmark)
- rWW8Wrt.AppendBookmark(pFieldmark->GetName(), 0);
- }
- else if (ch==CH_TXT_ATR_FORMELEMENT)
- {
- SwPosition aPosition(*pNd, SwIndex((SwTxtNode*)pNd, nAktPos));
- ::sw::mark::IFieldmark const * const pFieldmark=pMarkAccess->getFieldmarkFor(aPosition);
- OSL_ENSURE(pFieldmark,
- "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??");
- if(pFieldmark)
- rWW8Wrt.AppendBookmark(pFieldmark->GetName(), 1);
- rWW8Wrt.OutField(NULL, ww::eFORMCHECKBOX, String::CreateFromAscii(" FORMCHECKBOX "), WRITEFIELD_START | WRITEFIELD_CMD_START);
- if(pFieldmark)
- rWW8Wrt.WriteFormData(*pFieldmark);
- rWW8Wrt.OutField(NULL, ww::eFORMCHECKBOX, String(), WRITEFIELD_CMD_END | WRITEFIELD_CLOSE);
- if(pFieldmark)
- rWW8Wrt.AppendBookmark(pFieldmark->GetName(), 0);
- }
- nLen-=static_cast<USHORT>(ofs);
- String aSnippet(aAttrIter.GetSnippet(aStr, nAktPos+static_cast<USHORT>(ofs), nLen));
- if ((rWW8Wrt.nTxtTyp == TXT_EDN || rWW8Wrt.nTxtTyp == TXT_FTN) && nAktPos ==0 && nLen>0)
- {
- // Insert tab for aesthetic puposes #i24762#
- if (aSnippet.GetChar(0) != 0x09)
- {
- nLen++;
- aSnippet.Insert(0x09,0);
- }
- }
- rWW8Wrt.OutSwString(aSnippet, 0, nLen, bUnicode, eChrSet);
- }
-
- if (aAttrIter.IsDropCap(nNextAttr))
+ if ( !bTxtAtr && nLen )
{
+ sal_Unicode ch = aStr.GetChar( nAktPos );
+ int ofs = ( ch == CH_TXT_ATR_FIELDSTART || ch == CH_TXT_ATR_FIELDEND || ch == CH_TXT_ATR_FORMELEMENT? 1: 0 );
- const SwFmtDrop &rSwFmtDrop = aAttrIter.GetSwFmtDrop();
- short nDropLines = rSwFmtDrop.GetLines();
- short nDistance = rSwFmtDrop.GetDistance();
- int rFontHeight, rDropHeight, rDropDescent;
-
- pO->Insert( (BYTE*)&nSty, 2, pO->Count() ); // Style #
-
- if (rWW8Wrt.bWrtWW8)
+ IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ if ( ch == CH_TXT_ATR_FIELDSTART )
{
- rWW8Wrt.InsUInt16( 0x261b ); // Alignment (sprmPPc)
- rWW8Wrt.pO->Insert( 0x20, rWW8Wrt.pO->Count() );
-
- rWW8Wrt.InsUInt16( 0x2423 ); // Wrapping (sprmPWr)
- rWW8Wrt.pO->Insert( 0x02, rWW8Wrt.pO->Count() );
-
- rWW8Wrt.InsUInt16( 0x442c ); // Dropcap (sprmPDcs)
- int nDCS = (nDropLines << 3) | 0x01;
- rWW8Wrt.InsUInt16( static_cast< UINT16 >(nDCS) );
-
- rWW8Wrt.InsUInt16( 0x842F ); // Distance from text (sprmPDxaFromText)
- rWW8Wrt.InsUInt16( nDistance );
-
- if (pNd->GetDropSize(rFontHeight, rDropHeight, rDropDescent))
- {
- rWW8Wrt.InsUInt16( 0x6412 ); // Line spacing
- rWW8Wrt.InsUInt16( static_cast< UINT16 >(-rDropHeight) );
- rWW8Wrt.InsUInt16( 0 );
- }
+ SwPosition aPosition( rNode, SwIndex( const_cast< SwTxtNode* >( &rNode ), nAktPos + 1 ) );
+ ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
+ OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
+
+ if ( pFieldmark )
+ AppendBookmark( pFieldmark->GetName(), true );
+ OutputField( NULL, ww::eFORMTEXT, String::CreateFromAscii( " FORMTEXT " ), WRITEFIELD_START | WRITEFIELD_CMD_START );
+ if ( pFieldmark )
+ WriteFormData( *pFieldmark );
+ OutputField( NULL, ww::eFORMTEXT, String(), WRITEFIELD_CMD_END );
}
- else
+ else if ( ch == CH_TXT_ATR_FIELDEND )
{
- rWW8Wrt.pO->Insert( 29, rWW8Wrt.pO->Count() ); // Alignment (sprmPPc)
- rWW8Wrt.pO->Insert( 0x20, rWW8Wrt.pO->Count() );
+ SwPosition aPosition( rNode, SwIndex( const_cast< SwTxtNode* >( &rNode ), nAktPos ) );
+ ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
+ OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
- rWW8Wrt.pO->Insert( 37, rWW8Wrt.pO->Count() ); // Wrapping (sprmPWr)
- rWW8Wrt.pO->Insert( 0x02, rWW8Wrt.pO->Count() );
-
- rWW8Wrt.pO->Insert( 46, rWW8Wrt.pO->Count() ); // Dropcap (sprmPDcs)
- int nDCS = (nDropLines << 3) | 0x01;
- rWW8Wrt.InsUInt16( static_cast< UINT16 >(nDCS) );
-
- rWW8Wrt.pO->Insert( 49, rWW8Wrt.pO->Count() ); // Distance from text (sprmPDxaFromText)
- rWW8Wrt.InsUInt16( nDistance );
-
- if (pNd->GetDropSize(rFontHeight, rDropHeight, rDropDescent))
- {
- rWW8Wrt.pO->Insert( 20, rWW8Wrt.pO->Count() ); // Line spacing
- rWW8Wrt.InsUInt16( static_cast< UINT16 >(-rDropHeight) );
- rWW8Wrt.InsUInt16( 0 );
- }
+ OutputField( NULL, ww::eFORMTEXT, String(), WRITEFIELD_CLOSE );
+ if ( pFieldmark )
+ AppendBookmark( pFieldmark->GetName(), false );
}
-
- rWW8Wrt.WriteCR(pTextNodeInfoInner);
-
- if (pTextNodeInfo.get() != NULL)
+ else if ( ch == CH_TXT_ATR_FORMELEMENT )
{
-#ifdef DEBUG
- ::std::clog << pTextNodeInfo->toString() << ::std::endl;
-#endif
-
- rWW8Wrt.OutWW8TableInfoCell(pTextNodeInfoInner);
+ SwPosition aPosition( rNode, SwIndex( const_cast< SwTxtNode* >( &rNode ), nAktPos ) );
+ ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
+ OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
+
+ if ( pFieldmark )
+ AppendBookmark( pFieldmark->GetName(), true );
+ OutputField( NULL, ww::eFORMCHECKBOX, String::CreateFromAscii( " FORMCHECKBOX " ), WRITEFIELD_START | WRITEFIELD_CMD_START );
+ if ( pFieldmark )
+ WriteFormData( *pFieldmark );
+ OutputField( NULL, ww::eFORMCHECKBOX, String(), WRITEFIELD_CMD_END | WRITEFIELD_CLOSE );
+ if ( pFieldmark )
+ AppendBookmark( pFieldmark->GetName(), false );
}
+ nLen -= static_cast< USHORT >( ofs );
- rWW8Wrt.pPapPlc->AppendFkpEntry( rWrt.Strm().Tell(), pO->Count(),
- pO->GetData() );
- pO->Remove( 0, pO->Count() );
-
- if(pNd->GetDropSize(rFontHeight, rDropHeight, rDropDescent))
+ String aSnippet( aAttrIter.GetSnippet( aStr, nAktPos + static_cast< USHORT >( ofs ), nLen ) );
+ if ( ( nTxtTyp == TXT_EDN || nTxtTyp == TXT_FTN ) && nAktPos == 0 && nLen > 0 )
{
- if (rWW8Wrt.bWrtWW8)
- {
- const SwCharFmt *pSwCharFmt = rSwFmtDrop.GetCharFmt();
- if(pSwCharFmt)
- {
- rWW8Wrt.InsUInt16( 0x4A30 );
- rWW8Wrt.InsUInt16( rWW8Wrt.GetId( *pSwCharFmt ) );
- }
-
- rWW8Wrt.InsUInt16( 0x4845 ); // Lower the chars
- rWW8Wrt.InsUInt16( static_cast< UINT16 >(-((nDropLines - 1)*rDropDescent) / 10 ));
-
- rWW8Wrt.InsUInt16( 0x4a43 ); // Font Size
- rWW8Wrt.InsUInt16( static_cast< UINT16 >(rFontHeight / 10) );
- }
- else
- {
- const SwCharFmt *pSwCharFmt = rSwFmtDrop.GetCharFmt();
- if(pSwCharFmt)
- {
- rWW8Wrt.InsUInt16( 80 );
- rWW8Wrt.InsUInt16( rWW8Wrt.GetId( *pSwCharFmt ) );
- }
-
- rWW8Wrt.pO->Insert(101, rWW8Wrt.pO->Count() ); // Lower the chars
- rWW8Wrt.InsUInt16( static_cast< UINT16 >(-((nDropLines - 1)*rDropDescent) / 10) );
-
- rWW8Wrt.pO->Insert( 99, rWW8Wrt.pO->Count() ); // Font Size
- rWW8Wrt.InsUInt16( static_cast< UINT16 >(rFontHeight / 10) );
- }
+ // Insert tab for aesthetic puposes #i24762#
+ if ( aSnippet.GetChar( 0 ) != 0x09 )
+ aSnippet.Insert( 0x09, 0 );
}
-
- rWW8Wrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(),
- pO->Count(), pO->GetData() );
- pO->Remove( 0, pO->Count() );
+ AttrOutput().RunText( aSnippet, eChrSet );
}
- // Am Zeilenende werden die Attribute bis ueber das CR aufgezogen.
- // Ausnahme: Fussnoten am Zeilenende
- if (nNextAttr == nEnd)
+ if ( aAttrIter.IsDropCap( nNextAttr ) )
+ AttrOutput().FormatDrop( rNode, aAttrIter.GetSwFmtDrop(), nStyle, pTextNodeInfo, pTextNodeInfoInner );
+
+ // At the end of line, output the attributes until the CR.
+ // Exception: footnotes at the end of line
+ if ( nNextAttr == nEnd )
{
- ASSERT(nOpenAttrWithRange >= 0,
- "odd to see this happening, expected >= 0");
- if (!bTxtAtr && nOpenAttrWithRange <= 0)
+ ASSERT( nOpenAttrWithRange >= 0, "odd to see this happening, expected >= 0" );
+ if ( !bTxtAtr && nOpenAttrWithRange <= 0 )
{
- if (aAttrIter.IsRedlineAtEnd(nEnd))
+ if ( aAttrIter.IsRedlineAtEnd( nEnd ) )
bRedlineAtEnd = true;
else
{
- //insert final graphic anchors if any before CR
- aAttrIter.OutFlys(nEnd);
- //insert final bookmarks if any before CR and after flys
- rWW8Wrt.AppendBookmarks( *pNd, nEnd, 1 );
- if (pTOXSect)
+ // insert final graphic anchors if any before CR
+ aAttrIter.OutFlys( nEnd );
+ // insert final bookmarks if any before CR and after flys
+ AppendBookmarks( rNode, nEnd, 1 );
+ if ( pTOXSect )
{
- rWW8Wrt.pop_charpropstart();
- rWW8Wrt.EndTOX(*pTOXSect);
+ m_aCurrentCharPropStarts.pop();
+ AttrOutput().EndTOX( *pTOXSect );
}
- rWW8Wrt.WriteCR(pTextNodeInfoInner); // CR danach
+ WriteCR( pTextNodeInfoInner );
}
}
}
- WW8_WrPlcFld* pCurrentFields = rWW8Wrt.CurrentFieldPlc();
- USHORT nOldFieldResults = pCurrentFields ? pCurrentFields->ResultCount() : 0;
+ // Output the character attributes
+ AttrOutput().StartRunProperties();
+ aAttrIter.OutAttr( nAktPos ); // nAktPos - 1 ??
+ AttrOutput().EndRunProperties( pRedlineData );
- // Export of Character attributes
- aAttrIter.OutAttr( nAktPos ); // nAktPos - 1 ??
-
- pCurrentFields = rWW8Wrt.CurrentFieldPlc();
- USHORT nNewFieldResults = pCurrentFields ? pCurrentFields->ResultCount() : 0;
-
- bool bExportedFieldResult = nOldFieldResults != nNewFieldResults;
- //If we have exported a field result, then we will have been forced to
- //split up the text into a 0x13, 0x14, <result> 0x15 sequence with the
- //properties forced out at the end of the result, so the 0x15 itself
- //should remain clean of all other attributes to avoid #iXXXXX#
- if (!bExportedFieldResult)
- {
- rWW8Wrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(),
- pO->Count(), pO->GetData() );
- }
- pO->Remove( 0, pO->Count() ); // erase
-
- // Ausnahme: Fussnoten am Zeilenende
- if (nNextAttr == nEnd)
+ // Exception: footnotes at the end of line
+ if ( nNextAttr == nEnd )
{
ASSERT(nOpenAttrWithRange >= 0,
"odd to see this happening, expected >= 0");
bool bAttrWithRange = (nOpenAttrWithRange > 0);
- if (nAktPos != nEnd)
+ if ( nAktPos != nEnd )
{
nOpenAttrWithRange += aAttrIter.OutAttrWithRange(nEnd);
ASSERT(nOpenAttrWithRange == 0,
"odd to see this happening, expected 0");
}
- if(pO->Count())
- {
- rWW8Wrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(),
- pO->Count(), pO->GetData() );
- pO->Remove(0, pO->Count()); // leeren
- }
+ AttrOutput().OutputFKP();
- if( bTxtAtr || bAttrWithRange || bRedlineAtEnd )
+ if ( bTxtAtr || bAttrWithRange || bRedlineAtEnd )
{
- //insert final graphic anchors if any before CR
- aAttrIter.OutFlys(nEnd);
- //insert final bookmarks if any before CR and after flys
- rWW8Wrt.AppendBookmarks( *pNd, nEnd, 1 );
+ // insert final graphic anchors if any before CR
+ aAttrIter.OutFlys( nEnd );
+ // insert final bookmarks if any before CR and after flys
+ AppendBookmarks( rNode, nEnd, 1 );
- if (pTOXSect)
+ if ( pTOXSect )
{
- rWW8Wrt.pop_charpropstart();
- rWW8Wrt.EndTOX( *pTOXSect );
+ m_aCurrentCharPropStarts.pop();
+ AttrOutput().EndTOX( *pTOXSect );
}
- rWW8Wrt.WriteCR(pTextNodeInfoInner); // CR danach
+ WriteCR( pTextNodeInfoInner );
- if( bRedlineAtEnd )
+ if ( bRedlineAtEnd )
{
- aAttrIter.OutRedlines( nEnd );
- if( pO->Count() )
- {
- rWW8Wrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(),
- pO->Count(), pO->GetData() );
- pO->Remove( 0, pO->Count() ); // delete
- }
+ AttrOutput().Redline( aAttrIter.GetRedline( nEnd ) );
+ AttrOutput().OutputFKP();
}
}
}
+
+ AttrOutput().EndRun();
+
nAktPos = nNextAttr;
- aAttrIter.NextPos();
+ UpdatePosition( &aAttrIter, nAktPos, nEnd );
eChrSet = aAttrIter.GetCharSet();
}
- while( nAktPos < nEnd );
+ while ( nAktPos < nEnd );
- ASSERT( !pO->Count(), " pO ist am ZeilenEnde nicht leer" );
+ AttrOutput().StartParagraphProperties( rNode );
- pO->Insert( (BYTE*)&nSty, 2, pO->Count() ); // Style #
+ AttrOutput().ParagraphStyle( nStyle );
- if (rWW8Wrt.mpParentFrame && !rWW8Wrt.bIsInTable) // Fly-Attrs
- rWW8Wrt.Out_SwFmt(rWW8Wrt.mpParentFrame->GetFrmFmt(), false, false, true);
+ if ( mpParentFrame && !bIsInTable ) // Fly-Attrs
+ OutputFormat( mpParentFrame->GetFrmFmt(), false, false, true );
- if (pTextNodeInfo.get() != NULL)
+ if ( pTextNodeInfo.get() != NULL )
{
#ifdef DEBUG
::std::clog << pTextNodeInfo->toString() << ::std::endl;
#endif
- rWW8Wrt.OutWW8TableInfoCell(pTextNodeInfoInner);
+ AttrOutput().TableInfoCell( pTextNodeInfoInner );
}
- if( !bFlyInTable )
+ if ( !bFlyInTable )
{
SfxItemSet* pTmpSet = 0;
- const BYTE nPrvNxtNd = pNd->HasPrevNextLayNode();
+ const BYTE nPrvNxtNd = rNode.HasPrevNextLayNode();
if( (ND_HAS_PREV_LAYNODE|ND_HAS_NEXT_LAYNODE ) != nPrvNxtNd )
{
const SfxPoolItem* pItem;
- if( SFX_ITEM_SET == pNd->GetSwAttrSet().GetItemState(
+ if( SFX_ITEM_SET == rNode.GetSwAttrSet().GetItemState(
RES_UL_SPACE, true, &pItem ) &&
( ( !( ND_HAS_PREV_LAYNODE & nPrvNxtNd ) &&
((SvxULSpaceItem*)pItem)->GetUpper()) ||
( !( ND_HAS_NEXT_LAYNODE & nPrvNxtNd ) &&
((SvxULSpaceItem*)pItem)->GetLower()) ))
{
- pTmpSet = new SfxItemSet( pNd->GetSwAttrSet() );
+ pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() );
SvxULSpaceItem aUL( *(SvxULSpaceItem*)pItem );
// OD, MMAHER 2004-03-01 #i25901#- consider compatibility option
- if (!rWrt.pDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES))
+ if (!pDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES))
{
if( !(ND_HAS_PREV_LAYNODE & nPrvNxtNd ))
aUL.SetUpper( 0 );
}
// OD, MMAHER 2004-03-01 #i25901# - consider compatibility option
- if (!rWrt.pDoc->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS))
+ if (!pDoc->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS))
{
if( !(ND_HAS_NEXT_LAYNODE & nPrvNxtNd ))
aUL.SetLower( 0 );
@@ -1855,20 +1869,20 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
BOOL bParaRTL = FALSE;
const SvxFrameDirectionItem* pItem = (const SvxFrameDirectionItem*)
- pNd->GetSwAttrSet().GetItem(RES_FRAMEDIR);
+ rNode.GetSwAttrSet().GetItem(RES_FRAMEDIR);
if ( aAttrIter.IsParaRTL())
bParaRTL = TRUE;
- if( pNd->IsNumbered())
+ if( rNode.IsNumbered())
{
- const SwNumRule* pRule = pNd->GetNumRule();
- BYTE nLvl = static_cast< BYTE >(pNd->GetActualListLevel());
+ const SwNumRule* pRule = rNode.GetNumRule();
+ BYTE nLvl = static_cast< BYTE >( rNode.GetActualListLevel() );
const SwNumFmt* pFmt = pRule->GetNumFmt( nLvl );
if( !pFmt )
pFmt = &pRule->Get( nLvl );
if( !pTmpSet )
- pTmpSet = new SfxItemSet( pNd->GetSwAttrSet() );
+ pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() );
SvxLRSpaceItem aLR(ItemGet<SvxLRSpaceItem>(*pTmpSet, RES_LR_SPACE));
// --> OD 2008-06-03 #i86652#
@@ -1879,16 +1893,16 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
}
// <--
- if( pNd->IsNumbered() && pNd->IsCountedInList() )
+ if( rNode.IsNumbered() && rNode.IsCountedInList() )
{
// --> OD 2008-06-03 #i86652#
if ( pFmt->GetPositionAndSpaceMode() ==
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
if (bParaRTL)
- aLR.SetTxtFirstLineOfstValue(pFmt->GetAbsLSpace() - pFmt->GetFirstLineOffset());
+ aLR.SetTxtFirstLineOfstValue(pFmt->GetAbsLSpace() - pFmt->GetFirstLineOffset());
else
- aLR.SetTxtFirstLineOfst(GetWordFirstLineOffset(*pFmt));
+ aLR.SetTxtFirstLineOfst(GetWordFirstLineOffset(*pFmt));
}
// <--
@@ -1907,7 +1921,7 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
// indent values are not applicable.
if ( pFmt->GetPositionAndSpaceMode() ==
SvxNumberFormat::LABEL_ALIGNMENT &&
- !pNd->AreListLevelIndentsApplicable() )
+ !rNode.AreListLevelIndentsApplicable() )
{
pTmpSet->Put( aLR );
}
@@ -1929,7 +1943,7 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
aItem.Insert(aTabStop);
pTmpSet->Put(aItem);
- SwWW8Writer::CorrTabStopInSet(*pTmpSet, pFmt->GetAbsLSpace());
+ MSWordExportBase::CorrectTabStopInSet(*pTmpSet, pFmt->GetAbsLSpace());
}
}
@@ -1939,14 +1953,14 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
default. Otherwise we must add a RTL attribute to our export list
*/
pItem = (const SvxFrameDirectionItem*)
- pNd->GetSwAttrSet().GetItem(RES_FRAMEDIR);
+ rNode.GetSwAttrSet().GetItem(RES_FRAMEDIR);
if (
(!pItem || pItem->GetValue() == FRMDIR_ENVIRONMENT) &&
aAttrIter.IsParaRTL()
)
{
if ( !pTmpSet )
- pTmpSet = new SfxItemSet(pNd->GetSwAttrSet());
+ pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
pTmpSet->Put(SvxFrameDirectionItem(FRMDIR_HORI_RIGHT_TOP, RES_FRAMEDIR));
}
@@ -1956,17 +1970,17 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
// is found in <pTmpSet>
// #i44815# adjust numbering/indents for numbered paragraphs
// without number (NO_NUMLEVEL)
- // #i47013# need to check pNd->GetNumRule()!=NULL as well.
- if ( ! pNd->IsCountedInList() && pNd->GetNumRule()!=NULL )
+ // #i47013# need to check rNode.GetNumRule()!=NULL as well.
+ if ( ! rNode.IsCountedInList() && rNode.GetNumRule()!=NULL )
{
// WW8 does not know numbered paragraphs without number
- // (NO_NUMLEVEL). In OutWW8_SwNumRuleItem, we will export
+ // (NO_NUMLEVEL). In WW8AttributeOutput::ParaNumRule(), we will export
// the RES_PARATR_NUMRULE as list-id 0, which in WW8 means
// no numbering. Here, we will adjust the indents to match
// visually.
if ( !pTmpSet )
- pTmpSet = new SfxItemSet(pNd->GetSwAttrSet());
+ pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
// create new LRSpace item, based on the current (if present)
const SfxPoolItem* pPoolItem = NULL;
@@ -1977,8 +1991,8 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
: *static_cast<const SvxLRSpaceItem*>( pPoolItem ) );
// new left margin = old left + label space
- const SwNumRule* pRule = pNd->GetNumRule();
- const SwNumFmt& rNumFmt = pRule->Get( static_cast< USHORT >(pNd->GetActualListLevel()) );
+ const SwNumRule* pRule = rNode.GetNumRule();
+ const SwNumFmt& rNumFmt = pRule->Get( static_cast< USHORT >(rNode.GetActualListLevel()) );
// --> OD 2008-06-03 #i86652#
if ( rNumFmt.GetPositionAndSpaceMode() ==
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
@@ -2004,38 +2018,36 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
// --> OD 2007-04-24 #i75457#
// Export page break after attribute from paragraph style.
+ // If page break attribute at the text node exist, an existing page
+ // break after at the paragraph style hasn't got to be considered.
+ if ( !rNode.GetpSwAttrSet() ||
+ SFX_ITEM_SET != rNode.GetpSwAttrSet()->GetItemState(RES_BREAK, false) )
{
- // If page break attribute at the text node exist, an existing page
- // break after at the paragraph style hasn't got to be considered.
- if ( !pNd->GetpSwAttrSet() ||
- SFX_ITEM_SET != pNd->GetpSwAttrSet()->GetItemState(RES_BREAK, false) )
+ const SvxFmtBreakItem* pBreakAtParaStyle =
+ &(ItemGet<SvxFmtBreakItem>(rNode.GetSwAttrSet(), RES_BREAK));
+ if ( pBreakAtParaStyle &&
+ pBreakAtParaStyle->GetBreak() == SVX_BREAK_PAGE_AFTER )
{
- const SvxFmtBreakItem* pBreakAtParaStyle =
- &(ItemGet<SvxFmtBreakItem>(pNd->GetSwAttrSet(), RES_BREAK));
- if ( pBreakAtParaStyle &&
- pBreakAtParaStyle->GetBreak() == SVX_BREAK_PAGE_AFTER )
+ if ( !pTmpSet )
{
- if ( !pTmpSet )
- {
- pTmpSet = new SfxItemSet(pNd->GetSwAttrSet());
- }
- pTmpSet->Put( *pBreakAtParaStyle );
- }
- else if( pTmpSet )
- { // Even a pagedesc item is set, the break item can be set 'NONE',
- // this has to be overruled.
- const SwFmtPageDesc& rPageDescAtParaStyle =
- ItemGet<SwFmtPageDesc>( *pNd, RES_PAGEDESC );
- if( rPageDescAtParaStyle.GetRegisteredIn() )
- pTmpSet->ClearItem( RES_BREAK );
+ pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
}
+ pTmpSet->Put( *pBreakAtParaStyle );
+ }
+ else if( pTmpSet )
+ { // Even a pagedesc item is set, the break item can be set 'NONE',
+ // this has to be overruled.
+ const SwFmtPageDesc& rPageDescAtParaStyle =
+ ItemGet<SwFmtPageDesc>( rNode, RES_PAGEDESC );
+ if( rPageDescAtParaStyle.GetRegisteredIn() )
+ pTmpSet->ClearItem( RES_BREAK );
}
}
// --> FME 2007-05-30 #i76520# Emulate non-splitting tables
- if ( rWW8Wrt.bOutTable )
+ if ( bOutTable )
{
- const SwTableNode* pTableNode = pNd->FindTableNode();
+ const SwTableNode* pTableNode = rNode.FindTableNode();
if ( pTableNode )
{
@@ -2051,7 +2063,7 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
// bKeep: set keep at first paragraphs in all lines
// bDontSplit : set keep at first paragraphs in all lines except from last line
// but only for non-complex tables
- const SwTableBox* pBox = pNd->GetTblBox();
+ const SwTableBox* pBox = rNode.GetTblBox();
const SwTableLine* pLine = pBox ? pBox->GetUpper() : 0;
if ( pLine && !pLine->GetUpper() )
@@ -2060,7 +2072,7 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
if ( 0 == pLine->GetTabBoxes().GetPos( pBox ) && pBox->GetSttNd() )
{
// check if paragraph is first in that line:
- if ( 1 == ( pNd->GetIndex() - pBox->GetSttNd()->GetIndex() ) )
+ if ( 1 == ( rNode.GetIndex() - pBox->GetSttNd()->GetIndex() ) )
{
bool bSetAtPara = false;
if ( bKeep )
@@ -2075,7 +2087,7 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
if ( bSetAtPara )
{
if ( !pTmpSet )
- pTmpSet = new SfxItemSet(pNd->GetSwAttrSet());
+ pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
const SvxFmtKeepItem aKeepItem( TRUE, RES_KEEP );
pTmpSet->Put( aKeepItem );
@@ -2088,76 +2100,57 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
}
// <--
- const SfxItemSet* pNewSet = pTmpSet ? pTmpSet : pNd->GetpSwAttrSet();
+ const SfxItemSet* pNewSet = pTmpSet ? pTmpSet : rNode.GetpSwAttrSet();
if( pNewSet )
{ // Para-Attrs
- rWW8Wrt.pStyAttr = &pNd->GetAnyFmtColl().GetAttrSet();
+ pStyAttr = &rNode.GetAnyFmtColl().GetAttrSet();
- const SwModify* pOldMod = rWW8Wrt.pOutFmtNode;
- rWW8Wrt.pOutFmtNode = pNd;
+ const SwModify* pOldMod = pOutFmtNode;
+ pOutFmtNode = &rNode;
// Pap-Attrs, so script is not necessary
- rWW8Wrt.Out_SfxItemSet( *pNewSet, true, false,
- i18n::ScriptType::LATIN);
+ OutputItemSet( *pNewSet, true, false, i18n::ScriptType::LATIN);
- rWW8Wrt.pStyAttr = 0;
- rWW8Wrt.pOutFmtNode = pOldMod;
+ pStyAttr = 0;
+ pOutFmtNode = pOldMod;
- if( pNewSet != pNd->GetpSwAttrSet() )
+ if( pNewSet != rNode.GetpSwAttrSet() )
delete pNewSet;
}
}
- rWW8Wrt.pPapPlc->AppendFkpEntry( rWrt.Strm().Tell(), pO->Count(),
- pO->GetData() );
- pO->Remove( 0, pO->Count() ); // leeren
-
- if (pTextNodeInfoInner.get() != NULL)
- {
- if (pTextNodeInfoInner->isEndOfLine())
- {
- rWW8Wrt.WriteRowEnd(pTextNodeInfoInner->getDepth());
+ AttrOutput().EndParagraphProperties();
- pO->Insert( (BYTE*)&nSty, 2, pO->Count() ); // Style #
- rWW8Wrt.OutWW8TableInfoRow(pTextNodeInfoInner);
- rWW8Wrt.pPapPlc->AppendFkpEntry( rWrt.Strm().Tell(), pO->Count(),
- pO->GetData() );
- pO->Remove( 0, pO->Count() ); // leeren
- }
- }
+ AttrOutput().EndParagraph( pTextNodeInfoInner );
#ifdef DEBUG
::std::clog << "</OutWW8_SwTxtNode>" << ::std::endl;
#endif
-
- return rWrt;
}
-void SwWW8Writer::OutWW8TableNodeInfo(ww8::WW8TableNodeInfo::Pointer_t pNodeInfo)
+void WW8AttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo )
{
SVBT16 nSty;
- ShortToSVBT16( nStyleBeforeFly, nSty );
+ ShortToSVBT16( GetExport().nStyleBeforeFly, nSty );
- ww8::WW8TableNodeInfo::Inners_t::const_iterator aIt
- (pNodeInfo->getInners().begin());
- ww8::WW8TableNodeInfo::Inners_t::const_iterator aItEnd
- (pNodeInfo->getInners().end());
+ ww8::WW8TableNodeInfo::Inners_t::const_iterator aIt( pNodeInfo->getInners().begin() );
+ ww8::WW8TableNodeInfo::Inners_t::const_iterator aItEnd( pNodeInfo->getInners().end() );
while (aIt != aItEnd)
{
ww8::WW8TableNodeInfoInner::Pointer_t pInner = aIt->second;
- if (pInner->isEndOfCell())
+ if ( pInner->isEndOfCell() )
{
- WriteRowEnd(pInner->getDepth());
+ TableRowEnd( pInner->getDepth() );
- pO->Insert( (BYTE*)&nSty, 2, pO->Count() ); // Style #
- OutWW8TableInfoRow(pInner);
- pPapPlc->AppendFkpEntry( Strm().Tell(), pO->Count(),
- pO->GetData() );
- pO->Remove( 0, pO->Count() ); // leeren
+ m_rWW8Export.pO->Insert( (BYTE*)&nSty, 2, m_rWW8Export.pO->Count() ); // Style #
+ TableInfoRow( pInner );
+ m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(),
+ m_rWW8Export.pO->GetData() );
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
}
- if (pInner->isEndOfLine())
+ if ( pInner->isEndOfLine() )
{
}
@@ -2168,13 +2161,11 @@ void SwWW8Writer::OutWW8TableNodeInfo(ww8::WW8TableNodeInfo::Pointer_t pNodeInfo
#if 0
/* */
-USHORT SwWW8Writer::StartTableFromFrmFmt(WW8Bytes &rAt, const SwFrmFmt *pFmt,
- SwTwips &rTblOffset)
-
+USHORT WW8Export::StartTableFromFrmFmt( WW8Bytes &rAt, const SwFrmFmt *pFmt )
{
- //Tell the undocumented table hack that everything between here and
- //the last table position is nontable text
- if (WW8_CP nPos = Fc2Cp(Strm().Tell()))
+ // Tell the undocumented table hack that everything between here and
+ // the last table position is nontable text
+ if ( WW8_CP nPos = Fc2Cp( Strm().Tell() ) )
pMagicTable->Append(nPos,0);
// sprmPDxaFromText10
@@ -2195,8 +2186,8 @@ USHORT SwWW8Writer::StartTableFromFrmFmt(WW8Bytes &rAt, const SwFrmFmt *pFmt,
rAt.Insert( aTabLineAttr, sizeof( aTabLineAttr ), rAt.Count() );
}
- ASSERT(pFmt, "No pFmt!");
- if (pFmt)
+ ASSERT( pFmt, "No pFmt!" );
+ if ( pFmt )
{
const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient();
const SwFmtVertOrient &rVert = pFmt->GetVertOrient();
@@ -2214,29 +2205,12 @@ USHORT SwWW8Writer::StartTableFromFrmFmt(WW8Bytes &rAt, const SwFrmFmt *pFmt,
case text::HoriOrientation::CENTER:
case text::HoriOrientation::RIGHT:
if( bWrtWW8 )
- InsUInt16( rAt, 0x5400 );
+ SwWW8Writer::InsUInt16( rAt, NS_sprm::LN_TJc );
else
rAt.Insert( 182, rAt.Count() );
- InsUInt16( rAt, (text::HoriOrientation::RIGHT == eHOri ? 2 : 1 ));
+ SwWW8Writer::InsUInt16( rAt, (text::HoriOrientation::RIGHT == eHOri ? 2 : 1 ));
break;
default:
-#if 1
-#if 1
- rTblOffset = rHori.GetPos();
- const SvxLRSpaceItem& rLRSp = pFmt->GetLRSpace();
- rTblOffset += rLRSp.GetLeft();
-#else
- Point aOffset = pFmt->FindLayoutRect(true).Pos();
- rTblOffset = aOffset.X();
-#endif
-
-#else
- {
- const SvxLRSpaceItem& rLRSp = pFmt->GetLRSpace();
- rTblOffset = rLRSp.GetLeft();
- rPageSize -= rTblOffset + rLRSp.GetRight();
- }
-#endif
break;
}
}
@@ -2245,23 +2219,23 @@ USHORT SwWW8Writer::StartTableFromFrmFmt(WW8Bytes &rAt, const SwFrmFmt *pFmt,
}
//See #i19484# for why we need this
-bool CellContainsProblematicGraphic(const SwWriteTableCell *pCell,
- const SwWW8Writer &rWr)
+static bool CellContainsProblematicGraphic( const SwWriteTableCell *pCell,
+ const MSWordExportBase &rExport )
{
const SwNode *pStart = pCell ? pCell->GetBox()->GetSttNd() : 0;
const SwNode *pEnd = pStart ? pStart->EndOfSectionNode() : 0;
- ASSERT(pStart && pEnd, "No start or end?");
- if (!(pStart && pEnd))
+ ASSERT( pStart && pEnd, "No start or end?" );
+ if ( !pStart || !pEnd )
return false;
bool bHasGraphic = false;
- sw::Frames aFrames(GetFramesBetweenNodes(rWr.maFrames, *pStart, *pEnd));
+ sw::Frames aFrames( GetFramesBetweenNodes( rExport.maFrames, *pStart, *pEnd ) );
sw::FrameIter aEnd = aFrames.end();
- for (sw::FrameIter aIter = aFrames.begin(); aIter != aEnd; ++aIter)
+ for ( sw::FrameIter aIter = aFrames.begin(); aIter != aEnd; ++aIter )
{
const SwFrmFmt &rEntry = aIter->GetFrmFmt();
- if (rEntry.GetSurround().GetSurround() == SURROUND_THROUGHT)
+ if ( rEntry.GetSurround().GetSurround() == SURROUND_THROUGHT )
{
bHasGraphic = true;
break;
@@ -2270,13 +2244,13 @@ bool CellContainsProblematicGraphic(const SwWriteTableCell *pCell,
return bHasGraphic;
}
-bool RowContainsProblematicGraphic(const SwWriteTableCellPtr *pRow,
- USHORT nCols, const SwWW8Writer &rWr)
+static bool RowContainsProblematicGraphic( const SwWriteTableCellPtr *pRow,
+ USHORT nCols, const MSWordExportBase &rExport )
{
bool bHasGraphic = false;
- for (USHORT nI = 0; nI < nCols; ++nI)
+ for ( USHORT nI = 0; nI < nCols; ++nI )
{
- if (CellContainsProblematicGraphic(pRow[nI], rWr))
+ if ( CellContainsProblematicGraphic( pRow[nI], rExport ) )
{
bHasGraphic = true;
break;
@@ -2289,7 +2263,12 @@ bool RowContainsProblematicGraphic(const SwWriteTableCellPtr *pRow,
// Tabellen
//---------------------------------------------------------------------------
-bool SwWW8Writer::NoPageBreakSection(const SfxItemSet* pSet)
+void WW8AttributeOutput::EmptyParagraph()
+{
+ m_rWW8Export.WriteStringAsPara( aEmptyStr );
+}
+
+bool MSWordExportBase::NoPageBreakSection( const SfxItemSet* pSet )
{
bool bRet = false;
const SfxPoolItem* pI;
@@ -2327,23 +2306,22 @@ bool SwWW8Writer::NoPageBreakSection(const SfxItemSet* pSet)
/* */
-Writer& OutWW8_SwSectionNode( Writer& rWrt, SwSectionNode& rSectionNode )
+void MSWordExportBase::OutputSectionNode( const SwSectionNode& rSectionNode )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
const SwSection& rSection = rSectionNode.GetSection();
SwNodeIndex aIdx( rSectionNode, 1 );
const SwNode& rNd = aIdx.GetNode();
- if (!rNd.IsSectionNode() && !rWW8Wrt.bIsInTable) //No sections in table
+ if ( !rNd.IsSectionNode() && !bIsInTable ) //No sections in table
{
// Bug 74245 - if the first Node inside the section has an own
// PageDesc or PageBreak attribut, then dont write
// here the section break
ULONG nRstLnNum = 0;
const SfxItemSet* pSet;
- if( rNd.IsTableNode() )
+ if ( rNd.IsTableNode() )
pSet = &rNd.GetTableNode()->GetTable().GetFrmFmt()->GetAttrSet();
- else if( rNd.IsCntntNode() )
+ else if ( rNd.IsCntntNode() )
{
pSet = &rNd.GetCntntNode()->GetSwAttrSet();
nRstLnNum = ((SwFmtLineNumber&)pSet->Get(
@@ -2352,30 +2330,34 @@ Writer& OutWW8_SwSectionNode( Writer& rWrt, SwSectionNode& rSectionNode )
else
pSet = 0;
- if( pSet && SwWW8Writer::NoPageBreakSection(pSet))
+ if ( pSet && NoPageBreakSection( pSet ) )
pSet = 0;
- if( !pSet )
+ if ( !pSet )
{
// new Section with no own PageDesc/-Break
// -> write follow section break;
const SwSectionFmt& rFmt = *rSection.GetFmt();
- rWW8Wrt.ReplaceCr( (char)0xc ); // Indikator fuer Page/Section-Break
+ ReplaceCr( msword::PageBreak ); // Indikator fuer Page/Section-Break
//Get the page in use at the top of this section
SwNodeIndex aIdxTmp(rSectionNode, 1);
const SwPageDesc *pCurrent =
SwPageDesc::GetPageDescOfNode(aIdxTmp.GetNode());
if (!pCurrent)
- pCurrent = rWW8Wrt.pAktPageDesc;
+ pCurrent = pAktPageDesc;
- rWW8Wrt.pSepx->AppendSep(rWW8Wrt.Fc2Cp(rWrt.Strm().Tell()),
- pCurrent, &rFmt, nRstLnNum);
+ AppendSection( pCurrent, &rFmt, nRstLnNum );
}
}
- if( TOX_CONTENT_SECTION == rSection.GetType() )
- rWW8Wrt.bStartTOX = true;
- return rWrt;
+ if ( TOX_CONTENT_SECTION == rSection.GetType() )
+ bStartTOX = true;
+}
+
+
+void WW8Export::AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, ULONG nLnNum )
+{
+ pSepx->AppendSep(Fc2Cp(Strm().Tell()), pPageDesc, pFmt, nLnNum);
}
/* */
@@ -2384,9 +2366,11 @@ Writer& OutWW8_SwSectionNode( Writer& rWrt, SwSectionNode& rSectionNode )
// Flys
//---------------------------------------------------------------------------
-void SwWW8Writer::OutWW8FlyFrmsInCntnt( const SwTxtNode& rNd )
+void WW8Export::OutWW6FlyFrmsInCntnt( const SwTxtNode& rNd )
{
ASSERT(!bWrtWW8, "I shouldn't be needed for Word >=8");
+ if ( bWrtWW8 )
+ return;
if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
{
@@ -2415,15 +2399,17 @@ void SwWW8Writer::OutWW8FlyFrmsInCntnt( const SwTxtNode& rNd )
aOffset = aFlyRect.Pos() - aParentRect.Pos();
// PaM umsetzen: auf Inhalt des Fly-Frameformats
- WW8SaveData aSaveData( *this, nStt, nEnd );
+ SaveData( nStt, nEnd );
- // wird in Out_SwFmt() ausgewertet
+ // wird in OutputFormat() ausgewertet
pFlyOffset = &aOffset;
eNewAnchorType = rFlyFrmFmt.GetAnchor().GetAnchorId();
sw::Frame aFrm(rFlyFrmFmt, SwPosition(rNd));
mpParentFrame = &aFrm;
// Ok, rausschreiben:
WriteText();
+
+ RestoreData();
}
}
}
@@ -2431,15 +2417,14 @@ void SwWW8Writer::OutWW8FlyFrmsInCntnt( const SwTxtNode& rNd )
}
}
-
-void SwWW8Writer::OutWW8FlyFrm(const sw::Frame& rFmt, const Point& rNdTopLeft)
+void WW8AttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point& rNdTopLeft )
{
const SwFrmFmt &rFrmFmt = rFmt.GetFrmFmt();
const SwFmtAnchor& rAnch = rFrmFmt.GetAnchor();
- bool bUseEscher = bWrtWW8;
+ bool bUseEscher = m_rWW8Export.bWrtWW8;
- if (bWrtWW8 && rFmt.IsInline())
+ if ( m_rWW8Export.bWrtWW8 && rFmt.IsInline() )
{
sw::Frame::WriterSource eType = rFmt.GetWriterType();
if ((eType == sw::Frame::eGraphic) || (eType == sw::Frame::eOle))
@@ -2454,16 +2439,16 @@ void SwWW8Writer::OutWW8FlyFrm(const sw::Frame& rFmt, const Point& rNdTopLeft)
*/
if ((bUseEscher == true) && (eType == sw::Frame::eFormControl))
{
- if (MiserableFormFieldExportHack(rFrmFmt))
+ if ( m_rWW8Export.MiserableFormFieldExportHack( rFrmFmt ) )
return ;
}
}
if (bUseEscher)
{
- ASSERT(bWrtWW8, "this has gone horribly wrong");
+ ASSERT( m_rWW8Export.bWrtWW8, "this has gone horribly wrong" );
// write as escher
- AppendFlyInFlys(rFmt, rNdTopLeft);
+ m_rWW8Export.AppendFlyInFlys(rFmt, rNdTopLeft);
}
else
{
@@ -2478,11 +2463,11 @@ void SwWW8Writer::OutWW8FlyFrm(const sw::Frame& rFmt, const Point& rNdTopLeft)
if( nStt >= nEnd ) // kein Bereich, also kein gueltiger Node
return;
- if (!bIsInTable && rFmt.IsInline())
+ if ( !m_rWW8Export.bIsInTable && rFmt.IsInline() )
{
//Test to see if this textbox contains only a single graphic/ole
SwTxtNode* pParTxtNode = rAnch.GetCntntAnchor()->nNode.GetNode().GetTxtNode();
- if( pParTxtNode && !pDoc->GetNodes()[ nStt ]->IsNoTxtNode() )
+ if ( pParTxtNode && !m_rWW8Export.pDoc->GetNodes()[ nStt ]->IsNoTxtNode() )
bDone = true;
}
if( !bDone )
@@ -2495,53 +2480,53 @@ void SwWW8Writer::OutWW8FlyFrm(const sw::Frame& rFmt, const Point& rNdTopLeft)
// nFlyHeight = rS.GetHeight();
// <--
- {
- WW8SaveData aSaveData( *this, nStt, nEnd );
+ m_rWW8Export.SaveData( nStt, nEnd );
- Point aOffset;
- if (mpParentFrame)
- {
- /*
- #90804#
- Munge flys in fly into absolutely positioned elements for
- word 6
- */
- const SwTxtNode* pParTxtNode = rAnch.GetCntntAnchor()->nNode.GetNode().GetTxtNode();
- const SwRect aPageRect = pParTxtNode->FindPageFrmRect( FALSE, 0, FALSE );
-
- aOffset = rFrmFmt.FindLayoutRect().Pos();
- aOffset -= aPageRect.Pos();
-
- pFlyOffset = &aOffset;
- eNewAnchorType = FLY_PAGE;
- }
+ Point aOffset;
+ if ( m_rWW8Export.mpParentFrame )
+ {
+ /*
+ #90804#
+ Munge flys in fly into absolutely positioned elements for
+ word 6
+ */
+ const SwTxtNode* pParTxtNode = rAnch.GetCntntAnchor()->nNode.GetNode().GetTxtNode();
+ const SwRect aPageRect = pParTxtNode->FindPageFrmRect( FALSE, 0, FALSE );
+
+ aOffset = rFrmFmt.FindLayoutRect().Pos();
+ aOffset -= aPageRect.Pos();
+
+ m_rWW8Export.pFlyOffset = &aOffset;
+ m_rWW8Export.eNewAnchorType = FLY_PAGE;
+ }
- mpParentFrame = &rFmt;
- if (
- bIsInTable && (FLY_PAGE != rAnch.GetAnchorId()) &&
- !pDoc->GetNodes()[ nStt ]->IsNoTxtNode()
- )
- {
- // Beachten: Flag bOutTable wieder setzen,
- // denn wir geben ja ganz normalen Content der
- // Tabelenzelle aus und keinen Rahmen
- // (Flag wurde oben in aSaveData() geloescht)
- bOutTable = true;
- const String& rName = rFrmFmt.GetName();
- StartCommentOutput(rName);
- WriteText();
- EndCommentOutput(rName);
- }
- else
- WriteText();
+ m_rWW8Export.mpParentFrame = &rFmt;
+ if (
+ m_rWW8Export.bIsInTable && (FLY_PAGE != rAnch.GetAnchorId()) &&
+ !m_rWW8Export.pDoc->GetNodes()[ nStt ]->IsNoTxtNode()
+ )
+ {
+ // Beachten: Flag bOutTable wieder setzen,
+ // denn wir geben ja ganz normalen Content der
+ // Tabelenzelle aus und keinen Rahmen
+ // (Flag wurde oben in aSaveData() geloescht)
+ m_rWW8Export.bOutTable = true;
+ const String& rName = rFrmFmt.GetName();
+ m_rWW8Export.StartCommentOutput(rName);
+ m_rWW8Export.WriteText();
+ m_rWW8Export.EndCommentOutput(rName);
}
+ else
+ m_rWW8Export.WriteText();
+
+ m_rWW8Export.RestoreData();
}
}
}
-void SwWW8Writer::OutFlyFrm(const sw::Frame& rFmt)
+void AttributeOutputBase::OutputFlyFrame( const sw::Frame& rFmt )
{
- if (!rFmt.GetCntntNode())
+ if ( !rFmt.GetCntntNode() )
return;
const SwCntntNode &rNode = *rFmt.GetCntntNode();
@@ -2549,10 +2534,10 @@ void SwWW8Writer::OutFlyFrm(const sw::Frame& rFmt)
Point* pLayPos;
bool bValidNdPos = false, bValidPgPos = false;
- if (FLY_PAGE == rFmt.GetFrmFmt().GetAnchor().GetAnchorId())
+ if ( FLY_PAGE == rFmt.GetFrmFmt().GetAnchor().GetAnchorId() )
{
// get the Layout Node-Position.
- if (!bValidPgPos)
+ if ( !bValidPgPos )
{
aPgPos = rNode.FindPageFrmRect(false, &aPgPos).Pos();
bValidPgPos = true;
@@ -2562,7 +2547,7 @@ void SwWW8Writer::OutFlyFrm(const sw::Frame& rFmt)
else
{
// get the Layout Node-Position.
- if (!bValidNdPos)
+ if ( !bValidNdPos )
{
aNdPos = rNode.FindLayoutRect(false, &aNdPos).Pos();
bValidNdPos = true;
@@ -2570,27 +2555,30 @@ void SwWW8Writer::OutFlyFrm(const sw::Frame& rFmt)
pLayPos = &aNdPos;
}
- OutWW8FlyFrm(rFmt, *pLayPos);
+ OutputFlyFrame_Impl( rFmt, *pLayPos );
}
// write data of any redline
-void SwWW8Writer::OutRedline( const SwRedlineData& rRedline )
+void WW8AttributeOutput::Redline( const SwRedlineData* pRedline )
{
- if( rRedline.Next() )
- OutRedline( *rRedline.Next() );
+ if ( !pRedline )
+ return;
+
+ if ( pRedline->Next() )
+ Redline( pRedline->Next() );
static USHORT __READONLY_DATA aSprmIds[ 2 * 2 * 3 ] =
{
// Ids for insert
- 0x0801, 0x4804, 0x6805, // for WW8
+ NS_sprm::LN_CFRMark, NS_sprm::LN_CIbstRMark, NS_sprm::LN_CDttmRMark, // for WW8
0x0042, 0x0045, 0x0046, // for WW6
// Ids for delete
- 0x0800, 0x4863, 0x6864, // for WW8
+ NS_sprm::LN_CFRMarkDel, NS_sprm::LN_CIbstRMarkDel, NS_sprm::LN_CDttmRMarkDel, // for WW8
0x0041, 0x0045, 0x0046 // for WW6
};
const USHORT* pSprmIds = 0;
- switch( rRedline.GetType() )
+ switch( pRedline->GetType() )
{
case nsRedlineType_t::REDLINE_INSERT:
pSprmIds = aSprmIds;
@@ -2601,13 +2589,13 @@ void SwWW8Writer::OutRedline( const SwRedlineData& rRedline )
break;
case nsRedlineType_t::REDLINE_FORMAT:
- if( bWrtWW8 )
+ if( m_rWW8Export.bWrtWW8 )
{
- InsUInt16( 0xca57 );
- pO->Insert( 7, pO->Count() ); // len
- pO->Insert( 1, pO->Count() );
- InsUInt16( AddRedlineAuthor( rRedline.GetAuthor() ) );
- InsUInt32( sw::ms::DateTime2DTTM( rRedline.GetTimeStamp() ));
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CPropRMark );
+ m_rWW8Export.pO->Insert( 7, m_rWW8Export.pO->Count() ); // len
+ m_rWW8Export.pO->Insert( 1, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( m_rWW8Export.AddRedlineAuthor( pRedline->GetAuthor() ) );
+ m_rWW8Export.InsUInt32( sw::ms::DateTime2DTTM( pRedline->GetTimeStamp() ));
}
break;
default:
@@ -2615,37 +2603,52 @@ void SwWW8Writer::OutRedline( const SwRedlineData& rRedline )
break;
}
- if( pSprmIds )
+ if ( pSprmIds )
{
- if( !bWrtWW8 )
+ if ( !m_rWW8Export.bWrtWW8 )
pSprmIds += 3;
- if( bWrtWW8 )
- InsUInt16( pSprmIds[0] );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( pSprmIds[0] );
else
- pO->Insert(msword_cast<sal_uInt8>(pSprmIds[0]), pO->Count());
- pO->Insert( 1, pO->Count() );
+ m_rWW8Export.pO->Insert( msword_cast<sal_uInt8>(pSprmIds[0]), m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( 1, m_rWW8Export.pO->Count() );
- if( bWrtWW8 )
- InsUInt16( pSprmIds[1] );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( pSprmIds[1] );
else
- pO->Insert(msword_cast<sal_uInt8>(pSprmIds[1]), pO->Count());
- InsUInt16( AddRedlineAuthor( rRedline.GetAuthor() ) );
+ m_rWW8Export.pO->Insert( msword_cast<sal_uInt8>(pSprmIds[1]), m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( m_rWW8Export.AddRedlineAuthor( pRedline->GetAuthor() ) );
- if( bWrtWW8 )
- InsUInt16( pSprmIds[2] );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( pSprmIds[2] );
else
- pO->Insert(msword_cast<sal_uInt8>(pSprmIds[2]), pO->Count());
- InsUInt32( sw::ms::DateTime2DTTM( rRedline.GetTimeStamp() ));
+ m_rWW8Export.pO->Insert( msword_cast<sal_uInt8>(pSprmIds[2]), m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt32( sw::ms::DateTime2DTTM( pRedline->GetTimeStamp() ));
}
}
/* */
-SwNodeFnTab aWW8NodeFnTab = {
-/* RES_TXTNODE */ OutWW8_SwTxtNode,
-/* RES_GRFNODE */ OutWW8_SwGrfNode,
-/* RES_OLENODE */ OutWW8_SwOleNode,
-};
+void MSWordExportBase::OutputContentNode( const SwCntntNode& rNode )
+{
+ switch ( rNode.GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ OutputTextNode( *rNode.GetTxtNode() );
+ break;
+ case ND_GRFNODE:
+ OutputGrfNode( *rNode.GetGrfNode() );
+ break;
+ case ND_OLENODE:
+ OutputOLENode( *rNode.GetOLENode() );
+ break;
+ default:
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "Unhandled node, type == %d\n", rNode.GetNodeType() );
+#endif
+ break;
+ }
+}
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index e222bc4984d8..6c74beb82a7b 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -33,7 +33,6 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
-
#include <hintids.hxx>
#include <vcl/font.hxx>
#include <svx/fontitem.hxx>
@@ -44,9 +43,11 @@
#include <paratr.hxx>
#include <charfmt.hxx>
#include <ndtxt.hxx>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
+
+#include <writerfilter/doctok/sprmids.hxx>
+
+#include "ww8attributeoutput.hxx"
#include "writerhelper.hxx"
#include "writerwordglue.hxx"
#include "wrtww8.hxx"
@@ -61,56 +62,51 @@ using namespace ::com::sun::star;
using namespace sw::types;
using namespace sw::util;
-USHORT SwWW8Writer::DupNumRuleWithLvlStart(const SwNumRule *pRule,BYTE nLvl,
- USHORT nVal)
+USHORT MSWordExportBase::DuplicateNumRule( const SwNumRule *pRule, BYTE nLevel, USHORT nVal )
{
- //List is set to restart at a particular value so for export make a
- //completely new list based on this one and export that instead,
- //which duplicates words behaviour in this respect.
USHORT nNumId = USHRT_MAX;
- String sPrefix(CREATE_CONST_ASC("WW8TempExport"));
+ String sPrefix( CREATE_CONST_ASC( "WW8TempExport" ) );
sPrefix += String::CreateFromInt32( nUniqueList++ );
// --> OD 2008-02-11 #newlistlevelattrs#
SwNumRule* pMyNumRule =
- new SwNumRule( pDoc->GetUniqueNumRuleName(&sPrefix),
+ new SwNumRule( pDoc->GetUniqueNumRuleName( &sPrefix ),
SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
// <--
pUsedNumTbl->Insert( pMyNumRule, pUsedNumTbl->Count() );
- for (USHORT i=0;i<MAXLEVEL;i++)
+ for ( USHORT i = 0; i < MAXLEVEL; i++ )
{
const SwNumFmt& rSubRule = pRule->Get(i);
pMyNumRule->Set( i, rSubRule );
}
- SwNumFmt aNumFmt(pMyNumRule->Get(nLvl));
- aNumFmt.SetStart(nVal);
- pMyNumRule->Set(nLvl,aNumFmt);
+ SwNumFmt aNumFmt( pMyNumRule->Get( nLevel ) );
+ aNumFmt.SetStart( nVal );
+ pMyNumRule->Set( nLevel, aNumFmt );
nNumId = GetId( *pMyNumRule );
//Map the old list to our new list
- aRuleDuplicates[GetId(*pRule)] = nNumId;
+ aRuleDuplicates[GetId( *pRule )] = nNumId;
return nNumId;
}
-USHORT SwWW8Writer::GetId( const SwNumRule& rNumRule ) const
+USHORT MSWordExportBase::GetId( const SwNumRule& rNumRule )
{
- if( !pUsedNumTbl )
+ if ( !pUsedNumTbl )
{
- SwWW8Writer* pThis = (SwWW8Writer*)this;
- pThis->pUsedNumTbl = new SwNumRuleTbl;
- pThis->pUsedNumTbl->Insert( &pDoc->GetNumRuleTbl(), 0 );
+ pUsedNumTbl = new SwNumRuleTbl;
+ pUsedNumTbl->Insert( &pDoc->GetNumRuleTbl(), 0 );
// --> OD 2005-10-17 #126238# - Check, if the outline rule is
// already inserted into <pUsedNumTbl>. If yes, do not insert it again.
bool bOutlineRuleAdded( false );
- for( USHORT n = pUsedNumTbl->Count(); n; )
+ for ( USHORT n = pUsedNumTbl->Count(); n; )
{
const SwNumRule& rRule = *pUsedNumTbl->GetObject( --n );
if ( !pDoc->IsUsed( rRule ) )
{
- pThis->pUsedNumTbl->Remove( n );
+ pUsedNumTbl->Remove( n );
}
else if ( &rRule == pDoc->GetOutlineNumRule() )
{
@@ -122,7 +118,7 @@ USHORT SwWW8Writer::GetId( const SwNumRule& rNumRule ) const
{
// jetzt noch die OutlineRule einfuegen
SwNumRule* pR = (SwNumRule*)pDoc->GetOutlineNumRule();
- pThis->pUsedNumTbl->Insert( pR, pUsedNumTbl->Count() );
+ pUsedNumTbl->Insert( pR, pUsedNumTbl->Count() );
}
// <--
}
@@ -160,58 +156,174 @@ sal_Int16 GetWordFirstLineOffset(const SwNumFmt &rFmt)
return nFirstLineOffset;
}
-void SwWW8Writer::OutListTab()
+void WW8Export::WriteNumbering()
{
- if( !pUsedNumTbl )
- return ; // no numbering is used
-
- USHORT nCount = pUsedNumTbl->Count();
- USHORT n;
+ if ( !pUsedNumTbl )
+ return; // no numbering is used
+ // list formats - LSTF
pFib->fcPlcfLst = pTableStrm->Tell();
- SwWW8Writer::WriteShort( *pTableStrm, nCount );
+ SwWW8Writer::WriteShort( *pTableStrm, pUsedNumTbl->Count() );
+ NumberingDefinitions();
+ // set len to FIB
+ pFib->lcbPlcfLst = pTableStrm->Tell() - pFib->fcPlcfLst;
- // First Loop - write static data of SwNumRule - LSTF
- for( n = 0; n < nCount; ++n )
+ // list formats - LVLF
+ AbstractNumberingDefinitions();
+
+ // list formats - LFO
+ OutOverrideListTab();
+
+ // list formats - ListNames
+ OutListNamesTab();
+}
+
+void WW8AttributeOutput::NumberingDefinition( USHORT nId, const SwNumRule &rRule )
+{
+ SwWW8Writer::WriteLong( *m_rWW8Export.pTableStrm, nId );
+ SwWW8Writer::WriteLong( *m_rWW8Export.pTableStrm, nId );
+
+ // mit keinen Styles verbunden
+ for ( int i = 0; i < WW8ListManager::nMaxLevel; ++i )
+ SwWW8Writer::WriteShort( *m_rWW8Export.pTableStrm, 0xFFF );
+
+ BYTE nFlags = 0, nDummy = 0;
+ if ( rRule.IsContinusNum() )
+ nFlags |= 0x1;
+
+ *m_rWW8Export.pTableStrm << nFlags << nDummy;
+}
+
+void MSWordExportBase::NumberingDefinitions()
+{
+ if ( !pUsedNumTbl )
+ return; // no numbering is used
+
+ USHORT nCount = pUsedNumTbl->Count();
+
+ // Write static data of SwNumRule - LSTF
+ for ( USHORT n = 0; n < nCount; ++n )
{
const SwNumRule& rRule = *pUsedNumTbl->GetObject( n );
- SwWW8Writer::WriteLong( *pTableStrm, n + 1 );
- SwWW8Writer::WriteLong( *pTableStrm, n + 1 );
+ AttrOutput().NumberingDefinition( n + 1, rRule );
+ }
+}
- // mit keinen Styles verbunden
- for( int i = 0; i < WW8ListManager::nMaxLevel; ++i )
- SwWW8Writer::WriteShort( *pTableStrm, 0xFFF );
+void WW8AttributeOutput::NumberingLevel( BYTE /*nLevel*/,
+ USHORT nStart,
+ USHORT nNumberingType,
+ SvxAdjust eAdjust,
+ const BYTE *pNumLvlPos,
+ BYTE nFollow,
+ const wwFont *pFont,
+ const SfxItemSet *pOutSet,
+ sal_Int16 nIndentAt,
+ sal_Int16 nFirstLineIndex,
+ sal_Int16 nListTabPos,
+ const String &rNumberingString
+ )
+{
+ // Start value
+ SwWW8Writer::WriteLong( *m_rWW8Export.pTableStrm, nStart );
- BYTE nFlags = 0, nDummy = 0;
- if( rRule.IsContinusNum() )
- nFlags |= 0x1;
- *pTableStrm << nFlags << nDummy;
+ // Type
+ *m_rWW8Export.pTableStrm << WW8Export::GetNumId( nNumberingType );
+
+ // Justification
+ BYTE nAlign;
+ switch ( eAdjust )
+ {
+ case SVX_ADJUST_CENTER: nAlign = 1; break;
+ default: nAlign = 0; break;
}
+ *m_rWW8Export.pTableStrm << nAlign;
- // set len to FIB
- pFib->lcbPlcfLst = pTableStrm->Tell() - pFib->fcPlcfLst;
+ // Write the rgbxchNums[9], positions of placeholders for paragraph
+ // numbers in the text
+ m_rWW8Export.pTableStrm->Write( pNumLvlPos, WW8ListManager::nMaxLevel );
- // second Loop - write all Levels for all SwNumRules - LVLF
+ // Type of the character between the bullet and the text
+ *m_rWW8Export.pTableStrm << nFollow;
- // prepare the NodeNum to generate the NumString
- SwNumberTree::tNumberVector aNumVector;
- for (n = 0; n < WW8ListManager::nMaxLevel; ++n)
- aNumVector.push_back(n);
+ // dxaSoace/dxaIndent (Word 6 compatibility)
+ SwWW8Writer::WriteLong( *m_rWW8Export.pTableStrm, 0 );
+ SwWW8Writer::WriteLong( *m_rWW8Export.pTableStrm, 0 );
+ // cbGrpprlChpx
+ WW8Bytes aCharAtrs;
+ if ( pOutSet )
+ {
+ WW8Bytes* pOldpO = m_rWW8Export.pO;
+ m_rWW8Export.pO = &aCharAtrs;
+ if ( pFont )
+ {
+ USHORT nFontID = m_rWW8Export.maFontHelper.GetId( *pFont );
+
+ if ( m_rWW8Export.bWrtWW8 )
+ {
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc0 );
+ m_rWW8Export.InsUInt16( nFontID );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc2 );
+ }
+ else
+ m_rWW8Export.pO->Insert( 93, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( nFontID );
+ }
+
+ m_rWW8Export.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN );
+
+ m_rWW8Export.pO = pOldpO;
+ }
+ *m_rWW8Export.pTableStrm << BYTE( aCharAtrs.Count() );
+
+ // cbGrpprlPapx
BYTE aPapSprms [] = {
0x5e, 0x84, 0, 0, // sprmPDxaLeft
0x60, 0x84, 0, 0, // sprmPDxaLeft1
0x15, 0xc6, 0x05, 0x00, 0x01, 0, 0, 0x06
};
+ *m_rWW8Export.pTableStrm << BYTE( sizeof( aPapSprms ) );
+
+ // reserved
+ SwWW8Writer::WriteShort( *m_rWW8Export.pTableStrm, 0 );
+
+ // pap sprms
+ BYTE* pData = aPapSprms + 2;
+ Set_UInt16( pData, nIndentAt );
+ pData += 2;
+ Set_UInt16( pData, nFirstLineIndex );
+ pData += 5;
+ Set_UInt16( pData, nListTabPos );
+
+ m_rWW8Export.pTableStrm->Write( aPapSprms, sizeof( aPapSprms ));
+
+ // write Chpx
+ if( aCharAtrs.Count() )
+ m_rWW8Export.pTableStrm->Write( aCharAtrs.GetData(), aCharAtrs.Count() );
+
+ // write the num string
+ SwWW8Writer::WriteShort( *m_rWW8Export.pTableStrm, rNumberingString.Len() );
+ SwWW8Writer::WriteString16( *m_rWW8Export.pTableStrm, rNumberingString, false );
+}
+
+void MSWordExportBase::AbstractNumberingDefinitions()
+{
+ USHORT nCount = pUsedNumTbl->Count();
+ USHORT n;
+
+ // prepare the NodeNum to generate the NumString
+ SwNumberTree::tNumberVector aNumVector;
+ for ( n = 0; n < WW8ListManager::nMaxLevel; ++n )
+ aNumVector.push_back( n );
StarSymbolToMSMultiFont *pConvert = 0;
for( n = 0; n < nCount; ++n )
{
+ AttrOutput().StartAbstractNumbering( n + 1 );
+
const SwNumRule& rRule = *pUsedNumTbl->GetObject( n );
BYTE nLvl;
- BYTE nFlags = 0;
- BYTE nAlign;
BYTE nLevels = static_cast< BYTE >(rRule.IsContinusNum() ?
WW8ListManager::nMinLevel : WW8ListManager::nMaxLevel);
for( nLvl = 0; nLvl < nLevels; ++nLvl )
@@ -220,49 +332,37 @@ void SwWW8Writer::OutListTab()
BYTE aNumLvlPos[WW8ListManager::nMaxLevel] = { 0,0,0,0,0,0,0,0,0 };
const SwNumFmt& rFmt = rRule.Get( nLvl );
- SwWW8Writer::WriteLong( *pTableStrm, rFmt.GetStart() );
- *pTableStrm << SwWW8Writer::GetNumId( rFmt.GetNumberingType() );
-
- switch( rFmt.GetNumAdjust() )
- {
- case SVX_ADJUST_CENTER:
- nAlign = 1;
- break;
- default:
- nAlign = 0;
- break;
- }
- *pTableStrm << nAlign;
+ BYTE nFollow = 0;
// --> OD 2008-06-03 #i86652#
- if ( rFmt.GetPositionAndSpaceMode() ==
- SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
- nFlags = 2; // ixchFollow: 0 - tab, 1 - blank, 2 - nothing
+ nFollow = 2; // ixchFollow: 0 - tab, 1 - blank, 2 - nothing
}
- else if ( rFmt.GetPositionAndSpaceMode() ==
- SvxNumberFormat::LABEL_ALIGNMENT )
+ else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
switch ( rFmt.GetLabelFollowedBy() )
{
case SvxNumberFormat::LISTTAB:
{
- nFlags = 0;
+ // 0 (tab) unless there would be no content before the tab, in which case 2 (nothing)
+ nFollow = (SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType()) ? 0 : 2;
}
break;
case SvxNumberFormat::SPACE:
{
- nFlags = 1;
+ // 1 (space) unless there would be no content before the space in which case 2 (nothing)
+ nFollow = (SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType()) ? 1 : 2;
}
break;
case SvxNumberFormat::NOTHING:
{
- nFlags = 2;
+ nFollow = 2;
}
break;
default:
{
- nFlags = 0;
+ nFollow = 0;
ASSERT( false,
"unknown GetLabelFollowedBy() return value" );
}
@@ -293,19 +393,19 @@ void SwWW8Writer::OutListTab()
sFontName = pBulletFont->GetName();
eFamily = pBulletFont->GetFamily();
- if (sw::util::IsStarSymbol(sFontName))
- SubstituteBullet(sNumStr,eChrSet,sFontName);
+ if ( sw::util::IsStarSymbol( sFontName ) )
+ SubstituteBullet( sNumStr, eChrSet, sFontName );
// --> OD 2008-06-03 #i86652#
if ( rFmt.GetPositionAndSpaceMode() ==
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
// --> OD 2007-07-23 #148661#
- // <nFlags = 2>, if minimum label width equals 0 and
+ // <nFollow = 2>, if minimum label width equals 0 and
// minimum distance between label and text equals 0
- nFlags = ( rFmt.GetFirstLineOffset() == 0 &&
- rFmt.GetCharTextDistance() == 0 )
- ? 2 : 0; // ixchFollow: 0 - tab, 1 - blank, 2 - nothing
+ nFollow = ( rFmt.GetFirstLineOffset() == 0 &&
+ rFmt.GetCharTextDistance() == 0 )
+ ? 2 : 0; // ixchFollow: 0 - tab, 1 - blank, 2 - nothing
// <--
}
// <--
@@ -337,11 +437,11 @@ void SwWW8Writer::OutListTab()
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
// --> OD 2007-07-23 #148661#
- // <nFlags = 2>, if minimum label width equals 0 and
+ // <nFollow = 2>, if minimum label width equals 0 and
// minimum distance between label and text equals 0
- nFlags = ( rFmt.GetFirstLineOffset() == 0 &&
- rFmt.GetCharTextDistance() == 0 )
- ? 2 : 0; // ixchFollow: 0 - tab, 1 - blank, 2 - nothing
+ nFollow = ( rFmt.GetFirstLineOffset() == 0 &&
+ rFmt.GetCharTextDistance() == 0 )
+ ? 2 : 0; // ixchFollow: 0 - tab, 1 - blank, 2 - nothing
// <--
}
// <--
@@ -352,113 +452,70 @@ void SwWW8Writer::OutListTab()
sNumStr += rFmt.GetSuffix();
}
- // write the rgbxchNums[9]
- pTableStrm->Write(aNumLvlPos, WW8ListManager::nMaxLevel);
-
- *pTableStrm << nFlags;
- // dxaSoace/dxaIndent (Word 6 compatibility)
- SwWW8Writer::WriteLong( *pTableStrm, 0 );
- SwWW8Writer::WriteLong( *pTableStrm, 0 );
+ // Attributes of the numbering
+ wwFont *pPseudoFont = NULL;
+ const SfxItemSet* pOutSet = NULL;
// cbGrpprlChpx
- WW8Bytes aCharAtrs;
- if( rFmt.GetCharFmt() || bWriteBullet )
+ SfxItemSet aSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN,
+ RES_CHRATR_END );
+ if ( rFmt.GetCharFmt() || bWriteBullet )
{
- WW8Bytes* pOldpO = pO;
- pO = &aCharAtrs;
- SfxItemSet aSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN,
- RES_CHRATR_END );
- const SfxItemSet* pOutSet;
- if (bWriteBullet)
+ if ( bWriteBullet )
{
pOutSet = &aSet;
- if (rFmt.GetCharFmt())
+ if ( rFmt.GetCharFmt() )
aSet.Put( rFmt.GetCharFmt()->GetAttrSet() );
- aSet.ClearItem(RES_CHRATR_CJK_FONT);
- aSet.ClearItem(RES_CHRATR_FONT);
+ aSet.ClearItem( RES_CHRATR_CJK_FONT );
+ aSet.ClearItem( RES_CHRATR_FONT );
- if (!sFontName.Len())
+ if ( !sFontName.Len() )
sFontName = pBulletFont->GetName();
- wwFont aPseudoFont(sFontName, pBulletFont->GetPitch(),
- eFamily, eChrSet, bWrtWW8);
- USHORT nFontID = maFontHelper.GetId(aPseudoFont);
-
- if (bWrtWW8)
- {
- InsUInt16(0x4a4f);
- InsUInt16(nFontID);
- InsUInt16(0x4a51);
- }
- else
- pO->Insert(93, pO->Count());
- InsUInt16(nFontID);
+ pPseudoFont = new wwFont( sFontName, pBulletFont->GetPitch(),
+ eFamily, eChrSet, HackIsWW8OrHigher() );
}
else
pOutSet = &rFmt.GetCharFmt()->GetAttrSet();
-
- Out_SfxItemSet(*pOutSet, false, true, i18n::ScriptType::LATIN);
-
- pO = pOldpO;
}
- nFlags = (BYTE)aCharAtrs.Count();
- *pTableStrm << nFlags;
-
- // cbGrpprlPapx
- nFlags = sizeof( aPapSprms );
- *pTableStrm << nFlags;
- // reserved
- SwWW8Writer::WriteShort( *pTableStrm, 0 );
+ sal_Int16 nIndentAt = 0;
+ sal_Int16 nFirstLineIndex = 0;
+ sal_Int16 nListTabPos = 0;
// --> OD 2008-06-03 #i86652#
- if ( rFmt.GetPositionAndSpaceMode() ==
- SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
- const sal_uInt16 nAbsLSpace = rFmt.GetAbsLSpace();
- const sal_Int16 nFirstLineOffset = GetWordFirstLineOffset(rFmt);
-
- // write Papx
- BYTE* pData = aPapSprms + 2;
- Set_UInt16( pData, nAbsLSpace );
- pData += 2;
- Set_UInt16( pData, nFirstLineOffset );
- pData += 5;
- Set_UInt16( pData, nAbsLSpace );
+ nIndentAt = nListTabPos = rFmt.GetAbsLSpace();
+ nFirstLineIndex = GetWordFirstLineOffset(rFmt);
}
- else if ( rFmt.GetPositionAndSpaceMode() ==
- SvxNumberFormat::LABEL_ALIGNMENT )
+ else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
- const sal_Int16 nIndentAt = static_cast<sal_Int16>(rFmt.GetIndentAt());
- const sal_Int16 nFirstLineIndenx = static_cast<sal_Int16>(rFmt.GetFirstLineIndent());
- const sal_Int16 nListTabPos =
- rFmt.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB
- ? static_cast<sal_Int16>(rFmt.GetListtabPos())
- : 0;
- // write Papx
- BYTE* pData = aPapSprms + 2;
- Set_UInt16( pData, nIndentAt );
- pData += 2;
- Set_UInt16( pData, nFirstLineIndenx );
- pData += 5;
- Set_UInt16( pData, nListTabPos );
+ nIndentAt = static_cast<sal_Int16>(rFmt.GetIndentAt());
+ nFirstLineIndex = static_cast<sal_Int16>(rFmt.GetFirstLineIndent());
+ nListTabPos = rFmt.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB?
+ static_cast<sal_Int16>( rFmt.GetListtabPos() ) : 0;
}
- pTableStrm->Write( aPapSprms, sizeof( aPapSprms ));
- // write Chpx
- if( aCharAtrs.Count() )
- pTableStrm->Write( aCharAtrs.GetData(), aCharAtrs.Count() );
-
- // write the num string
- SwWW8Writer::WriteShort(*pTableStrm, sNumStr.Len());
- SwWW8Writer::WriteString16(*pTableStrm, sNumStr, false);
+ AttrOutput().NumberingLevel( nLvl,
+ rFmt.GetStart(),
+ rFmt.GetNumberingType(),
+ rFmt.GetNumAdjust(),
+ aNumLvlPos,
+ nFollow,
+ pPseudoFont, pOutSet,
+ nIndentAt, nFirstLineIndex, nListTabPos,
+ sNumStr );
+
+ delete pPseudoFont;
}
+ AttrOutput().EndAbstractNumbering();
}
delete pConvert;
}
-void SwWW8Writer::OutOverrideListTab()
+void WW8Export::OutOverrideListTab()
{
if( !pUsedNumTbl )
return ; // no numbering is used
@@ -482,7 +539,7 @@ void SwWW8Writer::OutOverrideListTab()
pFib->lcbPlfLfo = pTableStrm->Tell() - pFib->fcPlfLfo;
}
-void SwWW8Writer::OutListNamesTab()
+void WW8Export::OutListNamesTab()
{
if( !pUsedNumTbl )
return ; // no numbering is used
@@ -515,8 +572,11 @@ void SwWW8Writer::OutListNamesTab()
// old WW95-Code
-void SwWW8Writer::Out_Olst( const SwNumRule& rRule )
+void WW8Export::OutputOlst( const SwNumRule& rRule )
{
+ if ( bWrtWW8 )
+ return;
+
static BYTE __READONLY_DATA aAnlvBase[] = { // Defaults
1,0,0, // Upper Roman
0x0C, // Hanging Indent, fPrev
@@ -545,13 +605,13 @@ void SwWW8Writer::Out_Olst( const SwNumRule& rRule )
}
-void SwWW8Writer::Out_WwNumLvl( BYTE nWwLevel )
+void WW8Export::Out_WwNumLvl( BYTE nWwLevel )
{
pO->Insert( 13, pO->Count() );
pO->Insert( nWwLevel, pO->Count() );
}
-void SwWW8Writer::Out_SwNumLvl( BYTE nSwLevel )
+void WW8Export::Out_SwNumLvl( BYTE nSwLevel )
{
// --> OD 2008-04-02 #refactorlists#
// ASSERT(IsNum(nSwLevel), "numbered?");
@@ -560,7 +620,7 @@ void SwWW8Writer::Out_SwNumLvl( BYTE nSwLevel )
Out_WwNumLvl( nSwLevel + 1 );
}
-void SwWW8Writer::BuildAnlvBulletBase(WW8_ANLV& rAnlv, BYTE*& rpCh,
+void WW8Export::BuildAnlvBulletBase(WW8_ANLV& rAnlv, BYTE*& rpCh,
USHORT& rCharLen, const SwNumFmt& rFmt)
{
ByteToSVBT8(11, rAnlv.nfc);
@@ -658,8 +718,8 @@ void SwWW8Writer::BuildAnlvBulletBase(WW8_ANLV& rAnlv, BYTE*& rpCh,
// <--
}
-void SwWW8Writer::SubstituteBullet(String& rNumStr,
- rtl_TextEncoding& rChrSet, String& rFontName) const
+void MSWordExportBase::SubstituteBullet( String& rNumStr,
+ rtl_TextEncoding& rChrSet, String& rFontName ) const
{
StarSymbolToMSMultiFont *pConvert = 0;
FontFamily eFamily = FAMILY_DECORATIVE;
@@ -686,7 +746,7 @@ void SwWW8Writer::SubstituteBullet(String& rNumStr,
rFontName = sFont;
rChrSet = RTL_TEXTENCODING_SYMBOL;
}
- else if ( bWrtWW8 &&
+ else if ( HackIsWW8OrHigher() &&
(rNumStr.GetChar(0) < 0xE000 || rNumStr.GetChar(0) > 0xF8FF) )
{
/*
@@ -730,11 +790,11 @@ static void SwWw8_InsertAnlText( const String& rStr, BYTE*& rpCh,
ByteToSVBT8( nb, r8Len );
}
-void SwWW8Writer::BuildAnlvBase(WW8_ANLV& rAnlv, BYTE*& rpCh,
+void WW8Export::BuildAnlvBase(WW8_ANLV& rAnlv, BYTE*& rpCh,
USHORT& rCharLen, const SwNumRule& rRul, const SwNumFmt& rFmt,
BYTE nSwLevel)
{
- ByteToSVBT8(SwWW8Writer::GetNumId(rFmt.GetNumberingType()), rAnlv.nfc);
+ ByteToSVBT8(WW8Export::GetNumId(rFmt.GetNumberingType()), rAnlv.nfc);
BYTE nb = 0;
switch (rFmt.GetNumAdjust())
@@ -802,7 +862,7 @@ void SwWW8Writer::BuildAnlvBase(WW8_ANLV& rAnlv, BYTE*& rpCh,
// <--
}
-void SwWW8Writer::Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFmt& rFmt,
+void WW8Export::Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFmt& rFmt,
BYTE nSwLevel )
{
static BYTE __READONLY_DATA aSprmAnldDefault[54] = {
@@ -830,7 +890,7 @@ void SwWW8Writer::Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFmt& rFmt,
// Return: ist es eine Gliederung ?
-bool SwWW8Writer::Out_SwNum(const SwTxtNode* pNd)
+bool WW8Export::Out_SwNum(const SwTxtNode* pNd)
{
int nLevel = pNd->GetActualListLevel();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 70c967d0ab9c..70756840603c 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -33,17 +33,10 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
-
-#ifndef __SGI_STL_ALGORITHM
#include <algorithm>
-#endif
-#ifndef __SGI_STL_FUNCTIONAL
#include <functional>
-#endif
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
#include <rtl/tencinfo.h>
#include <hintids.hxx>
#include <svx/boxitem.hxx>
@@ -76,16 +69,22 @@
#include <ftnidx.hxx>
#include <fmtclds.hxx>
#include <lineinfo.hxx>
+#include <fmtline.hxx>
+#include <swtable.hxx>
#include <msfilter.hxx>
-# include "writerhelper.hxx"
-# include "writerwordglue.hxx"
-# include "../inc/wwstyles.hxx"
+
+#include <writerfilter/doctok/sprmids.hxx>
+
+#include "writerhelper.hxx"
+#include "writerwordglue.hxx"
+#include "../inc/wwstyles.hxx"
#include "ww8par.hxx"
+#include "ww8attributeoutput.hxx"
+#include "docxattributeoutput.hxx"
using namespace sw::util;
using namespace nsHdFtFlags;
-
struct WW8_SED
{
SVBT16 aBits1; // orientation change + internal, Default: 6
@@ -97,13 +96,6 @@ struct WW8_SED
// cbSED is 12 (decimal)), C (hex).
};
-struct WW8_PdAttrDesc
-{
- BYTE* pData;
- USHORT nLen;
- WW8_FC nSepxFcPos;
-};
-
SV_IMPL_VARARR( WW8_WrSepInfoPtrs, WW8_SepInfo )
// class WW8_WrPlc0 ist erstmal nur fuer Header / Footer-Positionen, d.h. es
@@ -132,89 +124,91 @@ public:
// GetId( SwCharFmt ) zur Benutzung im Text -> nil verboten,
// "Default Char Style" stattdessen
-USHORT SwWW8Writer::GetId( const SwCharFmt& rFmt ) const
+USHORT MSWordExportBase::GetId( const SwCharFmt& rFmt ) const
{
- USHORT nRet = pStyles->Sty_GetWWSlot( rFmt );
+ USHORT nRet = pStyles->GetSlot( rFmt );
return ( nRet != 0x0fff ) ? nRet : 10; // Default Char Style
}
// GetId( SwTxtFmtColl ) zur Benutzung an TextNodes -> nil verboten,
// "Standard" stattdessen
-USHORT SwWW8Writer::GetId( const SwTxtFmtColl& rColl ) const
+USHORT MSWordExportBase::GetId( const SwTxtFmtColl& rColl ) const
{
- USHORT nRet = pStyles->Sty_GetWWSlot( rColl );
+ USHORT nRet = pStyles->GetSlot( rColl );
return ( nRet != 0xfff ) ? nRet : 0; // Default TxtFmtColl
}
//typedef pFmtT
-WW8WrtStyle::WW8WrtStyle( SwWW8Writer& rWr )
- : rWrt( rWr ), nPOPosStdLen1( 0 ), nPOPosStdLen2( 0 )
+MSWordStyles::MSWordStyles( MSWordExportBase& rExport )
+ : m_rExport( rExport )
{
- rWrt.pO->Remove( 0, rWrt.pO->Count() ); // leeren
- SwDoc& rDoc = *rWrt.pDoc;
-
// if exist any Foot-/End-Notes then get from the EndNoteInfo struct
// the CharFormats. They will create it!
- if( rDoc.GetFtnIdxs().Count() )
+ if ( m_rExport.pDoc->GetFtnIdxs().Count() )
{
- rDoc.GetEndNoteInfo().GetAnchorCharFmt( rDoc );
- rDoc.GetEndNoteInfo().GetCharFmt( rDoc );
- rDoc.GetFtnInfo().GetAnchorCharFmt( rDoc );
- rDoc.GetFtnInfo().GetCharFmt( rDoc );
+ m_rExport.pDoc->GetEndNoteInfo().GetAnchorCharFmt( *m_rExport.pDoc );
+ m_rExport.pDoc->GetEndNoteInfo().GetCharFmt( *m_rExport.pDoc );
+ m_rExport.pDoc->GetFtnInfo().GetAnchorCharFmt( *m_rExport.pDoc );
+ m_rExport.pDoc->GetFtnInfo().GetCharFmt( *m_rExport.pDoc );
}
- USHORT nAlloc = WW8_RESERVED_SLOTS + rDoc.GetCharFmts()->Count() - 1 +
- rDoc.GetTxtFmtColls()->Count() - 1;
- // etwas grosszuegig ( bis zu 15 frei )
+ USHORT nAlloc = WW8_RESERVED_SLOTS + m_rExport.pDoc->GetCharFmts()->Count() - 1 +
+ m_rExport.pDoc->GetTxtFmtColls()->Count() - 1;
+
+ // etwas grosszuegig ( bis zu 15 frei )
pFmtA = new SwFmt*[ nAlloc ];
memset( pFmtA, 0, nAlloc * sizeof( SwFmt* ) );
- BuildStyleTab();
+
+ BuildStylesTable();
}
-WW8WrtStyle::~WW8WrtStyle()
+MSWordStyles::~MSWordStyles()
{
delete[] pFmtA;
- rWrt.pO->Remove( 0, rWrt.pO->Count() ); // leeren
}
// Sty_SetWWSlot() fuer Abhaengigkeiten der Styles -> nil ist erlaubt
-USHORT WW8WrtStyle::Sty_GetWWSlot( const SwFmt& rFmt ) const
+USHORT MSWordStyles::GetSlot( const SwFmt& rFmt ) const
{
USHORT n;
- for( n = 0; n < nUsedSlots; n++ )
- if( pFmtA[n] == &rFmt )
+ for ( n = 0; n < nUsedSlots; n++ )
+ if ( pFmtA[n] == &rFmt )
return n;
return 0xfff; // 0xfff: WW: nil
}
-USHORT WW8WrtStyle::Build_GetWWSlot( const SwFmt& rFmt )
+USHORT MSWordStyles::BuildGetSlot( const SwFmt& rFmt )
{
USHORT nRet;
- switch( nRet = rFmt.GetPoolFmtId() )
- {
- case RES_POOLCOLL_STANDARD: nRet = 0; break;
-
- case RES_POOLCOLL_HEADLINE1:
- case RES_POOLCOLL_HEADLINE2:
- case RES_POOLCOLL_HEADLINE3:
- case RES_POOLCOLL_HEADLINE4:
- case RES_POOLCOLL_HEADLINE5:
- case RES_POOLCOLL_HEADLINE6:
- case RES_POOLCOLL_HEADLINE7:
- case RES_POOLCOLL_HEADLINE8:
- case RES_POOLCOLL_HEADLINE9: nRet -= RES_POOLCOLL_HEADLINE1-1; break;
-
-// case RES_POOLCHR_FOOTNOTE_ANCHOR: nRet =
-// case RES_POOLCHR_ENDNOTE_ANCHOR:
- default:
- nRet = nUsedSlots++;
- break;
+ switch ( nRet = rFmt.GetPoolFmtId() )
+ {
+ case RES_POOLCOLL_STANDARD:
+ nRet = 0;
+ break;
+
+ case RES_POOLCOLL_HEADLINE1:
+ case RES_POOLCOLL_HEADLINE2:
+ case RES_POOLCOLL_HEADLINE3:
+ case RES_POOLCOLL_HEADLINE4:
+ case RES_POOLCOLL_HEADLINE5:
+ case RES_POOLCOLL_HEADLINE6:
+ case RES_POOLCOLL_HEADLINE7:
+ case RES_POOLCOLL_HEADLINE8:
+ case RES_POOLCOLL_HEADLINE9:
+ nRet -= RES_POOLCOLL_HEADLINE1-1;
+ break;
+
+ //case RES_POOLCHR_FOOTNOTE_ANCHOR: nRet =
+ //case RES_POOLCHR_ENDNOTE_ANCHOR:
+ default:
+ nRet = nUsedSlots++;
+ break;
}
return nRet;
}
-USHORT WW8WrtStyle::GetWWId( const SwFmt& rFmt ) const
+USHORT MSWordStyles::GetWWId( const SwFmt& rFmt ) const
{
USHORT nRet = ww::stiUser; // User-Style als default
USHORT nPoolId = rFmt.GetPoolFmtId();
@@ -262,45 +256,52 @@ USHORT WW8WrtStyle::GetWWId( const SwFmt& rFmt ) const
return nRet;
}
-void WW8WrtStyle::BuildStyleTab()
+void MSWordStyles::BuildStylesTable()
{
nUsedSlots = WW8_RESERVED_SLOTS; // soviele sind reserviert fuer
// Standard und HeadingX u.a.
SwFmt* pFmt;
USHORT n;
- const SvPtrarr& rArr = *rWrt.pDoc->GetCharFmts(); // erst CharFmt
- // das Default-ZeichenStyle ( 0 ) wird nicht mit ausgegeben !
+ const SvPtrarr& rArr = *m_rExport.pDoc->GetCharFmts(); // erst CharFmt
+ // das Default-ZeichenStyle ( 0 ) wird nicht mit ausgegeben !
for( n = 1; n < rArr.Count(); n++ )
{
pFmt = (SwFmt*)rArr[n];
- pFmtA[ Build_GetWWSlot( *pFmt ) ] = pFmt;
+ pFmtA[ BuildGetSlot( *pFmt ) ] = pFmt;
}
- const SvPtrarr& rArr2 = *rWrt.pDoc->GetTxtFmtColls(); // dann TxtFmtColls
- // das Default-TextStyle ( 0 ) wird nicht mit ausgegeben !
+
+ const SvPtrarr& rArr2 = *m_rExport.pDoc->GetTxtFmtColls(); // dann TxtFmtColls
+ // das Default-TextStyle ( 0 ) wird nicht mit ausgegeben !
for( n = 1; n < rArr2.Count(); n++ )
{
pFmt = (SwFmt*)rArr2[n];
- pFmtA[ Build_GetWWSlot( *pFmt ) ] = pFmt;
+ pFmtA[ BuildGetSlot( *pFmt ) ] = pFmt;
}
}
-void WW8WrtStyle::WriteStyle( SvStream& rStrm )
+/// For WW8 only - extend pO so that the size of pTableStrm is even.
+static void impl_SkipOdd( WW8Bytes* pO, sal_Size nTableStrmTell )
+{
+ if ( ( nTableStrmTell + pO->Count() ) & 1 ) // Start auf gerader
+ pO->Insert( (BYTE)0, pO->Count() ); // Adresse
+}
+
+void WW8AttributeOutput::EndStyle()
{
- WW8Bytes* pO = rWrt.pO;
+ impl_SkipOdd( m_rWW8Export.pO, m_rWW8Export.pTableStrm->Tell() );
- short nLen = pO->Count() - 2; // Laenge des Styles
- BYTE* p = (BYTE*)pO->GetData() + nPOPosStdLen1;
+ short nLen = m_rWW8Export.pO->Count() - 2; // Laenge des Styles
+ BYTE* p = (BYTE*)m_rWW8Export.pO->GetData() + nPOPosStdLen1;
ShortToSVBT16( nLen, p ); // nachtragen
- p = (BYTE*)pO->GetData() + nPOPosStdLen2;
+ p = (BYTE*)m_rWW8Export.pO->GetData() + nPOPosStdLen2;
ShortToSVBT16( nLen, p ); // dito
- rStrm.Write( pO->GetData(), pO->Count() ); // ins File damit
- pO->Remove( 0, pO->Count() ); // leeren fuer naechsten
+ m_rWW8Export.pTableStrm->Write( m_rWW8Export.pO->GetData(), m_rWW8Export.pO->Count() ); // ins File damit
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren fuer naechsten
}
-
-void WW8WrtStyle::BuildStd(const String& rName, bool bPapFmt, short nWwBase,
- short nWwNext, USHORT nWwId)
+void WW8AttributeOutput::StartStyle( const String& rName, bool bPapFmt, USHORT nWwBase,
+ USHORT nWwNext, USHORT nWwId, USHORT /*nId*/ )
{
BYTE aWW8_STD[ sizeof( WW8_STD ) ];
BYTE* pData = aWW8_STD;
@@ -320,7 +321,7 @@ void WW8WrtStyle::BuildStd(const String& rName, bool bPapFmt, short nWwBase,
pData += sizeof( UINT16 ); // bchUpe
- if( rWrt.bWrtWW8 )
+ if( m_rWW8Export.bWrtWW8 )
{
//-------- jetzt neu:
// ab Ver8 gibts zwei Felder mehr:
@@ -332,9 +333,9 @@ void WW8WrtStyle::BuildStd(const String& rName, bool bPapFmt, short nWwBase,
UINT16 nLen = static_cast< UINT16 >( ( pData - aWW8_STD ) + 1 +
- ((rWrt.bWrtWW8 ? 2 : 1 ) * (rName.Len() + 1)) ); // vorlaeufig
+ ((m_rWW8Export.bWrtWW8 ? 2 : 1 ) * (rName.Len() + 1)) ); // vorlaeufig
- WW8Bytes* pO = rWrt.pO;
+ WW8Bytes* pO = m_rWW8Export.pO;
nPOPosStdLen1 = pO->Count(); // Adr1 zum nachtragen der Laenge
SwWW8Writer::InsUInt16( *pO, nLen );
@@ -343,7 +344,7 @@ void WW8WrtStyle::BuildStd(const String& rName, bool bPapFmt, short nWwBase,
nPOPosStdLen2 = nPOPosStdLen1 + 8; // Adr2 zum nachtragen von "end of upx"
// Namen schreiben
- if( rWrt.bWrtWW8 )
+ if( m_rWW8Export.bWrtWW8 )
{
SwWW8Writer::InsUInt16( *pO, rName.Len() ); // Laenge
SwWW8Writer::InsAsString16( *pO, rName );
@@ -356,17 +357,10 @@ void WW8WrtStyle::BuildStd(const String& rName, bool bPapFmt, short nWwBase,
pO->Insert( (BYTE)0, pO->Count() ); // Trotz P-String 0 am Ende!
}
-void WW8WrtStyle::SkipOdd() // Ruecke zu gerader Adresse vor
+void MSWordStyles::SetStyleDefaults( const SwFmt& rFmt, bool bPap )
{
- WW8Bytes* pO = rWrt.pO;
- if( ( rWrt.pTableStrm->Tell() + pO->Count() ) & 1 ) // Start auf gerader
- pO->Insert( (BYTE)0, pO->Count() ); // Adresse
-}
-
-void WW8WrtStyle::Set1StyleDefaults(const SwFmt& rFmt, bool bPap)
-{
- const SwModify* pOldMod = rWrt.pOutFmtNode;
- rWrt.pOutFmtNode = &rFmt;
+ const SwModify* pOldMod = m_rExport.pOutFmtNode;
+ m_rExport.pOutFmtNode = &rFmt;
bool aFlags[ static_cast< USHORT >(RES_FRMATR_END) - RES_CHRATR_BEGIN ];
USHORT nStt, nEnd, n;
if( bPap )
@@ -391,89 +385,101 @@ void WW8WrtStyle::Set1StyleDefaults(const SwFmt& rFmt, bool bPap)
aFlags[ RES_CHRATR_LANGUAGE - RES_CHRATR_BEGIN ] = 1;
}
- const SfxItemSet* pOldI = rWrt.GetCurItemSet();
- rWrt.SetCurItemSet( &rFmt.GetAttrSet() );
+ const SfxItemSet* pOldI = m_rExport.GetCurItemSet();
+ m_rExport.SetCurItemSet( &rFmt.GetAttrSet() );
const bool* pFlags = aFlags + ( nStt - RES_CHRATR_BEGIN );
- for( n = nStt; n < nEnd; ++n, ++pFlags )
+ for ( n = nStt; n < nEnd; ++n, ++pFlags )
{
- if( *pFlags && SFX_ITEM_SET != rFmt.GetItemState(n, false))
+ if ( *pFlags && SFX_ITEM_SET != rFmt.GetItemState(n, false))
{
//If we are a character property then see if it is one of the
//western/asian ones that must be collapsed together for export to
//word. If so default to the western varient.
- if ( bPap || rWrt.CollapseScriptsforWordOk(
+ if ( bPap || m_rExport.CollapseScriptsforWordOk(
i18n::ScriptType::LATIN, n) )
{
- Out(aWW8AttrFnTab, rFmt.GetFmtAttr(n, true), rWrt);
+ m_rExport.AttrOutput().OutputItem( rFmt.GetFmtAttr( n, true ) );
}
}
}
- rWrt.SetCurItemSet( pOldI );
- rWrt.pOutFmtNode = pOldMod;
+ m_rExport.SetCurItemSet( pOldI );
+ m_rExport.pOutFmtNode = pOldMod;
}
-void WW8WrtStyle::BuildUpx(const SwFmt* pFmt, bool bPap, USHORT nPos,
- bool bInsDefCharSiz)
+void WW8AttributeOutput::StartStyleProperties( bool bParProp, USHORT nStyle )
{
- WW8Bytes* pO = rWrt.pO;
+ WW8Bytes* pO = m_rWW8Export.pO;
- SkipOdd();
- UINT16 nLen = ( bPap ) ? 2 : 0; // Default-Laenge
- USHORT nLenPos = pO->Count(); // Laenge zum Nachtragen
+ impl_SkipOdd( pO, m_rWW8Export.pTableStrm->Tell() );
+
+ UINT16 nLen = ( bParProp ) ? 2 : 0; // Default-Laenge
+ m_nStyleLenPos = pO->Count(); // Laenge zum Nachtragen
// Keinen Pointer merken, da sich bei
// _grow der Pointer aendert !
SwWW8Writer::InsUInt16( *pO, nLen ); // Style-Len
- UINT16 nStartSiz = pO->Count();
+ m_nStyleStartSize = pO->Count();
- if( bPap )
- SwWW8Writer::InsUInt16( *pO, nPos); // Style-Nummer
+ if ( bParProp )
+ SwWW8Writer::InsUInt16( *pO, nStyle ); // Style-Nummer
+}
+
+void MSWordStyles::WriteProperties( const SwFmt* pFmt, bool bParProp, USHORT nPos,
+ bool bInsDefCharSiz )
+{
+ m_rExport.AttrOutput().StartStyleProperties( bParProp, nPos );
+
+ ASSERT( m_rExport.pCurrentStyle == NULL, "Current style not NULL" ); // set current style before calling out
+ m_rExport.pCurrentStyle = pFmt;
+
+ m_rExport.OutputFormat( *pFmt, bParProp, !bParProp );
+
+ ASSERT( m_rExport.pCurrentStyle != pFmt, "current style was changed" ); // reset current style...
+ m_rExport.pCurrentStyle = NULL;
+
+ if ( bInsDefCharSiz ) // nicht abgeleitet v. anderem Style
+ SetStyleDefaults( *pFmt, bParProp );
- rWrt.Out_SwFmt( *pFmt, bPap, !bPap );
+ m_rExport.AttrOutput().EndStyleProperties( bParProp );
+}
- if( bInsDefCharSiz ) // nicht abgeleitet v. anderem Style
- Set1StyleDefaults( *pFmt, bPap );
+void WW8AttributeOutput::EndStyleProperties( bool /*bParProp*/ )
+{
+ WW8Bytes* pO = m_rWW8Export.pO;
- nLen = pO->Count() - nStartSiz;
- BYTE* pUpxLen = (BYTE*)pO->GetData() + nLenPos; // Laenge zum Nachtragen
+ UINT16 nLen = pO->Count() - m_nStyleStartSize;
+ BYTE* pUpxLen = (BYTE*)pO->GetData() + m_nStyleLenPos; // Laenge zum Nachtragen
ShortToSVBT16( nLen, pUpxLen ); // Default-Laenge eintragen
}
-// Out1Style geht fuer TxtFmtColls und CharFmts
-void WW8WrtStyle::Out1Style( SwFmt* pFmt, USHORT nPos )
+void MSWordStyles::GetStyleData( SwFmt* pFmt, bool& bFmtColl, USHORT& nBase, USHORT& nNext )
{
- if( pFmt )
- {
- bool bFmtColl = pFmt->Which() == RES_TXTFMTCOLL ||
- pFmt->Which() == RES_CONDTXTFMTCOLL;
- short nWwBase = 0xfff; // Default: none
+ bFmtColl = pFmt->Which() == RES_TXTFMTCOLL || pFmt->Which() == RES_CONDTXTFMTCOLL;
- if( !pFmt->IsDefault() ) // Abgeleitet von ?
- nWwBase = Sty_GetWWSlot( *pFmt->DerivedFrom() );
+ // Default: none
+ nBase = 0xfff;
- SwFmt* pNext;
- if( bFmtColl )
- pNext = &((SwTxtFmtColl*)pFmt)->GetNextTxtFmtColl();
- else
- pNext = pFmt; // CharFmt: Naechstes CharFmt == Selbes
+ // Derived from?
+ if ( !pFmt->IsDefault() )
+ nBase = GetSlot( *pFmt->DerivedFrom() );
- short nWwNext = Sty_GetWWSlot( *pNext );
+ SwFmt* pNext;
+ if ( bFmtColl )
+ pNext = &((SwTxtFmtColl*)pFmt)->GetNextTxtFmtColl();
+ else
+ pNext = pFmt; // CharFmt: next CharFmt == self
- BuildStd( pFmt->GetName(), bFmtColl, nWwBase, nWwNext,
- GetWWId( *pFmt ) );
- if( bFmtColl )
- BuildUpx( pFmt, true, nPos, nWwBase==0xfff ); // UPX.papx
- BuildUpx( pFmt, false, nPos, bFmtColl && nWwBase==0xfff ); // UPX.chpx
+ nNext = GetSlot( *pNext );
+}
- SkipOdd();
- WriteStyle( *rWrt.pTableStrm );
- }
- else if( nPos == 10 ) // Default Char-Style ( nur WW )
+void WW8AttributeOutput::DefaultStyle( USHORT nStyle )
+{
+ if ( nStyle == 10 ) // Default Char-Style ( nur WW )
{
- if( rWrt.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
static BYTE __READONLY_DATA aDefCharSty[] = {
0x42, 0x00,
@@ -486,7 +492,7 @@ void WW8WrtStyle::Out1Style( SwFmt* pFmt, USHORT nPos )
0x72, 0x00, 0x69, 0x00, 0x66, 0x00, 0x74, 0x00,
0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x00, 0x00,
0x00, 0x00 };
- rWrt.pTableStrm->Write( &aDefCharSty, sizeof( aDefCharSty ) );
+ m_rWW8Export.pTableStrm->Write( &aDefCharSty, sizeof( aDefCharSty ) );
}
else
{
@@ -497,31 +503,54 @@ void WW8WrtStyle::Out1Style( SwFmt* pFmt, USHORT nPos )
0x53, 0x74, 0x61, 0x6E, 0x64, 0x61, 0x72, 0x64,
0x73, 0x63, 0x68, 0x72, 0x69, 0x66, 0x74, 0x61,
0x72, 0x74, 0x00, 0x00, 0x00, 0x00 };
- rWrt.pTableStrm->Write( &aDefCharSty, sizeof( aDefCharSty ) );
+ m_rWW8Export.pTableStrm->Write( &aDefCharSty, sizeof( aDefCharSty ) );
}
}
else
{
UINT16 n = 0;
- rWrt.pTableStrm->Write( &n , 2 ); // leerer Style
+ m_rWW8Export.pTableStrm->Write( &n , 2 ); // leerer Style
}
}
-void WW8WrtStyle::OutStyleTab()
+// OutputStyle geht fuer TxtFmtColls und CharFmts
+void MSWordStyles::OutputStyle( SwFmt* pFmt, USHORT nPos )
{
- WW8Fib& rFib = *rWrt.pFib;
+ if ( !pFmt )
+ m_rExport.AttrOutput().DefaultStyle( nPos );
+ else
+ {
+ bool bFmtColl;
+ USHORT nBase, nWwNext;
+
+ GetStyleData( pFmt, bFmtColl, nBase, nWwNext );
+
+ m_rExport.AttrOutput().StartStyle( pFmt->GetName(), bFmtColl,
+ nBase, nWwNext, GetWWId( *pFmt ), nPos );
- ULONG nCurPos = rWrt.pTableStrm->Tell();
- if( nCurPos & 1 ) // Start auf gerader
+ if ( bFmtColl )
+ WriteProperties( pFmt, true, nPos, nBase==0xfff ); // UPX.papx
+
+ WriteProperties( pFmt, false, nPos, bFmtColl && nBase==0xfff ); // UPX.chpx
+
+ m_rExport.AttrOutput().EndStyle();
+ }
+}
+
+void WW8AttributeOutput::StartStyles()
+{
+ WW8Fib& rFib = *m_rWW8Export.pFib;
+
+ ULONG nCurPos = m_rWW8Export.pTableStrm->Tell();
+ if ( nCurPos & 1 ) // Start auf gerader
{
- *rWrt.pTableStrm << (char)0; // Adresse
+ *m_rWW8Export.pTableStrm << (char)0; // Adresse
++nCurPos;
}
- rWrt.bStyDef = true;
rFib.fcStshfOrig = rFib.fcStshf = nCurPos;
- ULONG nStyAnzPos = nCurPos + 2; // Anzahl wird nachgetragen
+ m_nStyAnzPos = nCurPos + 2; // Anzahl wird nachgetragen
- if( rWrt.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
static BYTE __READONLY_DATA aStShi[] = {
0x12, 0x00,
@@ -529,7 +558,7 @@ void WW8WrtStyle::OutStyleTab()
0x0F, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00 };
- rWrt.pTableStrm->Write( &aStShi, sizeof( aStShi ) );
+ m_rWW8Export.pTableStrm->Write( &aStShi, sizeof( aStShi ) );
}
else
{
@@ -537,16 +566,31 @@ void WW8WrtStyle::OutStyleTab()
0x0E, 0x00,
0x0F, 0x00, 0x08, 0x00, 0x01, 0x00, 0x4B, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x00, 0x00 };
- rWrt.pTableStrm->Write( &aStShi, sizeof( aStShi ) );
+ m_rWW8Export.pTableStrm->Write( &aStShi, sizeof( aStShi ) );
}
+}
+
+void WW8AttributeOutput::EndStyles( USHORT nNumberOfStyles )
+{
+ WW8Fib& rFib = *m_rWW8Export.pFib;
+
+ rFib.lcbStshfOrig = rFib.lcbStshf = m_rWW8Export.pTableStrm->Tell() - rFib.fcStshf;
+ SwWW8Writer::WriteShort( *m_rWW8Export.pTableStrm, m_nStyAnzPos, nNumberOfStyles );
+}
+
+void MSWordStyles::OutputStylesTable()
+{
+ m_rExport.bStyDef = true;
+
+ m_rExport.AttrOutput().StartStyles();
USHORT n;
- for( n = 0; n < nUsedSlots; n++ )
- Out1Style( pFmtA[n], n );
+ for ( n = 0; n < nUsedSlots; n++ )
+ OutputStyle( pFmtA[n], n );
- rFib.lcbStshfOrig = rFib.lcbStshf = rWrt.pTableStrm->Tell() - rFib.fcStshf;
- SwWW8Writer::WriteShort( *rWrt.pTableStrm, nStyAnzPos, nUsedSlots );
- rWrt.bStyDef = false;
+ m_rExport.AttrOutput().EndStyles( nUsedSlots );
+
+ m_rExport.bStyDef = false;
}
/* */
@@ -555,7 +599,7 @@ void WW8WrtStyle::OutStyleTab()
// Fonts
//---------------------------------------------------------------------------
wwFont::wwFont(const String &rFamilyName, FontPitch ePitch, FontFamily eFamily,
- rtl_TextEncoding eChrSet, bool bWrtWW8) : mbAlt(false), mbWrtWW8(bWrtWW8)
+ rtl_TextEncoding eChrSet, bool bWrtWW8) : mbAlt(false), mbWrtWW8(bWrtWW8), mePitch(ePitch), meFamily(eFamily), meChrSet(eChrSet)
{
FontMapExport aResult(rFamilyName);
msFamilyNm = aResult.msPrimary;
@@ -653,6 +697,23 @@ bool wwFont::Write(SvStream *pTableStrm) const
return true;
}
+#ifdef DOCX
+void wwFont::WriteDocx( const DocxAttributeOutput* rAttrOutput ) const
+{
+ // no font embedding, panose id, subsetting, ... implemented
+
+ rAttrOutput->StartFont( msFamilyNm );
+
+ if ( mbAlt )
+ rAttrOutput->FontAlternateName( msAltNm );
+ rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ) );
+ rAttrOutput->FontFamilyType( meFamily );
+ rAttrOutput->FontPitchType( mePitch );
+
+ rAttrOutput->EndFont();
+}
+#endif
+
bool operator<(const wwFont &r1, const wwFont &r2)
{
int nRet = memcmp(r1.maWW8_FFN, r2.maWW8_FFN, sizeof(r1.maWW8_FFN));
@@ -721,6 +782,18 @@ USHORT wwFontHelper::GetId(const SvxFontItem& rFont)
return GetId(aFont);
}
+::std::vector< const wwFont* > wwFontHelper::AsVector() const
+{
+ ::std::vector<const wwFont *> aFontList( maFonts.size() );
+
+ typedef ::std::map<wwFont, USHORT>::const_iterator myiter;
+ myiter aEnd = maFonts.end();
+ for ( myiter aIter = maFonts.begin(); aIter != aEnd; ++aIter )
+ aFontList[aIter->second] = &aIter->first;
+
+ return aFontList;
+}
+
void wwFontHelper::WriteFontTable(SvStream *pTableStream, WW8Fib& rFib)
{
rFib.fcSttbfffn = pTableStream->Tell();
@@ -736,12 +809,7 @@ void wwFontHelper::WriteFontTable(SvStream *pTableStream, WW8Fib& rFib)
* Convert from fast insertion map to linear vector in the order that we
* want to write.
*/
- ::std::vector<const wwFont *> aFontList(maFonts.size());
-
- typedef ::std::map<wwFont, USHORT>::iterator myiter;
- myiter aEnd = maFonts.end();
- for(myiter aIter = maFonts.begin(); aIter != aEnd; ++aIter)
- aFontList[aIter->second] = &aIter->first;
+ ::std::vector<const wwFont *> aFontList( AsVector() );
/*
* Write them all to pTableStream
@@ -762,6 +830,16 @@ void wwFontHelper::WriteFontTable(SvStream *pTableStream, WW8Fib& rFib)
}
}
+#ifdef DOCX
+void wwFontHelper::WriteFontTable( const DocxAttributeOutput& rAttrOutput )
+{
+ ::std::vector<const wwFont *> aFontList( AsVector() );
+
+ ::std::for_each( aFontList.begin(), aFontList.end(),
+ ::std::bind2nd( ::std::mem_fun( &wwFont::WriteDocx ), &rAttrOutput ) );
+}
+#endif
+
/* */
WW8_WrPlc0::WW8_WrPlc0( ULONG nOffset )
@@ -789,13 +867,71 @@ void WW8_WrPlc0::Write( SvStream& rStrm )
/* */
//------------------------------------------------------------------------------
-// class WW8_WrPlcSepx : Uebersetzung PageDescs in Sections
+// class MSWordSections : Uebersetzung PageDescs in Sections
// behandelt auch Header und Footer
//------------------------------------------------------------------------------
-WW8_WrPlcSepx::WW8_WrPlcSepx() :
- mbDocumentIsProtected(false), aSects(4, 4), aCps(4, 4), pAttrs(0),
- pTxtPos(0)
+MSWordSections::MSWordSections( MSWordExportBase& rExport )
+ : mbDocumentIsProtected( false ),
+ aSects( 4, 4 )
+{
+ const SwSectionFmt *pFmt = 0;
+ rExport.pAktPageDesc = &const_cast<const SwDoc *>(rExport.pDoc)->GetPageDesc( 0 );
+
+ const SfxPoolItem* pI;
+ const SwNode* pNd = rExport.pCurPam->GetCntntNode();
+ const SfxItemSet* pSet = pNd ? &((SwCntntNode*)pNd)->GetSwAttrSet() : 0;
+
+ ULONG nRstLnNum = pSet ? ((SwFmtLineNumber&)pSet->Get( RES_LINENUMBER )).GetStartValue() : 0;
+
+ const SwTableNode* pTblNd = rExport.pCurPam->GetNode()->FindTableNode();
+ const SwSectionNode* pSectNd;
+ if ( pTblNd )
+ {
+ pSet = &pTblNd->GetTable().GetFrmFmt()->GetAttrSet();
+ pNd = pTblNd;
+ }
+ else if ( 0 != ( pSectNd = pNd->FindSectionNode() ) )
+ {
+ if ( TOX_HEADER_SECTION == pSectNd->GetSection().GetType() &&
+ pSectNd->StartOfSectionNode()->IsSectionNode() )
+ {
+ pSectNd = pSectNd->StartOfSectionNode()->GetSectionNode();
+ }
+
+ if ( TOX_CONTENT_SECTION == pSectNd->GetSection().GetType() )
+ {
+ pNd = pSectNd;
+ rExport.pCurPam->GetPoint()->nNode = *pNd;
+ }
+
+ if ( CONTENT_SECTION == pSectNd->GetSection().GetType() )
+ pFmt = pSectNd->GetSection().GetFmt();
+ }
+
+ // Hole evtl. Pagedesc des 1. Nodes
+ if ( pSet &&
+ SFX_ITEM_ON == pSet->GetItemState( RES_PAGEDESC, true, &pI ) &&
+ ( (SwFmtPageDesc*)pI )->GetPageDesc() )
+ {
+ AppendSep( *(SwFmtPageDesc*)pI, *pNd, pFmt, nRstLnNum );
+ }
+ else
+ AppendSep( rExport.pAktPageDesc, pFmt, nRstLnNum );
+}
+
+WW8_WrPlcSepx::WW8_WrPlcSepx( MSWordExportBase& rExport )
+ : MSWordSections( rExport ),
+ aCps( 4, 4 ),
+ pAttrs( 0 ),
+ pTxtPos( 0 )
+{
+ // to be in sync with the AppendSep() call in the MSWordSections
+ // constructor
+ aCps.Insert( ULONG( 0 ), aCps.Count() );
+}
+
+MSWordSections::~MSWordSections()
{
}
@@ -811,79 +947,93 @@ WW8_WrPlcSepx::~WW8_WrPlcSepx()
delete pTxtPos;
}
-sal_uInt16 WW8_WrPlcSepx::CurrentNoColumns(const SwDoc &rDoc) const
+sal_uInt16 MSWordSections::CurrentNumberOfColumns( const SwDoc &rDoc ) const
{
- ASSERT(aSects.Count(), "no segement inserted yet");
- if (!aSects.Count())
+ ASSERT( aSects.Count(), "no segement inserted yet" );
+ if ( !aSects.Count() )
return 1;
- WW8_SepInfo& rInfo = aSects[aSects.Count() - 1];
+ return NumberOfColumns( rDoc, aSects[aSects.Count() - 1] );
+}
+
+sal_uInt16 MSWordSections::NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo& rInfo ) const
+{
const SwPageDesc* pPd = rInfo.pPageDesc;
- if (!pPd)
- pPd = &rDoc.GetPageDesc(0);
+ if ( !pPd )
+ pPd = &rDoc.GetPageDesc( 0 );
- if (!pPd)
+ if ( !pPd )
{
- ASSERT(pPd, "totally impossible");
+ ASSERT( pPd, "totally impossible" );
return 1;
}
const SfxItemSet &rSet = pPd->GetMaster().GetAttrSet();
- SfxItemSet aSet(*rSet.GetPool(), RES_COL, RES_COL);
- aSet.SetParent(&rSet);
+ SfxItemSet aSet( *rSet.GetPool(), RES_COL, RES_COL );
+ aSet.SetParent( &rSet );
//0xffffffff, what the hell is going on with that!, fixme most terribly
- if (rInfo.pSectionFmt && (SwSectionFmt*)0xFFFFFFFF != rInfo.pSectionFmt)
- aSet.Put(rInfo.pSectionFmt->GetFmtAttr(RES_COL));
+ if ( rInfo.pSectionFmt && (SwSectionFmt*)0xFFFFFFFF != rInfo.pSectionFmt )
+ aSet.Put( rInfo.pSectionFmt->GetFmtAttr( RES_COL ) );
- const SwFmtCol& rCol = (const SwFmtCol&)aSet.Get(RES_COL);
+ const SwFmtCol& rCol = (const SwFmtCol&)aSet.Get( RES_COL );
const SwColumns& rColumns = rCol.GetColumns();
return rColumns.Count();
}
-void WW8_WrPlcSepx::AppendSep(WW8_CP nStartCp, const SwPageDesc* pPd,
- const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo)
+const WW8_SepInfo* MSWordSections::CurrentSectionInfo()
{
- aCps.Insert(nStartCp, aCps.Count());
- aSects.Insert(WW8_SepInfo(pPd, pSectionFmt, nLnNumRestartNo),
- aSects.Count());
- NeedsDocumentProtected(aSects[aSects.Count()-1]);
+ if ( aSects.Count() > 0 )
+ return &aSects[aSects.Count() - 1];
+
+ return NULL;
+}
+
+void MSWordSections::AppendSep( const SwPageDesc* pPd,
+ const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo )
+{
+ aSects.Insert( WW8_SepInfo( pPd, pSectionFmt, nLnNumRestartNo ),
+ aSects.Count() );
+ NeedsDocumentProtected( aSects[aSects.Count()-1] );
+}
+
+void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwPageDesc* pPd,
+ const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo )
+{
+ aCps.Insert( nStartCp, aCps.Count() );
+
+ MSWordSections::AppendSep( pPd, pSectionFmt, nLnNumRestartNo );
+}
+
+void MSWordSections::AppendSep( const SwFmtPageDesc& rPD,
+ const SwNode& rNd, const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo )
+{
+ WW8_SepInfo aI( rPD.GetPageDesc(), pSectionFmt, nLnNumRestartNo,
+ rPD.GetNumOffset(), &rNd );
+ aSects.Insert( aI, aSects.Count() );
+ NeedsDocumentProtected( aI );
}
void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFmtPageDesc& rPD,
const SwNode& rNd, const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo )
{
aCps.Insert(nStartCp, aCps.Count());
- WW8_SepInfo aI(rPD.GetPageDesc(), pSectionFmt, nLnNumRestartNo);
- aI.nPgRestartNo = rPD.GetNumOffset();
- aI.pPDNd = &rNd;
- aSects.Insert(aI, aSects.Count());
- NeedsDocumentProtected(aI);
+
+ MSWordSections::AppendSep( rPD, rNd, pSectionFmt, nLnNumRestartNo );
}
-// WW8_WrPlcSepx::SetNum() setzt in jeder Section beim 1. Aufruf den
+// MSWordSections::SetNum() setzt in jeder Section beim 1. Aufruf den
// Num-Pointer, alle folgenden Aufrufe werden ignoriert. Damit wird
// die erste Aufzaehlung einer Section uebernommen.
-void WW8_WrPlcSepx::SetNum( const SwTxtNode* pNumNd )
+void MSWordSections::SetNum( const SwTxtNode* pNumNd )
{
WW8_SepInfo& rInfo = aSects[ aSects.Count() - 1 ];
- if( !rInfo.pNumNd ) // noch nicht belegt
+ if ( !rInfo.pNumNd ) // noch nicht belegt
rInfo.pNumNd = pNumNd;
}
-void WW8_WrPlcSepx::WriteOlst( SwWW8Writer& rWrt, USHORT i )
-{
- if( !rWrt.bWrtWW8 )
- {
- const SwNumRule* pRule;
- const SwTxtNode* pNd = aSects[i].pNumNd;
- if( pNd && 0 != ( pRule = pNd->GetNumRule() ))
- rWrt.Out_Olst( *pRule );
- }
-}
-
-void WW8_WrPlcSepx::WriteFtnEndTxt( SwWW8Writer& rWrt, ULONG nCpStt )
+void WW8_WrPlcSepx::WriteFtnEndTxt( WW8Export& rWrt, ULONG nCpStt )
{
BYTE nInfoFlags = 0;
const SwFtnInfo& rInfo = rWrt.pDoc->GetFtnInfo();
@@ -934,19 +1084,19 @@ void WW8_WrPlcSepx::WriteFtnEndTxt( SwWW8Writer& rWrt, ULONG nCpStt )
case FTNNUM_CHAPTER: rDop.rncFtn = 1; break;
default: rDop.rncFtn = 0; break;
} // rncFtn
- rDop.nfcFtnRef = SwWW8Writer::GetNumId( rInfo.aFmt.GetNumberingType() );
+ rDop.nfcFtnRef = WW8Export::GetNumId( rInfo.aFmt.GetNumberingType() );
rDop.nFtn = rInfo.nFtnOffset + 1;
rDop.fpc = rWrt.bFtnAtTxtEnd ? 2 : 1;
// Endnote Info
rDop.rncEdn = 0; // rncEdn: Don't Restart
const SwEndNoteInfo& rEndInfo = rWrt.pDoc->GetEndNoteInfo();
- rDop.nfcEdnRef = SwWW8Writer::GetNumId( rEndInfo.aFmt.GetNumberingType() );
+ rDop.nfcEdnRef = WW8Export::GetNumId( rEndInfo.aFmt.GetNumberingType() );
rDop.nEdn = rEndInfo.nFtnOffset + 1;
rDop.epc = rWrt.bEndAtTxtEnd ? 3 : 0;
}
-void WW8_WrPlcSepx::SetHeaderFlag( BYTE& rHeadFootFlags, const SwFmt& rFmt,
+void MSWordSections::SetHeaderFlag( BYTE& rHeadFootFlags, const SwFmt& rFmt,
BYTE nFlag )
{
const SfxPoolItem* pItem;
@@ -956,7 +1106,7 @@ void WW8_WrPlcSepx::SetHeaderFlag( BYTE& rHeadFootFlags, const SwFmt& rFmt,
rHeadFootFlags |= nFlag;
}
-void WW8_WrPlcSepx::SetFooterFlag( BYTE& rHeadFootFlags, const SwFmt& rFmt,
+void MSWordSections::SetFooterFlag( BYTE& rHeadFootFlags, const SwFmt& rFmt,
BYTE nFlag )
{
const SfxPoolItem* pItem;
@@ -966,58 +1116,30 @@ void WW8_WrPlcSepx::SetFooterFlag( BYTE& rHeadFootFlags, const SwFmt& rFmt,
rHeadFootFlags |= nFlag;
}
-void WW8_WrPlcSepx::OutHeader( SwWW8Writer& rWrt, const SwFmt& rFmt,
- ULONG& rCpPos, BYTE nHFFlags, BYTE nFlag )
-{
- if( nFlag & nHFFlags )
- {
- rWrt.bHasHdr = true;
- const SwFmtHeader& rHd = rFmt.GetHeader();
- ASSERT( rHd.GetHeaderFmt(), "KopfText nicht richtig da" );
- const SwFmtCntnt& rCntnt = rHd.GetHeaderFmt()->GetCntnt();
- pTxtPos->Append( rCpPos );
- rWrt.WriteKFTxt1( rCntnt );
- rWrt.WriteStringAsPara( aEmptyStr ); // CR ans Ende ( sonst mault WW )
- rCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
- }
- else if( rWrt.bWrtWW8 )
- {
- pTxtPos->Append( rCpPos );
- if (rWrt.bHasHdr)
- {
- rWrt.WriteStringAsPara( aEmptyStr ); // Empty paragraph for empty header
- rWrt.WriteStringAsPara( aEmptyStr ); // a CR that WW8 needs for end of the stream
- rCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
- }
- }
-}
-void WW8_WrPlcSepx::OutFooter( SwWW8Writer& rWrt, const SwFmt& rFmt,
- ULONG& rCpPos, BYTE nHFFlags, BYTE nFlag )
+void WW8_WrPlcSepx::OutHeaderFooter( WW8Export& rWrt, bool bHeader,
+ const SwFmt& rFmt, ULONG& rCpPos, BYTE nHFFlags,
+ BYTE nFlag, BYTE nBreakCode)
{
- if( nFlag & nHFFlags )
+ if ( nFlag & nHFFlags )
{
- rWrt.bHasFtr = true;
- const SwFmtFooter& rFt = rFmt.GetFooter();
- ASSERT( rFt.GetFooterFmt(), "KopfText nicht richtig da" );
- const SwFmtCntnt& rCntnt = rFt.GetFooterFmt()->GetCntnt();
pTxtPos->Append( rCpPos );
- rWrt.WriteKFTxt1( rCntnt );
+ rWrt.WriteHeaderFooterText( rFmt, bHeader);
rWrt.WriteStringAsPara( aEmptyStr ); // CR ans Ende ( sonst mault WW )
rCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
}
- else if( rWrt.bWrtWW8 )
+ else if ( rWrt.bWrtWW8 )
{
pTxtPos->Append( rCpPos );
- if (rWrt.bHasFtr)
+ if (rWrt.bHasHdr && nBreakCode!=0)
{
- rWrt.WriteStringAsPara( aEmptyStr ); // Empty paragraph for empty footer
+ rWrt.WriteStringAsPara( aEmptyStr ); // Empty paragraph for empty header/footer
rWrt.WriteStringAsPara( aEmptyStr ); // a CR that WW8 needs for end of the stream
rCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
}
}
}
-void WW8_WrPlcSepx::NeedsDocumentProtected(const WW8_SepInfo &rInfo)
+void MSWordSections::NeedsDocumentProtected(const WW8_SepInfo &rInfo)
{
if (rInfo.IsProtected())
mbDocumentIsProtected = true;
@@ -1041,7 +1163,7 @@ bool WW8_SepInfo::IsProtected() const
}
-void WW8_WrPlcSepx::CheckForFacinPg( SwWW8Writer& rWrt ) const
+void MSWordSections::CheckForFacinPg( WW8Export& rWrt ) const
{
// 2 Werte werden gesetzt
// Dop.fFacingPages == Kopf-/Fusszeilen unterschiedlich
@@ -1093,7 +1215,7 @@ void WW8_WrPlcSepx::CheckForFacinPg( SwWW8Writer& rWrt ) const
}
}
-int WW8_WrPlcSepx::HasBorderItem( const SwFmt& rFmt )
+int MSWordSections::HasBorderItem( const SwFmt& rFmt )
{
const SfxPoolItem* pItem;
return SFX_ITEM_SET == rFmt.GetItemState(RES_BOX, true, &pItem) &&
@@ -1103,447 +1225,495 @@ int WW8_WrPlcSepx::HasBorderItem( const SwFmt& rFmt )
((SvxBoxItem*)pItem)->GetRight() );
}
+void WW8AttributeOutput::StartSection()
+{
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
+}
-bool WW8_WrPlcSepx::WriteKFTxt(SwWW8Writer& rWrt)
+void WW8AttributeOutput::SectionFormProtection( bool bProtected )
{
- pAttrs = new WW8_PdAttrDesc[ aSects.Count() ];
- WW8Bytes* pO = rWrt.pO;
- ULONG nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
- bool bOldPg = rWrt.bOutPageDescs;
- rWrt.bOutPageDescs = true;
+ //If the document is to be exported as protected, then if a segment
+ //is not protected, set the unlocked flag
+ if ( m_rWW8Export.pSepx->DocumentIsProtected() && !bProtected )
+ {
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SFProtected );
+ else
+ m_rWW8Export.pO->Insert( 139, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( 1 , m_rWW8Export.pO->Count() );
+ }
+}
- ASSERT( !pTxtPos, "wer hat den Pointer gesetzt?" );
- pTxtPos = new WW8_WrPlc0( nCpStart );
+void WW8AttributeOutput::SectionLineNumbering( ULONG nRestartNo, const SwLineNumberInfo& rLnNumInfo )
+{
+ // sprmSNLnnMod - activate Line Numbering and define Modulo
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SNLnnMod );
+ else
+ m_rWW8Export.pO->Insert( 154, m_rWW8Export.pO->Count() );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, (UINT16)rLnNumInfo.GetCountBy() );
- WriteFtnEndTxt( rWrt, nCpStart );
- CheckForFacinPg( rWrt );
+ // sprmSDxaLnn - xPosition of Line Number
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SDxaLnn );
+ else
+ m_rWW8Export.pO->Insert( 155, m_rWW8Export.pO->Count() );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, (UINT16)rLnNumInfo.GetPosFromLeft() );
- WW8Bytes aLineNum;
- const SwLineNumberInfo& rLnNumInfo = rWrt.pDoc->GetLineNumberInfo();
- if( rLnNumInfo.IsPaintLineNumbers() )
+ // sprmSLnc - restart number: 0 per page, 1 per section, 2 never restart
+ if ( nRestartNo || !rLnNumInfo.IsRestartEachPage() )
{
- // sprmSNLnnMod - activate Line Numbering and define Modulo
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( aLineNum, 0x5015 );
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SLnc );
else
- aLineNum.Insert( 154, aLineNum.Count() );
- SwWW8Writer::InsUInt16( aLineNum, (UINT16)rLnNumInfo.GetCountBy() );
+ m_rWW8Export.pO->Insert( 152, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( nRestartNo ? 1 : 2, m_rWW8Export.pO->Count() );
+ }
- // sprmSDxaLnn - xPosition of Line Number
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( aLineNum, 0x9016 );
+ // sprmSLnnMin - Restart the Line Number with given value
+ if ( nRestartNo )
+ {
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SLnnMin );
else
- aLineNum.Insert( 155, aLineNum.Count() );
- SwWW8Writer::InsUInt16( aLineNum, (UINT16)rLnNumInfo.GetPosFromLeft() );
+ m_rWW8Export.pO->Insert( 160, m_rWW8Export.pO->Count() );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, (UINT16)nRestartNo - 1 );
+ }
+}
- //
+void WW8AttributeOutput::SectionTitlePage()
+{
+ // sprmSFTitlePage
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SFTitlePage );
+ else
+ m_rWW8Export.pO->Insert( 143, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( 1, m_rWW8Export.pO->Count() );
+}
+
+void WW8AttributeOutput::SectionPageBorders( const SwFrmFmt* pPdFmt, const SwFrmFmt* pPdFirstPgFmt )
+{
+ if ( m_rWW8Export.bWrtWW8 ) // Seitenumrandung schreiben
+ {
+ USHORT nPgBorder = MSWordSections::HasBorderItem( *pPdFmt ) ? 0 : USHRT_MAX;
+ if ( pPdFmt != pPdFirstPgFmt )
+ {
+ if ( MSWordSections::HasBorderItem( *pPdFirstPgFmt ) )
+ {
+ if ( USHRT_MAX == nPgBorder )
+ {
+ nPgBorder = 1;
+ // nur die 1. Seite umrandet -> BoxItem aus dem
+ // richtigen Format besorgen
+ m_rWW8Export.pISet = &pPdFirstPgFmt->GetAttrSet();
+ OutputItem( pPdFirstPgFmt->GetFmtAttr( RES_BOX ) );
+ }
+ }
+ else if ( !nPgBorder )
+ nPgBorder = 2;
+ }
+
+ if ( USHRT_MAX != nPgBorder )
+ {
+ // Flag und das Border Attribut schreiben
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SPgbProp );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, nPgBorder );
+ }
}
+}
- unsigned int nOldIndex = rWrt.GetHdFtIndex();
- unsigned int nHdFtGroup = 0;
- for (USHORT i = 0; i < aSects.Count(); ++i)
+void WW8AttributeOutput::SectionBiDi( bool bBiDi )
+{
+ if ( m_rWW8Export.bWrtWW8 )
{
- WW8_PdAttrDesc* pA = pAttrs + i;
- WW8_SepInfo& rSepInfo = aSects[i];
- const SwPageDesc* pPd = rSepInfo.pPageDesc;
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SFBiDi );
+ m_rWW8Export.pO->Insert( bBiDi? 1: 0, m_rWW8Export.pO->Count() );
+ }
+}
- if( rSepInfo.pSectionFmt && !pPd )
- pPd = &const_cast<const SwDoc *>(rWrt.pDoc)->GetPageDesc(0);
+void WW8AttributeOutput::SectionPageNumbering( USHORT nNumType, USHORT nPageRestartNumber )
+{
+ // sprmSNfcPgn
+ BYTE nb = WW8Export::GetNumId( nNumType );
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SNfcPgn );
+ else
+ m_rWW8Export.pO->Insert( 147, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( nb, m_rWW8Export.pO->Count() );
- rWrt.pAktPageDesc = pPd;
- pA->nSepxFcPos = 0xffffffff; // Default: none
+ if ( nPageRestartNumber )
+ {
+ // sprmSFPgnRestart
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SFPgnRestart );
+ else
+ m_rWW8Export.pO->Insert( 150, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( 1, m_rWW8Export.pO->Count() );
- if( !pPd )
- {
- pA->pData = 0;
- pA->nLen = 0;
- continue;
- }
+ // sprmSPgnStart
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SPgnStart );
+ else
+ m_rWW8Export.pO->Insert( 161, m_rWW8Export.pO->Count() );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, nPageRestartNumber );
+ }
+}
- pO->Remove( 0, pO->Count() ); // leeren
- rWrt.bOutPageDescs = true;
+void WW8AttributeOutput::SectionType( BYTE nBreakCode )
+{
+ if ( 2 != nBreakCode ) // new page is the default
+ {
+ if ( m_rWW8Export.bWrtWW8 )
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SBkc );
+ else
+ m_rWW8Export.pO->Insert( 142, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( nBreakCode, m_rWW8Export.pO->Count() );
+ }
+}
- //If the document is to be exported as protected, then if a segment
- //is not protected, set the unlocked flag
- if (mbDocumentIsProtected && !rSepInfo.IsProtected())
+void WW8AttributeOutput::SectionWW6HeaderFooterFlags( BYTE nHeadFootFlags )
+{
+ if ( nHeadFootFlags && !m_rWW8Export.bWrtWW8 )
+ {
+ BYTE nTmpFlags = nHeadFootFlags;
+ if ( m_rWW8Export.pDop->fFacingPages )
{
- if (rWrt.bWrtWW8)
- SwWW8Writer::InsUInt16(*pO, 0x3006);
- else
- pO->Insert(139, pO->Count());
- pO->Insert(1 , pO->Count());
+ if ( !(nTmpFlags & WW8_FOOTER_EVEN) && (nTmpFlags & WW8_FOOTER_ODD ) )
+ nTmpFlags |= WW8_FOOTER_EVEN;
+
+ if ( !(nTmpFlags & WW8_HEADER_EVEN) && (nTmpFlags & WW8_HEADER_ODD ) )
+ nTmpFlags |= WW8_HEADER_EVEN;
}
- if( aLineNum.Count() )
- {
- pO->Insert( &aLineNum, pO->Count() );
+ // sprmSGprfIhdt, wird nur noch im WW95 benoetigt
+ m_rWW8Export.pO->Insert( 153, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( nTmpFlags, m_rWW8Export.pO->Count() );
+ }
+}
- // sprmSLnc - restart number: 0 per page, 1 per section, 2 never restart
- if( rSepInfo.nLnNumRestartNo || !rLnNumInfo.IsRestartEachPage() )
- {
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( *pO, 0x3013 );
- else
- pO->Insert( 152, pO->Count() );
- pO->Insert( rSepInfo.nLnNumRestartNo ? 1 : 2, pO->Count() );
- }
+void WW8Export::SetupSectionPositions( WW8_PdAttrDesc* pA )
+{
+ if ( !pA )
+ return;
+
+ if ( pO->Count() )
+ { // waren Attrs vorhanden ?
+ pA->nLen = pO->Count();
+ pA->pData = new BYTE [pO->Count()];
+ memcpy( pA->pData, pO->GetData(), pO->Count() ); // -> merken
+ pO->Remove( 0, pO->Count() ); // leeren fuer HdFt-Text
+ }
+ else
+ { // keine Attrs da
+ pA->pData = 0;
+ pA->nLen = 0;
+ }
+}
- // sprmSLnnMin - Restart the Line Number with given value
- if( rSepInfo.nLnNumRestartNo )
- {
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( *pO, 0x501B );
- else
- pO->Insert( 160, pO->Count() );
- SwWW8Writer::InsUInt16( *pO, (UINT16)rSepInfo.nLnNumRestartNo - 1 );
- }
- }
+void WW8Export::WriteHeadersFooters( BYTE nHeadFootFlags,
+ const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt, BYTE nBreakCode )
+{
+ ULONG nCpPos = Fc2Cp( Strm().Tell() );
+
+ IncrementHdFtIndex();
+ if ( !(nHeadFootFlags & WW8_HEADER_EVEN) && pDop->fFacingPages )
+ pSepx->OutHeaderFooter( *this, true, rFmt, nCpPos, nHeadFootFlags, WW8_HEADER_ODD, nBreakCode );
+ else
+ pSepx->OutHeaderFooter( *this, true, rLeftFmt, nCpPos, nHeadFootFlags, WW8_HEADER_EVEN, nBreakCode );
+ IncrementHdFtIndex();
+ pSepx->OutHeaderFooter( *this, true, rFmt, nCpPos, nHeadFootFlags, WW8_HEADER_ODD, nBreakCode );
+
+ IncrementHdFtIndex();
+ if ( !(nHeadFootFlags & WW8_FOOTER_EVEN) && pDop->fFacingPages )
+ pSepx->OutHeaderFooter( *this, false, rFmt, nCpPos, nHeadFootFlags, WW8_FOOTER_ODD, nBreakCode );
+ else
+ pSepx->OutHeaderFooter( *this, false, rLeftFmt, nCpPos, nHeadFootFlags, WW8_FOOTER_EVEN, nBreakCode );
+ IncrementHdFtIndex();
+ pSepx->OutHeaderFooter( *this, false, rFmt, nCpPos, nHeadFootFlags, WW8_FOOTER_ODD, nBreakCode );
+
+ //#i24344# Drawing objects cannot be directly shared between main hd/ft
+ //and title hd/ft so we need to differenciate them
+ IncrementHdFtIndex();
+ pSepx->OutHeaderFooter( *this, true, rFirstPageFmt, nCpPos, nHeadFootFlags, WW8_HEADER_FIRST, nBreakCode );
+ pSepx->OutHeaderFooter( *this, false, rFirstPageFmt, nCpPos, nHeadFootFlags, WW8_FOOTER_FIRST, nBreakCode );
+}
+
+void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAttrDesc* pA )
+{
+ const SwPageDesc* pPd = rSepInfo.pPageDesc;
+
+ if ( rSepInfo.pSectionFmt && !pPd )
+ pPd = &const_cast<const SwDoc *>( pDoc )->GetPageDesc( 0 );
+ pAktPageDesc = pPd;
- /* sprmSBkc, break code: 0 No break, 1 New column
- 2 New page, 3 Even page, 4 Odd page
+ if ( !pPd )
+ return;
+
+ bool bOldPg = bOutPageDescs;
+ bOutPageDescs = true;
+
+ AttrOutput().StartSection();
+
+ // forms
+ AttrOutput().SectionFormProtection( rSepInfo.IsProtected() );
+
+ // line numbers
+ const SwLineNumberInfo& rLnNumInfo = pDoc->GetLineNumberInfo();
+ if ( rLnNumInfo.IsPaintLineNumbers() )
+ AttrOutput().SectionLineNumbering( rSepInfo.nLnNumRestartNo, rLnNumInfo );
+
+ /* sprmSBkc, break code: 0 No break, 1 New column
+ 2 New page, 3 Even page, 4 Odd page
*/
- BYTE nBreakCode = 2; // default neue Seite beginnen
- bool bOutPgDscSet = true, bLeftRightPgChain = false;
- const SwFrmFmt* pPdFmt = &pPd->GetMaster();
- const SwFrmFmt* pPdFirstPgFmt = pPdFmt;
- if( rSepInfo.pSectionFmt )
- {
- // ist pSectionFmt gesetzt, dann gab es einen SectionNode
- // gueltiger Pointer -> Section beginnt,
- // 0xfff -> Section wird beendet
- nBreakCode = 0; // fortlaufender Abschnitt
+ BYTE nBreakCode = 2; // default neue Seite beginnen
+ bool bOutPgDscSet = true, bLeftRightPgChain = false;
+ const SwFrmFmt* pPdFmt = &pPd->GetMaster();
+ const SwFrmFmt* pPdFirstPgFmt = pPdFmt;
+ if ( rSepInfo.pSectionFmt )
+ {
+ // ist pSectionFmt gesetzt, dann gab es einen SectionNode
+ // gueltiger Pointer -> Section beginnt,
+ // 0xfff -> Section wird beendet
+ nBreakCode = 0; // fortlaufender Abschnitt
- if (rSepInfo.pPDNd && rSepInfo.pPDNd->IsCntntNode())
+ if ( rSepInfo.pPDNd && rSepInfo.pPDNd->IsCntntNode() )
+ {
+ if ( !NoPageBreakSection( &rSepInfo.pPDNd->GetCntntNode()->GetSwAttrSet() ) )
{
- if (!(SwWW8Writer::NoPageBreakSection(
- &rSepInfo.pPDNd->GetCntntNode()->GetSwAttrSet())))
- {
- nBreakCode = 2;
- }
+ nBreakCode = 2;
}
+ }
- if( (SwSectionFmt*)0xFFFFFFFF != rSepInfo.pSectionFmt )
- {
- if (nBreakCode == 0)
- bOutPgDscSet = false;
-
- // Itemset erzeugen, das das PgDesk-AttrSet beerbt:
- // als Nachkomme wird bei 'deep'-Out_SfxItemSet
- // auch der Vorfahr abgeklappert
- const SfxItemSet* pPdSet = &pPdFmt->GetAttrSet();
- SfxItemSet aSet( *pPdSet->GetPool(), pPdSet->GetRanges() );
- aSet.SetParent( pPdSet );
-
- // am Nachkommen NUR die Spaltigkeit gemaess Sect-Attr.
- // umsetzen
- aSet.Put(rSepInfo.pSectionFmt->GetFmtAttr(RES_COL));
-
- const SvxLRSpaceItem &rSectionLR =
- ItemGet<SvxLRSpaceItem>(*(rSepInfo.pSectionFmt),
- RES_LR_SPACE);
- const SvxLRSpaceItem &rPageLR =
- ItemGet<SvxLRSpaceItem>(*pPdFmt,RES_LR_SPACE);
-
- SvxLRSpaceItem aResultLR(rPageLR.GetLeft() +
+ if ( (SwSectionFmt*)0xFFFFFFFF != rSepInfo.pSectionFmt )
+ {
+ if ( nBreakCode == 0 )
+ bOutPgDscSet = false;
+
+ // Itemset erzeugen, das das PgDesk-AttrSet beerbt:
+ // als Nachkomme wird bei 'deep'-OutputItemSet
+ // auch der Vorfahr abgeklappert
+ const SfxItemSet* pPdSet = &pPdFmt->GetAttrSet();
+ SfxItemSet aSet( *pPdSet->GetPool(), pPdSet->GetRanges() );
+ aSet.SetParent( pPdSet );
+
+ // am Nachkommen NUR die Spaltigkeit gemaess Sect-Attr.
+ // umsetzen
+ aSet.Put( rSepInfo.pSectionFmt->GetFmtAttr( RES_COL ) );
+
+ const SvxLRSpaceItem &rSectionLR =
+ ItemGet<SvxLRSpaceItem>( *(rSepInfo.pSectionFmt), RES_LR_SPACE );
+ const SvxLRSpaceItem &rPageLR =
+ ItemGet<SvxLRSpaceItem>( *pPdFmt, RES_LR_SPACE );
+
+ SvxLRSpaceItem aResultLR( rPageLR.GetLeft() +
rSectionLR.GetLeft(), rPageLR.GetRight() +
- rSectionLR.GetRight(), 0, 0, RES_LR_SPACE);
-
- aSet.Put(aResultLR);
-
- // und raus damit ins WW-File
- const SfxItemSet* pOldI = rWrt.pISet;
- rWrt.pISet = &aSet;
- // --> OD 2007-06-12 #TESTING#
- // Switch off test on default item values, if page description
- // set (value of <bOutPgDscSet>) isn't written.
- Out_SfxItemSet( aWW8AttrFnTab, rWrt, aSet, true, bOutPgDscSet );
- // <--
-
- //Cannot export as normal page framedir, as continous sections
- //cannot contain any grid settings like proper sections
- if (rWrt.bWrtWW8)
- {
- BYTE nDir;
- SwWW8Writer::InsUInt16(*pO, 0x3228);
- if (FRMDIR_HORI_RIGHT_TOP ==
- rWrt.TrueFrameDirection(*rSepInfo.pSectionFmt))
- {
- nDir = 1;
- }
- else
- nDir = 0;
- pO->Insert( nDir, pO->Count() );
- }
+ rSectionLR.GetRight(), 0, 0, RES_LR_SPACE );
- rWrt.pISet = pOldI;
- }
+ aSet.Put( aResultLR );
+
+ // und raus damit ins WW-File
+ const SfxItemSet* pOldI = pISet;
+ pISet = &aSet;
+ // --> OD 2007-06-12 #TESTING#
+ // Switch off test on default item values, if page description
+ // set (value of <bOutPgDscSet>) isn't written.
+ AttrOutput().OutputStyleItemSet( aSet, true, bOutPgDscSet );
+ // <--
+
+ //Cannot export as normal page framedir, as continous sections
+ //cannot contain any grid settings like proper sections
+ AttrOutput().SectionBiDi( FRMDIR_HORI_RIGHT_TOP == TrueFrameDirection( *rSepInfo.pSectionFmt ) );
+
+ pISet = pOldI;
}
+ }
- if( bOutPgDscSet )
+ if ( bOutPgDscSet )
+ {
+ // es ist ein Follow gesetzt und dieser zeigt nicht auf sich
+ // selbst, so liegt eine Seitenverkettung vor.
+ // Falls damit eine "Erste Seite" simuliert werden soll, so
+ // koennen wir das auch als solches schreiben.
+ // Anders sieht es mit Links/Rechts wechseln aus. Dafuer muss
+ // erkannt werden, wo der Seitenwechsel statt findet. Hier ist
+ // es aber dafuer zuspaet!
+ if ( pPd->GetFollow() && pPd != pPd->GetFollow() &&
+ pPd->GetFollow()->GetFollow() == pPd->GetFollow() &&
+ ( !rSepInfo.pPDNd || pPd->IsFollowNextPageOfNode( *rSepInfo.pPDNd ) ) )
{
- // es ist ein Follow gesetzt und dieser zeigt nicht auf sich
- // selbst, so liegt eine Seitenverkettung vor.
- // Falls damit eine "Erste Seite" simuliert werden soll, so
- // koennen wir das auch als solches schreiben.
- // Anders sieht es mit Links/Rechts wechseln aus. Dafuer muss
- // erkannt werden, wo der Seitenwechsel statt findet. Hier ist
- // es aber dafuer zuspaet!
- if (
- pPd->GetFollow() && pPd != pPd->GetFollow() &&
- pPd->GetFollow()->GetFollow() == pPd->GetFollow() &&
- (
- !rSepInfo.pPDNd ||
- pPd->IsFollowNextPageOfNode( *rSepInfo.pPDNd )
- )
- )
+ const SwPageDesc *pFollow = pPd->GetFollow();
+ const SwFrmFmt& rFollowFmt = pFollow->GetMaster();
+ if ( sw::util::IsPlausableSingleWordSection( *pPdFmt, rFollowFmt ) )
{
- const SwPageDesc *pFollow = pPd->GetFollow();
- const SwFrmFmt& rFollowFmt = pFollow->GetMaster();
- if (sw::util::IsPlausableSingleWordSection(*pPdFmt, rFollowFmt))
- {
- if (rSepInfo.pPDNd)
- pPdFirstPgFmt = pPd->GetPageFmtOfNode(*rSepInfo.pPDNd);
- else
- pPdFirstPgFmt = &pPd->GetMaster();
-
- rWrt.pAktPageDesc = pPd = pFollow;
- pPdFmt = &rFollowFmt;
-
- // sprmSFTitlePage
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( *pO, 0x300A );
- else
- pO->Insert( 143, pO->Count() );
- pO->Insert( 1, pO->Count() );
- }
- }
-
- const SfxItemSet* pOldI = rWrt.pISet;
+ if (rSepInfo.pPDNd)
+ pPdFirstPgFmt = pPd->GetPageFmtOfNode( *rSepInfo.pPDNd );
+ else
+ pPdFirstPgFmt = &pPd->GetMaster();
- if( rWrt.bWrtWW8 ) // Seitenumrandung schreiben
- {
- USHORT nPgBorder = HasBorderItem( *pPdFmt ) ? 0 : USHRT_MAX;
- if( pPdFmt != pPdFirstPgFmt )
- {
- if( HasBorderItem( *pPdFirstPgFmt ))
- {
- if( USHRT_MAX == nPgBorder )
- {
- nPgBorder = 1;
- // nur die 1. Seite umrandet -> BoxItem aus dem
- // richtigen Format besorgen
- rWrt.pISet = &pPdFirstPgFmt->GetAttrSet();
- Out( aWW8AttrFnTab, pPdFirstPgFmt->GetFmtAttr(
- RES_BOX ), rWrt );
- }
- }
- else if( !nPgBorder )
- nPgBorder = 2;
- }
+ pAktPageDesc = pPd = pFollow;
+ pPdFmt = &rFollowFmt;
- if( USHRT_MAX != nPgBorder )
- {
- // Flag und das Border Attribut schreiben
- SwWW8Writer::InsUInt16( *pO, 0x522F );
- SwWW8Writer::InsUInt16( *pO, nPgBorder );
- }
+ // has different headers/footers for the title page
+ AttrOutput().SectionTitlePage();
}
+ }
- const SfxPoolItem* pItem;
- if( pPdFmt != pPdFirstPgFmt && SFX_ITEM_SET ==
- pPdFirstPgFmt->GetItemState(RES_PAPER_BIN, true, &pItem))
- {
- rWrt.pISet = &pPdFirstPgFmt->GetAttrSet();
- rWrt.bOutFirstPage = true;
- Out( aWW8AttrFnTab, *pItem, rWrt );
- rWrt.bOutFirstPage = false;
- }
+ const SfxItemSet* pOldI = pISet;
+ AttrOutput().SectionPageBorders( pPdFmt, pPdFirstPgFmt );
- // left-/right chain of pagedescs ?
- if( pPd->GetFollow() && pPd != pPd->GetFollow() &&
+ const SfxPoolItem* pItem;
+ if ( pPdFmt != pPdFirstPgFmt && SFX_ITEM_SET ==
+ pPdFirstPgFmt->GetItemState( RES_PAPER_BIN, true, &pItem ) )
+ {
+ pISet = &pPdFirstPgFmt->GetAttrSet();
+ bOutFirstPage = true;
+ AttrOutput().OutputItem( *pItem );
+ bOutFirstPage = false;
+ }
+
+
+ // left-/right chain of pagedescs ?
+ if ( pPd->GetFollow() && pPd != pPd->GetFollow() &&
pPd->GetFollow()->GetFollow() == pPd &&
(( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) &&
nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->GetFollow()->ReadUseOn() )) ||
( nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) &&
nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->GetFollow()->ReadUseOn() )) ))
- {
- bLeftRightPgChain = true;
+ {
+ bLeftRightPgChain = true;
- // welches ist der Bezugspunkt ????? (links oder rechts?)
- // annahme die rechte Seite!
- if( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ))
- {
- nBreakCode = 3;
- pPd = pPd->GetFollow();
- pPdFmt = &pPd->GetMaster();
- }
- else
- nBreakCode = 4;
+ // welches ist der Bezugspunkt ????? (links oder rechts?)
+ // annahme die rechte Seite!
+ if ( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) )
+ {
+ nBreakCode = 3;
+ pPd = pPd->GetFollow();
+ pPdFmt = &pPd->GetMaster();
}
-
- rWrt.pISet = &pPdFmt->GetAttrSet();
- Out_SfxItemSet(aWW8AttrFnTab, rWrt, pPdFmt->GetAttrSet(),
- true, false);
- rWrt.pISet = pOldI;
-
- // dann noch die restlichen Einstellungen aus dem PageDesc
-
- // sprmSNfcPgn
- BYTE nb = SwWW8Writer::GetNumId( pPd->GetNumType().GetNumberingType() );
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( *pO, 0x300E );
else
- pO->Insert( 147, pO->Count() );
- pO->Insert( nb, pO->Count() );
+ nBreakCode = 4;
+ }
-//??? const SwPageFtnInfo& rFtnInfo = pPd->GetFtnInfo();
+ pISet = &pPdFmt->GetAttrSet();
+ AttrOutput().OutputStyleItemSet( pPdFmt->GetAttrSet(), true, false );
+ pISet = pOldI;
- if( rSepInfo.nPgRestartNo )
- {
- // sprmSFPgnRestart
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( *pO, 0x3011 );
- else
- pO->Insert( 150, pO->Count() );
- pO->Insert( 1, pO->Count() );
- // sprmSPgnStart
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( *pO, 0x501C );
- else
- pO->Insert( 161, pO->Count() );
- SwWW8Writer::InsUInt16( *pO, rSepInfo.nPgRestartNo );
- }
+ // dann noch die restlichen Einstellungen aus dem PageDesc
- // werden es nur linke oder nur rechte Seiten?
- if( 2 == nBreakCode )
- {
- if( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ))
- nBreakCode = 3;
- else if( nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ))
- nBreakCode = 4;
- }
- }
+ AttrOutput().SectionPageNumbering( pPd->GetNumType().GetNumberingType(), rSepInfo.nPgRestartNo );
- if( 2 != nBreakCode ) // neue Seite ist default
+ // werden es nur linke oder nur rechte Seiten?
+ if ( 2 == nBreakCode )
{
- if( rWrt.bWrtWW8 )
- SwWW8Writer::InsUInt16( *pO, 0x3009 );
- else
- pO->Insert( 142, pO->Count() );
- pO->Insert( nBreakCode, pO->Count() );
+ if ( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) )
+ nBreakCode = 3;
+ else if ( nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) )
+ nBreakCode = 4;
}
+ }
+
+ AttrOutput().SectionType( nBreakCode );
+
+ const SwTxtNode* pNd = rSepInfo.pNumNd;
+ if ( pNd )
+ {
+ const SwNumRule* pRule = pNd->GetNumRule();
+ if ( pRule )
+ OutputOlst( *pRule );
+ }
- WriteOlst( rWrt, i );
+ // Header oder Footer
+ BYTE nHeadFootFlags = 0;
+ const SwFrmFmt* pPdLeftFmt = bLeftRightPgChain
+ ? &pPd->GetFollow()->GetMaster()
+ : &pPd->GetLeft();
+
+ if ( nBreakCode != 0 )
+ {
+ MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD );
+ MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD );
- // Header oder Footer
- BYTE nHeadFootFlags = 0;
+ if ( !pPd->IsHeaderShared() || bLeftRightPgChain )
+ MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN );
- const SwFrmFmt* pPdLeftFmt = bLeftRightPgChain
- ? &pPd->GetFollow()->GetMaster()
- : &pPd->GetLeft();
+ if ( !pPd->IsFooterShared() || bLeftRightPgChain )
+ MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN );
- if (nBreakCode != 0)
+ if ( pPdFmt != pPdFirstPgFmt )
{
- SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD );
- SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD );
- if( !pPd->IsHeaderShared() || bLeftRightPgChain )
- SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN );
- if( !pPd->IsFooterShared() || bLeftRightPgChain )
- SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN );
- if( pPdFmt != pPdFirstPgFmt )
- {
- // es gibt eine ErsteSeite:
- SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST );
- SetFooterFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_FOOTER_FIRST );
- }
+ // es gibt eine ErsteSeite:
+ MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST );
+ MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_FOOTER_FIRST );
+ }
- if( nHeadFootFlags && !rWrt.bWrtWW8 )
- {
- BYTE nTmpFlags = nHeadFootFlags;
- if( rWrt.pDop->fFacingPages )
- {
- if( !(nTmpFlags & WW8_FOOTER_EVEN) &&
- (nTmpFlags & WW8_FOOTER_ODD ) )
- nTmpFlags |= WW8_FOOTER_EVEN;
+ AttrOutput().SectionWW6HeaderFooterFlags( nHeadFootFlags );
+ }
- if( !(nTmpFlags & WW8_HEADER_EVEN) &&
- (nTmpFlags & WW8_HEADER_ODD ) )
- nTmpFlags |= WW8_HEADER_EVEN;
- }
+ // binary filters only
+ SetupSectionPositions( pA );
- // sprmSGprfIhdt, wird nur noch im WW95 benoetigt
- pO->Insert( 153, pO->Count() );
- pO->Insert( nTmpFlags, pO->Count() );
- }
- }
+ /*
+ !!!!!!!!!!!
+ // Umrandungen an Kopf- und Fusstexten muessten etwa so gehen:
+ // Dabei muss etwas wie pOut eingebaut werden,
+ // das bei jeder Spezialtext-Zeile wiederholt wird.
+ const SwFrmFmt* pFFmt = rFt.GetFooterFmt();
+ const SvxBoxItem& rBox = pFFmt->GetBox(false);
+ OutWW8_SwFmtBox1( m_rWW8Export.pOut, rBox, false);
+ !!!!!!!!!!!
+ Man koennt daraus Absatzattribute machen, die dann bei jedem Absatz
+ beachtet werden. Gilt fuer Hintergrund/Umrandung
+ !!!!!!!!!!!
+ */
+
+ const SwTxtNode *pOldPageRoot = GetHdFtPageRoot();
+ SetHdFtPageRoot( rSepInfo.pPDNd ? rSepInfo.pPDNd->GetTxtNode() : 0 );
+
+ WriteHeadersFooters( nHeadFootFlags, *pPdFmt, *pPdLeftFmt, *pPdFirstPgFmt, nBreakCode );
+
+ SetHdFtPageRoot( pOldPageRoot );
+
+ AttrOutput().EndSection();
+
+ // outside of the section properties again
+ bOutPageDescs = bOldPg;
+}
- if( pO->Count() )
- { // waren Attrs vorhanden ?
- pA->nLen = pO->Count();
- pA->pData = new BYTE [pO->Count()];
- memcpy( pA->pData, pO->GetData(), pO->Count() ); // -> merken
- pO->Remove( 0, pO->Count() ); // leeren fuer HdFt-Text
- }
- else
- { // keine Attrs da
- pA->pData = 0;
- pA->nLen = 0;
- }
+bool WW8_WrPlcSepx::WriteKFTxt( WW8Export& rWrt )
+{
+ pAttrs = new WW8_PdAttrDesc[ aSects.Count() ];
+ ULONG nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
-/*
-!!!!!!!!!!!
- // Umrandungen an Kopf- und Fusstexten muessten etwa so gehen:
- // Dabei muss etwas wie pOut eingebaut werden,
- // das bei jeder Spezialtext-Zeile wiederholt wird.
- const SwFrmFmt* pFFmt = rFt.GetFooterFmt();
- const SvxBoxItem& rBox = pFFmt->GetBox(false);
- OutWW8_SwFmtBox1( rWrt.pOut, rBox, false);
-!!!!!!!!!!!
- Man koennt daraus Absatzattribute machen, die dann bei jedem Absatz
- beachtet werden. Gilt fuer Hintergrund/Umrandung
-!!!!!!!!!!!
-*/
-
- const SwTxtNode *pOldPageRoot = rWrt.GetHdFtPageRoot();
- rWrt.SetHdFtPageRoot(rSepInfo.pPDNd ? rSepInfo.pPDNd->GetTxtNode() : 0);
-
- ULONG nCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
-
- rWrt.SetHdFtIndex(++nHdFtGroup);
- if( !(nHeadFootFlags & WW8_HEADER_EVEN) && rWrt.pDop->fFacingPages )
- OutHeader( rWrt, *pPdFmt, nCpPos, nHeadFootFlags, WW8_HEADER_ODD );
- else
- OutHeader( rWrt, *pPdLeftFmt, nCpPos, nHeadFootFlags, WW8_HEADER_EVEN );
- rWrt.SetHdFtIndex(++nHdFtGroup);
- OutHeader( rWrt, *pPdFmt, nCpPos, nHeadFootFlags, WW8_HEADER_ODD );
+ ASSERT( !pTxtPos, "wer hat den Pointer gesetzt?" );
+ pTxtPos = new WW8_WrPlc0( nCpStart );
- rWrt.SetHdFtIndex(++nHdFtGroup);
- if( !(nHeadFootFlags & WW8_FOOTER_EVEN) && rWrt.pDop->fFacingPages )
- OutFooter( rWrt, *pPdFmt, nCpPos, nHeadFootFlags, WW8_FOOTER_ODD );
- else
- OutFooter( rWrt, *pPdLeftFmt, nCpPos, nHeadFootFlags, WW8_FOOTER_EVEN );
- rWrt.SetHdFtIndex(++nHdFtGroup);
- OutFooter( rWrt, *pPdFmt, nCpPos, nHeadFootFlags, WW8_FOOTER_ODD );
+ WriteFtnEndTxt( rWrt, nCpStart );
+ CheckForFacinPg( rWrt );
- //#i24344# Drawing objects cannot be directly shared between main hd/ft
- //and title hd/ft so we need to differenciate them
- rWrt.SetHdFtIndex(++nHdFtGroup);
- OutHeader( rWrt, *pPdFirstPgFmt, nCpPos, nHeadFootFlags, WW8_HEADER_FIRST );
- OutFooter( rWrt, *pPdFirstPgFmt, nCpPos, nHeadFootFlags, WW8_FOOTER_FIRST );
- rWrt.SetHdFtPageRoot(pOldPageRoot);
+ unsigned int nOldIndex = rWrt.GetHdFtIndex();
+ rWrt.SetHdFtIndex( 0 );
+ for ( USHORT i = 0; i < aSects.Count(); ++i )
+ {
+ WW8_PdAttrDesc* pA = pAttrs + i;
+ pA->pData = 0;
+ pA->nLen = 0;
+ pA->nSepxFcPos = 0xffffffff; // Default: none
+
+ WW8_SepInfo& rSepInfo = aSects[i];
+ rWrt.SectionProperties( rSepInfo, pA );
}
- rWrt.SetHdFtIndex(nOldIndex); //0
+ rWrt.SetHdFtIndex( nOldIndex ); //0
- if( pTxtPos->Count() )
+ if ( pTxtPos->Count() )
{
// HdFt vorhanden ?
ULONG nCpEnd = rWrt.Fc2Cp( rWrt.Strm().Tell() );
pTxtPos->Append( nCpEnd ); // Ende letzter Hd/Ft fuer PlcfHdd
- if( nCpEnd > nCpStart )
+ if ( nCpEnd > nCpStart )
{
++nCpEnd;
pTxtPos->Append( nCpEnd + 1 ); // Ende letzter Hd/Ft fuer PlcfHdd
@@ -1556,7 +1726,6 @@ bool WW8_WrPlcSepx::WriteKFTxt(SwWW8Writer& rWrt)
else
delete pTxtPos, pTxtPos = 0;
- rWrt.bOutPageDescs = bOldPg;
return rWrt.pFib->ccpHdr != 0;
}
@@ -1577,7 +1746,7 @@ void WW8_WrPlcSepx::WriteSepx( SvStream& rStrm ) const
}
}
-void WW8_WrPlcSepx::WritePlcSed( SwWW8Writer& rWrt ) const
+void WW8_WrPlcSepx::WritePlcSed( WW8Export& rWrt ) const
{
ASSERT( aCps.Count() == aSects.Count() + 1, "WrPlcSepx: DeSync" );
ULONG nFcStart = rWrt.pTableStrm->Tell();
@@ -1606,7 +1775,7 @@ void WW8_WrPlcSepx::WritePlcSed( SwWW8Writer& rWrt ) const
}
-void WW8_WrPlcSepx::WritePlcHdd( SwWW8Writer& rWrt ) const
+void WW8_WrPlcSepx::WritePlcHdd( WW8Export& rWrt ) const
{
if( pTxtPos && pTxtPos->Count() )
{
@@ -1617,11 +1786,27 @@ void WW8_WrPlcSepx::WritePlcHdd( SwWW8Writer& rWrt ) const
}
}
-void SwWW8Writer::WriteKFTxt1( const SwFmtCntnt& rCntnt )
+void MSWordExportBase::WriteHeaderFooterText( const SwFmt& rFmt, bool bHeader )
{
- const SwNodeIndex* pSttIdx = rCntnt.GetCntntIdx();
+ const SwFmtCntnt *pCntnt;
+ if ( bHeader )
+ {
+ bHasHdr = true;
+ const SwFmtHeader& rHd = rFmt.GetHeader();
+ ASSERT( rHd.GetHeaderFmt(), "Header text is not here" );
+ pCntnt = &rHd.GetHeaderFmt()->GetCntnt();
+ }
+ else
+ {
+ bHasFtr = true;
+ const SwFmtFooter& rFt = rFmt.GetFooter();
+ ASSERT( rFt.GetFooterFmt(), "Footer text is not here" );
+ pCntnt = &rFt.GetFooterFmt()->GetCntnt();
+ }
+
+ const SwNodeIndex* pSttIdx = pCntnt->GetCntntIdx();
- if (pSttIdx)
+ if ( pSttIdx )
{
SwNodeIndex aIdx( *pSttIdx, 1 ),
aEnd( *pSttIdx->GetNode().EndOfSectionNode() );
@@ -1629,7 +1814,7 @@ void SwWW8Writer::WriteKFTxt1( const SwFmtCntnt& rCntnt )
ULONG nEnd = aEnd.GetIndex();
// Bereich also gueltiger Node
- if (nStart < nEnd)
+ if ( nStart < nEnd )
{
bool bOldKF = bOutKF;
bOutKF = true;
@@ -1640,11 +1825,11 @@ void SwWW8Writer::WriteKFTxt1( const SwFmtCntnt& rCntnt )
pSttIdx = 0;
}
- if (!pSttIdx)
+ if ( !pSttIdx )
{
// es gibt keine Kopf-/Fusszeile, aber ein CR ist immer noch noetig
ASSERT( pSttIdx, "K/F-Text nicht richtig da" );
- WriteStringAsPara( aEmptyStr ); // CR ans Ende ( sonst mault WW )
+ AttrOutput().EmptyParagraph(); // CR ans Ende ( sonst mault WW )
}
}
@@ -1678,21 +1863,21 @@ void WW8_WrPlcPostIt::Append( WW8_CP nCp, const SwPostItField& rPostIt )
aCntnt.Insert( p, aCntnt.Count() );
}
-bool WW8_WrPlcSubDoc::WriteGenericTxt(SwWW8Writer& rWrt, BYTE nTTyp,
- WW8_CP& rCount)
+bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp,
+ WW8_CP& rCount )
{
- bool bRet = false;
USHORT nLen = aCntnt.Count();
- if( nLen )
- {
- ULONG nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
- pTxtPos = new WW8_WrPlc0( nCpStart );
- USHORT i;
+ if ( !nLen )
+ return false;
- switch( nTTyp )
- {
+ ULONG nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
+ pTxtPos = new WW8_WrPlc0( nCpStart );
+ USHORT i;
+
+ switch ( nTTyp )
+ {
case TXT_ATN:
- for( i = 0; i < nLen; i++ )
+ for ( i = 0; i < nLen; i++ )
{
// Anfaenge fuer PlcfAtnTxt
pTxtPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
@@ -1712,7 +1897,7 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt(SwWW8Writer& rWrt, BYTE nTTyp,
case TXT_TXTBOX:
case TXT_HFTXTBOX:
- for( i = 0; i < nLen; i++ )
+ for ( i = 0; i < nLen; i++ )
{
// textbox - content
WW8_CP nCP = rWrt.Fc2Cp( rWrt.Strm().Tell() );
@@ -1738,8 +1923,8 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt(SwWW8Writer& rWrt, BYTE nTTyp,
const SwNodeIndex* pNdIdx = pFmt->GetCntnt().GetCntntIdx();
ASSERT( pNdIdx, "wo ist der StartNode der Textbox?" );
rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
- pNdIdx->GetNode().EndOfSectionIndex(),
- nTTyp );
+ pNdIdx->GetNode().EndOfSectionIndex(),
+ nTTyp );
// --> OD 2008-08-07 #156757#
{
SwNodeIndex aContentIdx = *pNdIdx;
@@ -1775,7 +1960,7 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt(SwWW8Writer& rWrt, BYTE nTTyp,
case TXT_EDN:
case TXT_FTN:
- for( i = 0; i < nLen; i++ )
+ for ( i = 0; i < nLen; i++ )
{
// Anfaenge fuer PlcfFtnTxt/PlcfEdnTxt
pTxtPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
@@ -1793,43 +1978,42 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt(SwWW8Writer& rWrt, BYTE nTTyp,
default:
ASSERT( !this, "was ist das fuer ein SubDocType?" );
- }
+ }
- pTxtPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
- // CR ans Ende ( sonst mault WW )
- rWrt.WriteStringAsPara( aEmptyStr );
+ pTxtPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
+ // CR ans Ende ( sonst mault WW )
+ rWrt.WriteStringAsPara( aEmptyStr );
- WW8_CP nCpEnd = rWrt.Fc2Cp( rWrt.Strm().Tell() );
- pTxtPos->Append( nCpEnd );
- rCount = nCpEnd - nCpStart;
- if (rCount)
- bRet = true;
- }
- return bRet;
+ WW8_CP nCpEnd = rWrt.Fc2Cp( rWrt.Strm().Tell() );
+ pTxtPos->Append( nCpEnd );
+ rCount = nCpEnd - nCpStart;
+
+ return ( rCount != 0 );
}
-void WW8_WrPlcSubDoc::WriteGenericPlc( SwWW8Writer& rWrt, BYTE nTTyp,
+void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp,
WW8_FC& rTxtStart, sal_Int32& rTxtCount, WW8_FC& rRefStart, sal_Int32& rRefCount ) const
{
typedef ::std::vector<String>::iterator myiter;
ULONG nFcStart = rWrt.pTableStrm->Tell();
USHORT nLen = aCps.Count();
- if( nLen )
- {
- ASSERT( aCps.Count() + 2 == pTxtPos->Count(), "WritePlc: DeSync" );
+ if ( !nLen )
+ return;
- ::std::vector<String> aStrArr;
- WW8Fib& rFib = *rWrt.pFib; // n+1-te CP-Pos nach Handbuch
- USHORT i;
- bool bWriteCP = true;
+ ASSERT( aCps.Count() + 2 == pTxtPos->Count(), "WritePlc: DeSync" );
- switch( nTTyp )
- {
+ ::std::vector<String> aStrArr;
+ WW8Fib& rFib = *rWrt.pFib; // n+1-te CP-Pos nach Handbuch
+ USHORT i;
+ bool bWriteCP = true;
+
+ switch ( nTTyp )
+ {
case TXT_ATN:
{
// then write first the GrpXstAtnOwners
- for( i = 0; i < nLen; ++i )
+ for ( i = 0; i < nLen; ++i )
{
const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
aStrArr.push_back(rPFld.GetPar1());
@@ -1840,24 +2024,24 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( SwWW8Writer& rWrt, BYTE nTTyp,
myiter aIter = ::std::unique(aStrArr.begin(), aStrArr.end());
aStrArr.erase(aIter, aStrArr.end());
- if( rWrt.bWrtWW8 )
+ if ( rWrt.bWrtWW8 )
{
- for( i = 0; i < aStrArr.size(); ++i )
+ for ( i = 0; i < aStrArr.size(); ++i )
{
const String& rStr = aStrArr[i];
SwWW8Writer::WriteShort(*rWrt.pTableStrm, rStr.Len());
SwWW8Writer::WriteString16(*rWrt.pTableStrm, rStr,
- false);
+ false);
}
}
else
{
- for( i = 0; i < aStrArr.size(); ++i )
+ for ( i = 0; i < aStrArr.size(); ++i )
{
const String& rStr = aStrArr[i];
*rWrt.pTableStrm << (BYTE)rStr.Len();
SwWW8Writer::WriteString8(*rWrt.pTableStrm, rStr, false,
- RTL_TEXTENCODING_MS_1252);
+ RTL_TEXTENCODING_MS_1252);
}
}
@@ -1898,19 +2082,19 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( SwWW8Writer& rWrt, BYTE nTTyp,
ASSERT( pShapeIds, "wo sind die ShapeIds?" );
// nLen = pTxtPos->Count();
- for( i = 0; i < nLen; ++i )
+ for ( i = 0; i < nLen; ++i )
{
// write textbox story - FTXBXS
// is it an writer or sdr - textbox?
const SdrObject* pObj = (SdrObject*)aCntnt[ i ];
INT32 nCnt = 1;
- if( !pObj->ISA( SdrTextObj ) )
+ if ( !pObj->ISA( SdrTextObj ) )
{
// find the "highest" SdrObject of this
const SwFrmFmt& rFmt = *::FindFrmFmt( pObj );
const SwFmtChain* pChn = &rFmt.GetChain();
- while( pChn->GetNext() )
+ while ( pChn->GetNext() )
{
// has a chain?
// then calc the cur pos in the chain
@@ -1928,7 +2112,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( SwWW8Writer& rWrt, BYTE nTTyp,
SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 );
// long lid
SwWW8Writer::WriteLong( *rWrt.pTableStrm,
- (*pShapeIds)[i]);
+ (*pShapeIds)[i]);
// long txidUndo
SwWW8Writer::WriteLong( *rWrt.pTableStrm, 0 );
}
@@ -1936,91 +2120,91 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( SwWW8Writer& rWrt, BYTE nTTyp,
bWriteCP = false;
}
break;
- }
+ }
- if( bWriteCP )
- {
- // Schreibe CP-Positionen
- for( i = 0; i < nLen; i++ )
- SwWW8Writer::WriteLong( *rWrt.pTableStrm, aCps[ i ] );
+ if ( bWriteCP )
+ {
+ // Schreibe CP-Positionen
+ for ( i = 0; i < nLen; i++ )
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, aCps[ i ] );
- // n+1-te CP-Pos nach Handbuch
- SwWW8Writer::WriteLong( *rWrt.pTableStrm,
+ // n+1-te CP-Pos nach Handbuch
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm,
rFib.ccpText + rFib.ccpFtn + rFib.ccpHdr + rFib.ccpEdn +
rFib.ccpTxbx + rFib.ccpHdrTxbx + 1 );
- if( TXT_ATN == nTTyp )
+ if ( TXT_ATN == nTTyp )
+ {
+ for ( i = 0; i < nLen; ++i )
{
- for( i = 0; i < nLen; ++i )
- {
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
+ const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
- //aStrArr is sorted
- myiter aIter = ::std::lower_bound(aStrArr.begin(),
+ //aStrArr is sorted
+ myiter aIter = ::std::lower_bound(aStrArr.begin(),
aStrArr.end(), rPFld.GetPar1());
- ASSERT(aIter != aStrArr.end() && *aIter == rPFld.GetPar1(),
+ ASSERT(aIter != aStrArr.end() && *aIter == rPFld.GetPar1(),
"Impossible");
- sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin());
- String sAuthor(*aIter);
- BYTE nNameLen = (BYTE)sAuthor.Len();
- if (nNameLen > 9)
- {
- sAuthor.Erase( 9 );
- nNameLen = 9;
- }
+ sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin());
+ String sAuthor(*aIter);
+ BYTE nNameLen = (BYTE)sAuthor.Len();
+ if ( nNameLen > 9 )
+ {
+ sAuthor.Erase( 9 );
+ nNameLen = 9;
+ }
- // xstUsrInitl[ 10 ] pascal-style String holding initials
- // of annotation author
- if( rWrt.bWrtWW8 )
- {
- SwWW8Writer::WriteShort(*rWrt.pTableStrm, nNameLen);
- SwWW8Writer::WriteString16(*rWrt.pTableStrm, sAuthor,
+ // xstUsrInitl[ 10 ] pascal-style String holding initials
+ // of annotation author
+ if ( rWrt.bWrtWW8 )
+ {
+ SwWW8Writer::WriteShort(*rWrt.pTableStrm, nNameLen);
+ SwWW8Writer::WriteString16(*rWrt.pTableStrm, sAuthor,
false);
- SwWW8Writer::FillCount( *rWrt.pTableStrm,
+ SwWW8Writer::FillCount( *rWrt.pTableStrm,
(9 - nNameLen) * 2 );
- }
- else
- {
- *rWrt.pTableStrm << nNameLen;
- SwWW8Writer::WriteString8(*rWrt.pTableStrm, sAuthor,
- false, RTL_TEXTENCODING_MS_1252);
- SwWW8Writer::FillCount(*rWrt.pTableStrm, 9 - nNameLen);
- }
+ }
+ else
+ {
+ *rWrt.pTableStrm << nNameLen;
+ SwWW8Writer::WriteString8(*rWrt.pTableStrm, sAuthor,
+ false, RTL_TEXTENCODING_MS_1252);
+ SwWW8Writer::FillCount(*rWrt.pTableStrm, 9 - nNameLen);
+ }
- //SVBT16 ibst; // index into GrpXstAtnOwners
- //SVBT16 ak; // not used
- //SVBT16 grfbmc; // not used
- //SVBT32 ITagBkmk; // when not -1, this tag identifies the
+ //SVBT16 ibst; // index into GrpXstAtnOwners
+ //SVBT16 ak; // not used
+ //SVBT16 grfbmc; // not used
+ //SVBT32 ITagBkmk; // when not -1, this tag identifies the
- SwWW8Writer::WriteShort( *rWrt.pTableStrm, nFndPos );
- SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
- SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
- SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 );
- }
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, nFndPos );
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 );
}
- else
+ }
+ else
+ {
+ USHORT nNo = 0;
+ for ( i = 0; i < nLen; ++i ) // Schreibe Flags
{
- USHORT nNo = 0;
- for( i = 0; i < nLen; ++i ) // Schreibe Flags
- {
- const SwFmtFtn* pFtn = (SwFmtFtn*)aCntnt[ i ];
- SwWW8Writer::WriteShort( *rWrt.pTableStrm,
- pFtn->GetNumStr().Len() ? 0 : ++nNo );
- }
+ const SwFmtFtn* pFtn = (SwFmtFtn*)aCntnt[ i ];
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm,
+ pFtn->GetNumStr().Len() ? 0 : ++nNo );
}
}
- rRefStart = nFcStart;
- nFcStart = rWrt.pTableStrm->Tell();
- rRefCount = nFcStart - rRefStart;
+ }
+ rRefStart = nFcStart;
+ nFcStart = rWrt.pTableStrm->Tell();
+ rRefCount = nFcStart - rRefStart;
- pTxtPos->Write( *rWrt.pTableStrm );
+ pTxtPos->Write( *rWrt.pTableStrm );
- switch( nTTyp )
- {
+ switch ( nTTyp )
+ {
case TXT_TXTBOX:
case TXT_HFTXTBOX:
- for( i = 0; i < nLen; ++i )
+ for ( i = 0; i < nLen; ++i )
{
// write break descriptor (BKD)
// short itxbxs
@@ -2033,11 +2217,10 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( SwWW8Writer& rWrt, BYTE nTTyp,
}
SwWW8Writer::FillCount( *rWrt.pTableStrm, 6 );
break;
- }
-
- rTxtStart = nFcStart;
- rTxtCount = rWrt.pTableStrm->Tell() - nFcStart;
}
+
+ rTxtStart = nFcStart;
+ rTxtCount = rWrt.pTableStrm->Tell() - nFcStart;
}
const SvULongs* WW8_WrPlcSubDoc::GetShapeIdArr() const
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 076edb419fa8..617f6f4773da 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -97,8 +97,12 @@
#include <fmtline.hxx>
#include <fmtfsize.hxx>
#include <comphelper/extract.hxx>
+
+#include <writerfilter/doctok/sprmids.hxx>
+
#include "writerhelper.hxx"
#include "writerwordglue.hxx"
+#include "ww8attributeoutput.hxx"
#include <IDocumentMarkAccess.hxx>
@@ -107,9 +111,18 @@
#include "dbgoutsw.hxx"
+#include <sfx2/docfile.hxx>
+#include <svtools/stritem.hxx>
+#include <unotools/tempfile.hxx>
+#include <svx/mscodec.hxx>
+#include <osl/time.h>
+#include <rtl/random.h>
+
using namespace sw::util;
using namespace sw::types;
+/** FKP - Formatted disK Page
+*/
class WW8_WrFkp
{
BYTE* pFkp; // gesamter Fkp ( zuerst nur FCs und Sprms )
@@ -190,7 +203,7 @@ public:
~WW8_WrtBookmarks();
void Append( WW8_CP nStartCp, const String& rNm, const ::sw::mark::IMark* pBkmk=NULL );
- void Write( SwWW8Writer& rWrt );
+ void Write( WW8Export& rWrt );
void MoveFieldMarks(ULONG nFrom,ULONG nTo);
// String GetWWBkmkName( const String& rName ) const;
@@ -210,7 +223,7 @@ typedef WW8_WrPc* WW8_WrPcPtr;
SV_DECL_PTRARR_DEL( WW8_WrPcPtrs, WW8_WrPcPtr, 4, 4 )
SV_IMPL_PTRARR( WW8_WrPcPtrs, WW8_WrPcPtr )
-static void WriteDop( SwWW8Writer& rWrt )
+static void WriteDop( WW8Export& rWrt )
{
WW8Dop& rDop = *rWrt.pDop;
@@ -329,7 +342,7 @@ Converts the OOo Asian Typography into a best fit match for Microsoft
Asian typography. This structure is actually dumped to disk within the
Dop Writer. Assumption is that rTypo is cleared to 0 on entry
*/
-void SwWW8Writer::ExportDopTypography(WW8DopTypography &rTypo)
+void WW8Export::ExportDopTypography(WW8DopTypography &rTypo)
{
static const sal_Unicode aLangNotBegin[4][WW8DopTypography::nMaxFollowing]=
{
@@ -500,7 +513,7 @@ void SwWW8Writer::ExportDopTypography(WW8DopTypography &rTypo)
(rTypo.cchLeadingPunct+1)*2);
}
- const IDocumentSettingAccess* pIDocumentSettingAccess = getIDocumentSettingAccess();
+ const IDocumentSettingAccess* pIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess();
rTypo.fKerningPunct = pIDocumentSettingAccess->get(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION);
rTypo.iJustification = pDoc->getCharacterCompressionType();
@@ -510,8 +523,8 @@ void SwWW8Writer::ExportDopTypography(WW8DopTypography &rTypo)
// Underline / WordLineMode und Box / Shadow.
// Es kann nur etwas gefunden werden, wenn diese Methode innerhalb
// der aufgerufenen Methoden WW8_SwAttrIter::OutAttr() und
-// SwWW8Writer::Out_SfxItemSet() benutzt wird.
-const SfxPoolItem* SwWW8Writer::HasItem( USHORT nWhich ) const
+// WW8Export::OutputItemSet() benutzt wird.
+const SfxPoolItem* MSWordExportBase::HasItem( USHORT nWhich ) const
{
const SfxPoolItem* pItem=0;
if (pISet)
@@ -533,7 +546,7 @@ const SfxPoolItem* SwWW8Writer::HasItem( USHORT nWhich ) const
return pItem;
}
-const SfxPoolItem& SwWW8Writer::GetItem(USHORT nWhich) const
+const SfxPoolItem& MSWordExportBase::GetItem(USHORT nWhich) const
{
const SfxPoolItem* pItem;
if (pISet)
@@ -617,7 +630,7 @@ void WW8_WrPlc1::Write( SvStream& rStrm )
//------------------------------------------------------------------------------
-bool WW8_WrPlcFld::Write(SwWW8Writer& rWrt)
+bool WW8_WrPlcFld::Write( WW8Export& rWrt )
{
if( WW8_WrPlc1::Count() <= 1 )
return false;
@@ -645,6 +658,11 @@ bool WW8_WrPlcFld::Write(SwWW8Writer& rWrt)
plc = &rWrt.pFib->lcbPlcffldEdn;
break;
+ case TXT_ATN:
+ pfc = &rWrt.pFib->fcPlcffldAtn;
+ plc = &rWrt.pFib->lcbPlcffldAtn;
+ break;
+
case TXT_TXTBOX:
pfc = &rWrt.pFib->fcPlcffldTxbx;
plc = &rWrt.pFib->lcbPlcffldTxbx;
@@ -670,7 +688,7 @@ bool WW8_WrPlcFld::Write(SwWW8Writer& rWrt)
return true;
}
-bool WW8_WrMagicTable::Write(SwWW8Writer& rWrt)
+bool WW8_WrMagicTable::Write( WW8Export& rWrt )
{
if( WW8_WrPlc1::Count() <= 1 )
return false;
@@ -732,7 +750,7 @@ ULONG SwWW8Writer::FillUntil( SvStream& rStrm, ULONG nEndPos )
//--------------------------------------------------------------------------
/* */
-WW8_WrPlcPn::WW8_WrPlcPn( SwWW8Writer& rWr, ePLCFT ePl, WW8_FC nStartFc )
+WW8_WrPlcPn::WW8_WrPlcPn( WW8Export& rWr, ePLCFT ePl, WW8_FC nStartFc )
: rWrt(rWr), nFkpStartPage(0), ePlc(ePl), nMark(0)
{
WW8_FkpPtr pF = new WW8_WrFkp( ePlc, nStartFc, rWrt.bWrtWW8 );
@@ -1156,7 +1174,7 @@ void WW8_WrPct::AppendPc(WW8_FC nStartFc, bool bIsUnicode)
}
-void WW8_WrPct::WritePc( SwWW8Writer& rWrt )
+void WW8_WrPct::WritePc( WW8Export& rWrt )
{
ULONG nPctStart;
ULONG nOldPos, nEndPos;
@@ -1265,7 +1283,7 @@ void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const String& rNm, const ::sw::
}
-void WW8_WrtBookmarks::Write( SwWW8Writer& rWrt )
+void WW8_WrtBookmarks::Write( WW8Export& rWrt )
{
USHORT nCount = aSttCps.Count(), i;
if( nCount )
@@ -1346,13 +1364,13 @@ void WW8_WrtBookmarks::MoveFieldMarks(ULONG nFrom, ULONG nTo)
}
}
-void SwWW8Writer::AppendBookmarks( const SwTxtNode& rNd,
+void WW8Export::AppendBookmarks( const SwTxtNode& rNd,
xub_StrLen nAktPos, xub_StrLen nLen )
{
SvPtrarr aArr( 8, 8 );
USHORT nCntnt;
xub_StrLen nAktEnd = nAktPos + nLen;
- if( GetBookmarks( rNd, nAktPos, nAktEnd, aArr ))
+ if( GetWriter().GetBookmarks( rNd, nAktPos, nAktEnd, aArr ))
{
ULONG nNd = rNd.GetIndex(), nSttCP = Fc2Cp( Strm().Tell() );
for( USHORT n = 0; n < aArr.Count(); ++n )
@@ -1390,15 +1408,20 @@ void SwWW8Writer::AppendBookmarks( const SwTxtNode& rNd,
}
}
-void SwWW8Writer::MoveFieldMarks(ULONG nFrom, ULONG nTo)
+void WW8Export::MoveFieldMarks(ULONG nFrom, ULONG nTo)
{
pBkmks->MoveFieldMarks(nFrom, nTo);
}
-void SwWW8Writer::AppendBookmark(const String& rName, USHORT nOffset)
+void WW8Export::AppendBookmark( const rtl::OUString& rName, bool bSkip )
+{
+ ULONG nSttCP = Fc2Cp( Strm().Tell() ) + ( bSkip? 1: 0 );
+ pBkmks->Append( nSttCP, rName );
+}
+
+void MSWordExportBase::AppendWordBookmark( const String& rName )
{
- ULONG nSttCP = Fc2Cp(Strm().Tell()) + nOffset;
- pBkmks->Append(nSttCP, rName);
+ AppendBookmark( BookmarkToWord( rName ) );
}
@@ -1407,12 +1430,12 @@ void SwWW8Writer::AppendBookmark(const String& rName, USHORT nOffset)
void WW8_WrtRedlineAuthor::Write( Writer& rWrt )
{
- SwWW8Writer & rWW8Wrt = (SwWW8Writer&)rWrt;
+ WW8Export & rWW8Wrt = *(((SwWW8Writer&)rWrt).m_pExport);
rWW8Wrt.WriteAsStringTable(maAuthors, rWW8Wrt.pFib->fcSttbfRMark,
rWW8Wrt.pFib->lcbSttbfRMark, rWW8Wrt.bWrtWW8 ? 0 : 2);
}
-USHORT SwWW8Writer::AddRedlineAuthor( USHORT nId )
+USHORT WW8Export::AddRedlineAuthor( USHORT nId )
{
if( !pRedlAuthors )
{
@@ -1425,7 +1448,7 @@ USHORT SwWW8Writer::AddRedlineAuthor( USHORT nId )
//--------------------------------------------------------------------------
/* */
-void SwWW8Writer::WriteAsStringTable(const std::vector<String>& rStrings,
+void WW8Export::WriteAsStringTable(const std::vector<String>& rStrings,
INT32& rfcSttbf, INT32& rlcbSttbf, USHORT nExtraLen)
{
USHORT n, nCount = static_cast< USHORT >(rStrings.size());
@@ -1600,7 +1623,7 @@ void SwWW8Writer::WriteString8(SvStream& rStrm, const String& rStr,
rStrm.Write(&aBytes[0], aBytes.size());
}
-void SwWW8Writer::WriteStringAsPara( const String& rTxt, USHORT nStyleId )
+void WW8Export::WriteStringAsPara( const String& rTxt, USHORT nStyleId )
{
if( rTxt.Len() )
OutSwString( rTxt, 0, rTxt.Len(), IsUnicode(), RTL_TEXTENCODING_MS_1252 );
@@ -1612,7 +1635,7 @@ void SwWW8Writer::WriteStringAsPara( const String& rTxt, USHORT nStyleId )
{ // Tab-Attr
// sprmPFInTable
if( bWrtWW8 )
- SwWW8Writer::InsUInt16( aArr, 0x2416 );
+ SwWW8Writer::InsUInt16( aArr, NS_sprm::LN_PFInTable );
else
aArr.Insert( 24, aArr.Count() );
aArr.Insert( 1, aArr.Count() );
@@ -1623,7 +1646,7 @@ void SwWW8Writer::WriteStringAsPara( const String& rTxt, USHORT nStyleId )
pChpPlc->AppendFkpEntry( nPos );
}
-void SwWW8Writer::WriteSpecialText( ULONG nStart, ULONG nEnd, BYTE nTTyp )
+void MSWordExportBase::WriteSpecialText( ULONG nStart, ULONG nEnd, BYTE nTTyp )
{
BYTE nOldTyp = nTxtTyp;
nTxtTyp = nTTyp;
@@ -1632,12 +1655,14 @@ void SwWW8Writer::WriteSpecialText( ULONG nStart, ULONG nEnd, BYTE nTTyp )
bool bOldPageDescs = bOutPageDescs;
bOutPageDescs = false;
// bOutKF wird in WriteKF1 gemerkt / gesetzt
- pCurPam = NewSwPaM( *pDoc, nStart, nEnd );
+ pCurPam = Writer::NewSwPaM( *pDoc, nStart, nEnd );
// Tabelle in Sonderbereichen erkennen
- if( (nStart != pCurPam->GetMark()->nNode.GetIndex())
- && pDoc->GetNodes()[ nStart ]->IsTableNode() )
+ if ( ( nStart != pCurPam->GetMark()->nNode.GetIndex() ) &&
+ pDoc->GetNodes()[ nStart ]->IsTableNode() )
+ {
pCurPam->GetMark()->nNode = nStart;
+ }
pOrigPam = pCurPam;
pCurPam->Exchange();
@@ -1651,7 +1676,7 @@ void SwWW8Writer::WriteSpecialText( ULONG nStart, ULONG nEnd, BYTE nTTyp )
nTxtTyp = nOldTyp;
}
-void SwWW8Writer::OutSwString(const String& rStr, xub_StrLen nStt,
+void WW8Export::OutSwString(const String& rStr, xub_StrLen nStt,
xub_StrLen nLen, bool bUnicode, rtl_TextEncoding eChrSet)
{
@@ -1695,7 +1720,7 @@ void SwWW8Writer::OutSwString(const String& rStr, xub_StrLen nStt,
#endif
}
-void SwWW8Writer::WriteCR(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8Export::WriteCR(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
{
if (pTableTextNodeInfoInner.get() != NULL && pTableTextNodeInfoInner->getDepth() == 1 && pTableTextNodeInfoInner->isEndOfCell())
WriteChar('\007');
@@ -1705,7 +1730,7 @@ void SwWW8Writer::WriteCR(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeIn
pPiece->SetParaBreak();
}
-void SwWW8Writer::WriteChar( sal_Unicode c )
+void WW8Export::WriteChar( sal_Unicode c )
{
if( pPiece->IsUnicode() )
Strm() << c;
@@ -1713,136 +1738,177 @@ void SwWW8Writer::WriteChar( sal_Unicode c )
Strm() << (BYTE)c;
}
-/* */
-//---------------------------------------------------------------------------
-// Hilfsroutinen fuer Flys
-//---------------------------------------------------------------------------
-// Struktur speichert die aktuellen Daten des Writers zwischen, um
-// einen anderen Dokument-Teil auszugeben, wie z.B. Header/Footer
-WW8SaveData::WW8SaveData( SwWW8Writer& rWriter, ULONG nStt, ULONG nEnd )
- : rWrt( rWriter ),
- pOldPam( rWrt.pCurPam ), pOldEnd( rWrt.GetEndPaM() ),
- pOldFlyFmt(rWrt.mpParentFrame), pOldPageDesc( rWrt.pAktPageDesc )
-
+void MSWordExportBase::SaveData( ULONG nStt, ULONG nEnd )
{
- pOldFlyOffset = rWrt.pFlyOffset;
- eOldAnchorType = rWrt.eNewAnchorType;
- if( rWrt.pO->Count() )
+ MSWordSaveData aData;
+
+ // WW8Export only stuff - zeroed here not to issue warnings
+ aData.pOOld = NULL;
+ aData.mpTableAtOld = NULL;
+ aData.mnTableStdAtLenOld = 0;
+
+ // Common stuff
+ aData.pOldPam = pCurPam;
+ aData.pOldEnd = pOrigPam;
+ aData.pOldFlyFmt = mpParentFrame;
+ aData.pOldPageDesc = pAktPageDesc;
+
+ aData.pOldFlyOffset = pFlyOffset;
+ aData.eOldAnchorType = eNewAnchorType;
+
+ aData.bOldOutTable = bOutTable;
+ aData.bOldIsInTable = bIsInTable;
+ aData.bOldFlyFrmAttrs = bOutFlyFrmAttrs;
+ aData.bOldStartTOX = bStartTOX;
+ aData.bOldInWriteTOX = bInWriteTOX;
+
+ pCurPam = Writer::NewSwPaM( *pDoc, nStt, nEnd );
+
+ // Recognize tables in special cases
+ if ( nStt != pCurPam->GetMark()->nNode.GetIndex() &&
+ pDoc->GetNodes()[ nStt ]->IsTableNode() )
{
- pOOld = rWrt.pO;
- rWrt.pO = new WW8Bytes( 128, 128 );
+ pCurPam->GetMark()->nNode = nStt;
}
- else
- pOOld = 0;
- bOldWriteAll = rWrt.bWriteAll;
- bOldOutTable = rWrt.bOutTable;
- bOldIsInTable= rWrt.bIsInTable;
- bOldFlyFrmAttrs = rWrt.bOutFlyFrmAttrs;
- bOldStartTOX = rWrt.bStartTOX;
- bOldInWriteTOX = rWrt.bInWriteTOX;
- rWrt.pCurPam = rWrt.NewSwPaM( *rWrt.pDoc, nStt, nEnd );
+ pOrigPam = pCurPam;
+ pCurPam->Exchange();
- // Tabelle in Sonderbereichen erkennen
- if( nStt != rWrt.pCurPam->GetMark()->nNode.GetIndex() &&
- rWrt.pDoc->GetNodes()[ nStt ]->IsTableNode() )
- rWrt.pCurPam->GetMark()->nNode = nStt;
+ bOutTable = false;
+ // Caution: bIsInTable should not be set here
+ bOutFlyFrmAttrs = false;
+// pAttrSet = 0;
+ bStartTOX = false;
+ bInWriteTOX = false;
- rWrt.SetEndPaM( rWrt.pCurPam );
- rWrt.pCurPam->Exchange( );
- rWrt.bWriteAll = true;
- rWrt.bOutTable = false;
- // Vorsicht: rWrt.bIsInTable darf hier NICHT veraendert werden!
- rWrt.bOutFlyFrmAttrs = false;
-// rWrt.pAttrSet = 0;
- rWrt.bStartTOX = false;
- rWrt.bInWriteTOX = false;
+ maSaveData.push( aData );
}
+void MSWordExportBase::RestoreData()
+{
+ MSWordSaveData &rData = maSaveData.top();
+
+ delete pCurPam;
+ pCurPam = rData.pOldPam;
+ pOrigPam = rData.pOldEnd;
+
+ bOutTable = rData.bOldOutTable;
+ bIsInTable = rData.bOldIsInTable;
+ bOutFlyFrmAttrs = rData.bOldFlyFrmAttrs;
+ bStartTOX = rData.bOldStartTOX;
+ bInWriteTOX = rData.bOldInWriteTOX;
-WW8SaveData::~WW8SaveData()
+ mpParentFrame = rData.pOldFlyFmt;
+ pAktPageDesc = rData.pOldPageDesc;
+
+ eNewAnchorType = rData.eOldAnchorType;
+ pFlyOffset = rData.pOldFlyOffset;
+
+ maSaveData.pop();
+}
+
+void WW8Export::SaveData( ULONG nStt, ULONG nEnd )
{
- delete rWrt.pCurPam; // Pam wieder loeschen
- rWrt.pCurPam = pOldPam;
- rWrt.SetEndPaM( pOldEnd );
- rWrt.bWriteAll = bOldWriteAll;
- rWrt.bOutTable = bOldOutTable;
- rWrt.bIsInTable= bOldIsInTable;
- rWrt.bOutFlyFrmAttrs = bOldFlyFrmAttrs;
- rWrt.bStartTOX = bOldStartTOX;
- rWrt.bInWriteTOX = bOldInWriteTOX;
- rWrt.mpParentFrame = pOldFlyFmt;
- rWrt.pAktPageDesc = pOldPageDesc;
- ASSERT( !rWrt.pO->Count(), " pO ist am Ende von WW8SaveData nicht leer" );
- if( pOOld )
+ MSWordExportBase::SaveData( nStt, nEnd );
+
+ MSWordSaveData &rData = maSaveData.top();
+
+ if ( pO->Count() )
{
- delete rWrt.pO;
- rWrt.pO = pOOld;
+ rData.pOOld = pO;
+ pO = new WW8Bytes( 128, 128 );
}
- rWrt.eNewAnchorType = eOldAnchorType;
- rWrt.pFlyOffset = pOldFlyOffset;
+ else
+ rData.pOOld = 0; // reuse pO
+
+ rData.mpTableAtOld = mpTableAt;
+ mpTableAt = NULL;
+ rData.mnTableStdAtLenOld = mnTableStdAtLen;
+ mnTableStdAtLen = 0;
+
+ rData.bOldWriteAll = GetWriter().bWriteAll;
+ GetWriter().bWriteAll = true;
}
-void SwWW8Writer::OutWW8TableInfoCell
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8Export::RestoreData()
+{
+ MSWordSaveData &rData = maSaveData.top();
+
+ GetWriter().bWriteAll = rData.bOldWriteAll;
+
+ ASSERT( !pO->Count(), "pO is not empty in WW8Export::RestoreData()" );
+ if ( rData.pOOld )
+ {
+ delete pO;
+ pO = rData.pOOld;
+ }
+
+ ASSERT( !mpTableAt || !mpTableAt->Count(), "mpTableAt is not empty in WW8Export::RestoreData()" );
+ if ( mpTableAt )
+ delete mpTableAt;
+ mpTableAt = rData.mpTableAtOld;
+ mnTableStdAtLen = rData.mnTableStdAtLenOld;
+
+ MSWordExportBase::RestoreData();
+}
+
+void WW8AttributeOutput::TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
sal_uInt32 nDepth = pTableTextNodeInfoInner->getDepth();
- if (nDepth > 0)
+ if ( nDepth > 0 )
{
/* Cell */
- InsUInt16(0x2416);
- pO->Insert((BYTE)0x1, pO->Count());
- InsUInt16(0x6649);
- InsUInt32(nDepth);
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFInTable );
+ m_rWW8Export.pO->Insert( (BYTE)0x1, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PTableDepth );
+ m_rWW8Export.InsUInt32( nDepth );
- if (nDepth > 1 && pTableTextNodeInfoInner->isEndOfCell())
+ if ( nDepth > 1 && pTableTextNodeInfoInner->isEndOfCell() )
{
- InsUInt16(0x244b);
- pO->Insert((BYTE)0x1, pO->Count());
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PCell );
+ m_rWW8Export.pO->Insert( (BYTE)0x1, m_rWW8Export.pO->Count() );
}
}
}
-void SwWW8Writer::OutWW8TableInfoRow
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
sal_uInt32 nDepth = pTableTextNodeInfoInner->getDepth();
- if (nDepth > 0)
+ if ( nDepth > 0 )
{
-
/* Row */
- if (pTableTextNodeInfoInner->isEndOfLine())
+ if ( pTableTextNodeInfoInner->isEndOfLine() )
{
- InsUInt16(0x2416);
- pO->Insert((BYTE)0x1, pO->Count());
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFInTable );
+ m_rWW8Export.pO->Insert( (BYTE)0x1, m_rWW8Export.pO->Count() );
- if (nDepth == 1)
+ if ( nDepth == 1 )
{
- InsUInt16(0x2417);
- pO->Insert((BYTE)0x1, pO->Count());
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFTtp );
+ m_rWW8Export.pO->Insert( (BYTE)0x1, m_rWW8Export.pO->Count() );
}
- InsUInt16(0x6649);
- InsUInt32(nDepth);
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PTableDepth );
+ m_rWW8Export.InsUInt32( nDepth );
- if (nDepth > 1)
+ if ( nDepth > 1 )
{
- InsUInt16(0x244b);
- pO->Insert((BYTE)0x1, pO->Count());
- InsUInt16(0x244c);
- pO->Insert((BYTE)0x1, pO->Count());
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PCell );
+ m_rWW8Export.pO->Insert( (BYTE)0x1, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PRow );
+ m_rWW8Export.pO->Insert( (BYTE)0x1, m_rWW8Export.pO->Count() );
}
- OutWW8TableDefinition(pTableTextNodeInfoInner);
- OutWW8TableHeight(pTableTextNodeInfoInner);
- OutWW8TableBackgrounds(pTableTextNodeInfoInner);
- OutWW8TableDefaultBorders(pTableTextNodeInfoInner);
- OutWW8TableCanSplit(pTableTextNodeInfoInner);
- OutWW8TableBidi(pTableTextNodeInfoInner);
- OutWW8TableVerticalCell(pTableTextNodeInfoInner);
- OutWW8TableOrientation(pTableTextNodeInfoInner);
+ TableDefinition( pTableTextNodeInfoInner );
+ TableHeight( pTableTextNodeInfoInner );
+ TableBackgrounds( pTableTextNodeInfoInner );
+ TableDefaultBorders( pTableTextNodeInfoInner );
+ TableCanSplit( pTableTextNodeInfoInner );
+ TableBidi( pTableTextNodeInfoInner );
+ TableVerticalCell( pTableTextNodeInfoInner );
+ TableOrientation( pTableTextNodeInfoInner );
}
}
}
@@ -1874,31 +1940,29 @@ static sal_uInt16 lcl_TCFlags(const SwTableBox * pBox)
return nFlags;
}
-void SwWW8Writer::OutWW8TableVerticalCell
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
const SwTableLine * pTabLine = pTabBox->GetUpper();
const SwTableBoxes & rTblBoxes = pTabLine->GetTabBoxes();
sal_uInt8 nBoxes = rTblBoxes.Count();
- for (sal_uInt8 n = 0; n < nBoxes; n++)
+ for ( sal_uInt8 n = 0; n < nBoxes; n++ )
{
const SwTableBox * pTabBox1 = rTblBoxes[n];
const SwFrmFmt * pFrmFmt = pTabBox1->GetFrmFmt();
- if (FRMDIR_VERT_TOP_RIGHT == TrueFrameDirection(*pFrmFmt))
+ if ( FRMDIR_VERT_TOP_RIGHT == m_rWW8Export.TrueFrameDirection( *pFrmFmt ) )
{
- InsUInt16(0x7629);
- pO->Insert(BYTE(n), pO->Count()); //start range
- pO->Insert(BYTE(n + 1), pO->Count()); //end range
- InsUInt16(5); //Equals vertical writing
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TTextFlow );
+ m_rWW8Export.pO->Insert( BYTE(n), m_rWW8Export.pO->Count() ); //start range
+ m_rWW8Export.pO->Insert( BYTE(n + 1), m_rWW8Export.pO->Count() ); //end range
+ m_rWW8Export.InsUInt16( 5 ); //Equals vertical writing
}
}
}
-void SwWW8Writer::OutWW8TableCanSplit
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
const SwTableLine * pTabLine = pTabBox->GetUpper();
@@ -1912,37 +1976,35 @@ void SwWW8Writer::OutWW8TableCanSplit
const SwFmtRowSplit& rSplittable = pLineFmt->GetRowSplit();
BYTE nCantSplit = (!rSplittable.GetValue()) ? 1 : 0;
- if (bWrtWW8)
+ if ( m_rWW8Export.bWrtWW8 )
{
- InsUInt16(0x3403);
- pO->Insert(nCantSplit, pO->Count());
- InsUInt16(0x3466); // also write fCantSplit90
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TFCantSplit );
+ m_rWW8Export.pO->Insert( nCantSplit, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TFCantSplit90 ); // also write fCantSplit90
}
else
{
- pO->Insert(185, pO->Count());
+ m_rWW8Export.pO->Insert( 185, m_rWW8Export.pO->Count() );
}
- pO->Insert(nCantSplit, pO->Count());
+ m_rWW8Export.pO->Insert( nCantSplit, m_rWW8Export.pO->Count() );
}
-void SwWW8Writer::OutWW8TableBidi
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTable * pTable = pTableTextNodeInfoInner->getTable();
const SwFrmFmt * pFrmFmt = pTable->GetFrmFmt();
- if (bWrtWW8)
+ if ( m_rWW8Export.bWrtWW8 )
{
- if (TrueFrameDirection(*pFrmFmt) == FRMDIR_HORI_RIGHT_TOP)
+ if ( m_rWW8Export.TrueFrameDirection(*pFrmFmt) == FRMDIR_HORI_RIGHT_TOP )
{
- InsUInt16(0x560B);
- InsUInt16(1);
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TFBiDi );
+ m_rWW8Export.InsUInt16( 1 );
}
}
}
-void SwWW8Writer::OutWW8TableHeight
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
const SwTableLine * pTabLine = pTabBox->GetUpper();
@@ -1972,27 +2034,26 @@ void SwWW8Writer::OutWW8TableHeight
// Zeilenhoehe ausgeben sprmTDyaRowHeight
long nHeight = 0;
const SwFmtFrmSize& rLSz = pLineFmt->GetFrmSize();
- if( ATT_VAR_SIZE != rLSz.GetHeightSizeType() && rLSz.GetHeight() )
+ if ( ATT_VAR_SIZE != rLSz.GetHeightSizeType() && rLSz.GetHeight() )
{
- if (ATT_MIN_SIZE == rLSz.GetHeightSizeType())
+ if ( ATT_MIN_SIZE == rLSz.GetHeightSizeType() )
nHeight = rLSz.GetHeight();
else
nHeight = -rLSz.GetHeight();
}
- if (nHeight)
+ if ( nHeight )
{
- if( bWrtWW8 )
- InsUInt16( 0x9407 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TDyaRowHeight );
else
- pO->Insert( 189, pO->Count() );
- InsUInt16( (USHORT)nHeight );
+ m_rWW8Export.pO->Insert( 189, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( (USHORT)nHeight );
}
}
-void SwWW8Writer::OutWW8TableOrientation
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTable * pTable = pTableTextNodeInfoInner->getTable();
@@ -2017,11 +2078,11 @@ void SwWW8Writer::OutWW8TableOrientation
{
case text::HoriOrientation::CENTER:
case text::HoriOrientation::RIGHT:
- if( bWrtWW8 )
- InsUInt16(0x5400 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TJc );
else
- pO->Insert(182, pO->Count());
- InsUInt16(text::HoriOrientation::RIGHT == eHOri ? 2 : 1);
+ m_rWW8Export.pO->Insert( 182, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( text::HoriOrientation::RIGHT == eHOri ? 2 : 1 );
break;
default:
break;
@@ -2029,37 +2090,34 @@ void SwWW8Writer::OutWW8TableOrientation
}
}
-void SwWW8Writer::OutWW8TableDefinition
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
const SwTableLine * pTabLine = pTabBox->GetUpper();
const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes();
- const SwNode * pTxtNd = pTableTextNodeInfoInner->getNode();
const SwTable * pTable = pTableTextNodeInfoInner->getTable();
- if( pTable->GetRowsToRepeat() > pTableTextNodeInfoInner->getRow())
+ if ( pTable->GetRowsToRepeat() > pTableTextNodeInfoInner->getRow() )
{
- if( bWrtWW8 )
- InsUInt16( 0x3404 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TTableHeader );
else
- pO->Insert(186, pO->Count());
- pO->Insert( 1, pO->Count() );
+ m_rWW8Export.pO->Insert( 186, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( 1, m_rWW8Export.pO->Count() );
}
// number of cell written
sal_uInt32 nBoxes = rTabBoxes.Count();
- if (nBoxes > 32)
+ if ( nBoxes > 32 )
nBoxes = 32;
// sprm header
- InsUInt16(0xd608);
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTable );
sal_uInt16 nSprmSize = 2 + (nBoxes + 1) * 2 + nBoxes * 20;
- InsUInt16(nSprmSize); // length
+ m_rWW8Export.InsUInt16( nSprmSize ); // length
// number of boxes
- pO->Insert(static_cast<BYTE>(nBoxes), pO->Count());
-
+ m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes), m_rWW8Export.pO->Count() );
/* cellxs */
/*
@@ -2088,13 +2146,13 @@ void SwWW8Writer::OutWW8TableDefinition
)
{
sal_Int16 eHOri = rHori.GetHoriOrient();
- switch (eHOri)
+ switch ( eHOri )
{
case text::HoriOrientation::CENTER:
case text::HoriOrientation::RIGHT:
break;
- default:
+ default:
nTblOffset = rHori.GetPos();
const SvxLRSpaceItem& rLRSp = pFmt->GetLRSpace();
nTblOffset += rLRSp.GetLeft();
@@ -2102,6 +2160,97 @@ void SwWW8Writer::OutWW8TableDefinition
}
}
+ sal_uInt32 n = 0;
+ m_rWW8Export.InsUInt16( nTblOffset );
+
+ std::vector<SwTwips> gridCols = GetGridCols( pTableTextNodeInfoInner );
+ for ( std::vector<SwTwips>::const_iterator it = gridCols.begin(), end = gridCols.end(); it != end; ++it )
+ {
+ m_rWW8Export.InsUInt16( static_cast<USHORT>( *it ) + nTblOffset );
+ }
+
+ /* TCs */
+ for ( n = 0; n < nBoxes; n++ )
+ {
+#ifdef DEBUG
+ sal_uInt16 npOCount = m_rWW8Export.pO->Count();
+#endif
+
+ SwTableBox * pTabBox1 = rTabBoxes[n];
+ const SwFrmFmt & rBoxFmt = *(pTabBox1->GetFrmFmt());
+ if ( m_rWW8Export.bWrtWW8 )
+ {
+ sal_uInt16 nFlags = lcl_TCFlags(pTabBox1);
+ m_rWW8Export.InsUInt16( nFlags );
+ }
+
+ static BYTE aNullBytes[] = { 0x0, 0x0 };
+
+ m_rWW8Export.pO->Insert( aNullBytes, 2, m_rWW8Export.pO->Count() ); // dummy
+ m_rWW8Export.Out_SwFmtTableBox( *m_rWW8Export.pO, rBoxFmt.GetBox() ); // 8/16 Byte
+
+#ifdef DEBUG
+ ::std::clog << "<tclength>" << m_rWW8Export.pO->Count() - npOCount << "</tclength>"
+ << ::std::endl;
+#endif
+ }
+}
+
+std::vector<SwTwips> AttributeOutputBase::GetGridCols( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+ std::vector<SwTwips> gridCols;
+
+ const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
+ const SwTableLine * pTabLine = pTabBox->GetUpper();
+ const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes();
+ const SwTable *pTable = pTableTextNodeInfoInner->getTable( );
+
+ // number of cell written
+ sal_uInt32 nBoxes = rTabBoxes.Count();
+ if ( nBoxes > 32 )
+ nBoxes = 32;
+
+ const SwFrmFmt *pFmt = pTable->GetFrmFmt();
+ ASSERT(pFmt,"Impossible");
+ if (!pFmt)
+ return gridCols;
+
+ const SwFmtFrmSize &rSize = pFmt->GetFrmSize();
+ unsigned long nTblSz = static_cast<unsigned long>(rSize.GetWidth());
+
+ sal_uInt32 nPageSize = 0;
+ bool bRelBoxSize = false;
+
+ GetTablePageSize( pTableTextNodeInfoInner, nPageSize, bRelBoxSize );
+
+ SwTwips nSz = 0;
+ for ( sal_uInt32 n = 0; n < nBoxes; n++ )
+ {
+ const SwFrmFmt* pBoxFmt = rTabBoxes[ n ]->GetFrmFmt();
+ const SwFmtFrmSize& rLSz = pBoxFmt->GetFrmSize();
+ nSz += rLSz.GetWidth();
+ SwTwips nCalc = nSz;
+ if ( bRelBoxSize )
+ nCalc = ( nCalc * nPageSize ) / nTblSz;
+
+ gridCols.push_back( nCalc );
+ }
+
+ return gridCols;
+}
+
+void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner, sal_uInt32& rPageSize, bool& rRelBoxSize )
+{
+ sal_uInt32 nPageSize = 0;
+
+ const SwNode *pTxtNd = pTableTextNodeInfoInner->getNode( );
+ const SwTable *pTable = pTableTextNodeInfoInner->getTable( );
+
+ const SwFrmFmt *pFmt = pTable->GetFrmFmt();
+ ASSERT(pFmt,"Impossible");
+ if (!pFmt)
+ return;
+
const SwFmtFrmSize &rSize = pFmt->GetFrmSize();
int nWidthPercent = rSize.GetWidthPercent();
bool bManualAligned = pFmt->GetHoriOrient().GetHoriOrient() == text::HoriOrientation::NONE;
@@ -2115,20 +2264,19 @@ void SwWW8Writer::OutWW8TableDefinition
bRelBoxSize = true;
}
- unsigned long nPageSize = nTblSz;
- if (bRelBoxSize)
+ if ( bRelBoxSize )
{
Point aPt;
- SwRect aRect(pFmt->FindLayoutRect(false, &aPt));
- if (aRect.IsEmpty())
+ SwRect aRect( pFmt->FindLayoutRect( false, &aPt ) );
+ if ( aRect.IsEmpty() )
{
// dann besorge mal die Seitenbreite ohne Raender !!
const SwFrmFmt* pParentFmt =
- mpParentFrame ?
- &(mpParentFrame->GetFrmFmt()) :
- const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetPageFmtOfNode(*pTxtNd, false);
+ GetExport().mpParentFrame ?
+ &(GetExport().mpParentFrame->GetFrmFmt()) :
+ const_cast<const SwDoc *>(GetExport().pDoc)->GetPageDesc(0).GetPageFmtOfNode(*pTxtNd, false);
aRect = pParentFmt->FindLayoutRect(true);
- if (0 == (nPageSize = aRect.Width()))
+ if ( 0 == ( nPageSize = aRect.Width() ) )
{
const SvxLRSpaceItem& rLR = pParentFmt->GetLRSpace();
nPageSize = pParentFmt->GetFrmSize().GetWidth() - rLR.GetLeft()
@@ -2138,7 +2286,7 @@ void SwWW8Writer::OutWW8TableDefinition
else
{
nPageSize = aRect.Width();
- if(bManualAligned)
+ if ( bManualAligned )
{
// #i37571# For manually aligned tables
const SvxLRSpaceItem &rLR = pFmt->GetLRSpace();
@@ -2155,53 +2303,11 @@ void SwWW8Writer::OutWW8TableDefinition
}
}
- SwTwips nSz = 0;
- sal_uInt32 n = 0;
- InsUInt16(nTblOffset);
-
- for (n = 0; n < nBoxes; n++)
- {
- const SwFrmFmt* pBoxFmt = rTabBoxes[ n ]->GetFrmFmt();
- const SwFmtFrmSize& rLSz = pBoxFmt->GetFrmSize();
- nSz += rLSz.GetWidth();
- SwTwips nCalc = nSz;
- if (bRelBoxSize)
- nCalc = (nCalc * nPageSize) / nTblSz;
-
- nCalc += nTblOffset;
-
- InsUInt16(static_cast<USHORT>(nCalc));
- }
-
- /* TCs */
- for (n = 0; n < nBoxes; n++)
- {
-#ifdef DEBUG
- sal_uInt16 npOCount = pO->Count();
-#endif
-
- SwTableBox * pTabBox1 = rTabBoxes[n];
- const SwFrmFmt & rBoxFmt = *(pTabBox1->GetFrmFmt());
- if( bWrtWW8 )
- {
- sal_uInt16 nFlags = lcl_TCFlags(pTabBox1);
- InsUInt16( nFlags );
- }
-
- static BYTE aNullBytes[] = { 0x0, 0x0 };
-
- pO->Insert( aNullBytes, 2, pO->Count() ); // dummy
- Out_SwFmtTableBox( *pO, rBoxFmt.GetBox() ); // 8/16 Byte
-
-#ifdef DEBUG
- ::std::clog << "<tclength>" << pO->Count() - npOCount << "</tclength>"
- << ::std::endl;
-#endif
- }
+ rPageSize = nPageSize;
+ rRelBoxSize = bRelBoxSize;
}
-void SwWW8Writer::OutWW8TableDefaultBorders
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
const SwFrmFmt * pFrmFmt = pTabBox->GetFrmFmt();
@@ -2214,44 +2320,41 @@ void SwWW8Writer::OutWW8TableDefaultBorders
BOX_LINE_BOTTOM, BOX_LINE_RIGHT
};
- for( int i = 0; i < 4; ++i)
+ for ( int i = 0; i < 4; ++i )
{
- SwWW8Writer::InsUInt16(*pO, 0xD634);
- pO->Insert( BYTE(6), pO->Count() );
- pO->Insert( BYTE(0), pO->Count() );
- pO->Insert( BYTE(1), pO->Count() );
- pO->Insert( BYTE(1 << i), pO->Count() );
- pO->Insert( BYTE(3), pO->Count() );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, 0xD634 );
+ m_rWW8Export.pO->Insert( BYTE(6), m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( BYTE(0), m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( BYTE(1), m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( BYTE(1 << i), m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( BYTE(3), m_rWW8Export.pO->Count() );
- SwWW8Writer::InsUInt16(*pO,
- pFrmFmt->GetBox().GetDistance(aBorders[i]));
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO,
+ pFrmFmt->GetBox().GetDistance( aBorders[i] ) );
}
-
}
-void SwWW8Writer::OutWW8TableBackgrounds
-(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
+void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
const SwTableLine * pTabLine = pTabBox->GetUpper();
const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes();
sal_uInt8 nBoxes = rTabBoxes.Count();
- if( bWrtWW8 )
- InsUInt16( 0xD609 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTableShd );
else
- pO->Insert( (BYTE)191, pO->Count() );
- pO->Insert( (BYTE)(nBoxes * 2), pO->Count() ); // Len
+ m_rWW8Export.pO->Insert( (BYTE)191, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( (BYTE)(nBoxes * 2), m_rWW8Export.pO->Count() ); // Len
- for (sal_uInt8 n = 0; n < nBoxes; n++)
+ for ( sal_uInt8 n = 0; n < nBoxes; n++ )
{
const SwTableBox * pBox1 = rTabBoxes[n];
const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt();
const SfxPoolItem * pI = NULL;
Color aColor;
- if (SFX_ITEM_ON == pFrmFmt->GetAttrSet().GetItemState(RES_BACKGROUND,
- false, &pI))
+ if ( SFX_ITEM_ON == pFrmFmt->GetAttrSet().GetItemState( RES_BACKGROUND, false, &pI ) )
{
aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor();
}
@@ -2259,28 +2362,27 @@ void SwWW8Writer::OutWW8TableBackgrounds
aColor = COL_AUTO;
WW8_SHD aShd;
- TransBrush(aColor, aShd);
- InsUInt16(aShd.GetValue());
+ m_rWW8Export.TransBrush( aColor, aShd );
+ m_rWW8Export.InsUInt16( aShd.GetValue() );
}
- if (bWrtWW8)
+ if ( m_rWW8Export.bWrtWW8 )
{
sal_uInt8 nBoxes0 = rTabBoxes.Count();
if (nBoxes0 > 21)
nBoxes0 = 21;
- InsUInt16(0xd612);
- pO->Insert(static_cast<BYTE>(nBoxes0 * 10), pO->Count());
+ m_rWW8Export.InsUInt16( NS_sprm::LN_TCellShd );
+ m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes0 * 10), m_rWW8Export.pO->Count() );
- for (sal_uInt8 n = 0; n < nBoxes0; n++)
+ for ( sal_uInt8 n = 0; n < nBoxes0; n++ )
{
const SwTableBox * pBox1 = rTabBoxes[n];
const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt();
const SfxPoolItem * pI = NULL;
Color aColor;
- if (SFX_ITEM_ON == pFrmFmt->GetAttrSet().GetItemState(RES_BACKGROUND,
- false, &pI))
+ if ( SFX_ITEM_ON == pFrmFmt->GetAttrSet().GetItemState( RES_BACKGROUND, false, &pI ) )
{
aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor();
}
@@ -2288,99 +2390,102 @@ void SwWW8Writer::OutWW8TableBackgrounds
aColor = COL_AUTO;
WW8SHDLong aSHD;
- aSHD.setCvFore(0xFF000000);
+ aSHD.setCvFore( 0xFF000000 );
sal_uInt32 nBgColor = aColor.GetColor();
- if (nBgColor == COL_AUTO)
- aSHD.setCvBack(0xFF000000);
+ if ( nBgColor == COL_AUTO )
+ aSHD.setCvBack( 0xFF000000 );
else
- aSHD.setCvBack(wwUtility::RGBToBGR(nBgColor));
+ aSHD.setCvBack( wwUtility::RGBToBGR( nBgColor ) );
- aSHD.Write(*this);
+ aSHD.Write( m_rWW8Export );
}
}
}
-void SwWW8Writer::WriteText()
+void WW8Export::SectionBreaksAndFrames( const SwTxtNode& rNode )
+{
+ // output page/section breaks
+ OutputSectionBreaks( rNode.GetpSwAttrSet(), rNode );
+
+ // all textframes anchored as character for the winword 7- format
+ if ( !bWrtWW8 && !bIsInTable )
+ OutWW6FlyFrmsInCntnt( rNode );
+}
+
+void MSWordExportBase::WriteText()
{
#ifdef DEBUG
- ::std::clog << "<WriteText>" << ::std::endl;
- ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl;
+//!! does not compile with debug=t -> unresolved external (dbg_out),
+//!! sommeone who knows what he wants to get should fix this
+// ::std::clog << "<WriteText>" << ::std::endl;
+// ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl;
#endif
while( pCurPam->GetPoint()->nNode < pCurPam->GetMark()->nNode ||
- (pCurPam->GetPoint()->nNode == pCurPam->GetMark()->nNode &&
- pCurPam->GetPoint()->nContent.GetIndex() <= pCurPam->GetMark()->nContent.GetIndex()) )
+ ( pCurPam->GetPoint()->nNode == pCurPam->GetMark()->nNode &&
+ pCurPam->GetPoint()->nContent.GetIndex() <= pCurPam->GetMark()->nContent.GetIndex() ) )
{
SwNode * pNd = pCurPam->GetNode();
- if (pNd->IsTxtNode()) // blitzschnelle Methode
- {
- const SwTxtNode* pTxtNode = pNd->GetTxtNode();
- Out_SfxBreakItems(pTxtNode->GetpSwAttrSet(), *pTxtNode);
- // all textframes anchored as character for the winword 7- format
- if (!bWrtWW8 && !bIsInTable)
- OutWW8FlyFrmsInCntnt(*pTxtNode);
- }
+ if ( pNd->IsTxtNode() )
+ SectionBreaksAndFrames( *pNd->GetTxtNode() );
- if( pNd->IsCntntNode() )
+ // output the various types of nodes
+ if ( pNd->IsCntntNode() )
{
SwCntntNode* pCNd = (SwCntntNode*)pNd;
- const SwPageDesc* pTemp =
- pCNd->GetSwAttrSet().GetPageDesc().GetPageDesc();
- if (pTemp)
+ const SwPageDesc* pTemp = pCNd->GetSwAttrSet().GetPageDesc().GetPageDesc();
+ if ( pTemp )
pAktPageDesc = pTemp;
pCurPam->GetPoint()->nContent.Assign( pCNd, 0 );
- Out( aWW8NodeFnTab, *pCNd, *this );
+ OutputContentNode( *pCNd );
}
- else if( pNd->IsTableNode() )
+ else if ( pNd->IsTableNode() )
{
- mpTableInfo->processSwTable(&(dynamic_cast<SwTableNode *>(pNd)->GetTable()));
+ mpTableInfo->processSwTable( &pNd->GetTableNode()->GetTable() );
}
- else if( pNd->IsSectionNode() && TXT_MAINTEXT == nTxtTyp )
- OutWW8_SwSectionNode( *this, *pNd->GetSectionNode() );
- else if( TXT_MAINTEXT == nTxtTyp && pNd->IsEndNode() &&
- pNd->StartOfSectionNode()->IsSectionNode() )
+ else if ( pNd->IsSectionNode() && TXT_MAINTEXT == nTxtTyp )
+ OutputSectionNode( *pNd->GetSectionNode() );
+ else if ( TXT_MAINTEXT == nTxtTyp && pNd->IsEndNode() &&
+ pNd->StartOfSectionNode()->IsSectionNode() )
{
const SwSection& rSect = pNd->StartOfSectionNode()->GetSectionNode()
->GetSection();
- if( bStartTOX && TOX_CONTENT_SECTION == rSect.GetType() )
+ if ( bStartTOX && TOX_CONTENT_SECTION == rSect.GetType() )
bStartTOX = false;
SwNodeIndex aIdx( *pNd, 1 );
- if( aIdx.GetNode().IsEndNode()
- && aIdx.GetNode().StartOfSectionNode()->IsSectionNode() )
+ if ( aIdx.GetNode().IsEndNode() && aIdx.GetNode().StartOfSectionNode()->IsSectionNode() )
;
- else
- if( aIdx.GetNode().IsSectionNode() )
+ else if ( aIdx.GetNode().IsSectionNode() )
;
- else if (!bIsInTable) //No sections in table
+ else if ( !bIsInTable ) //No sections in table
{
ReplaceCr( (char)0xc ); // Indikator fuer Page/Section-Break
const SwSectionFmt* pParentFmt = rSect.GetFmt()->GetParent();
- if( !pParentFmt )
+ if ( !pParentFmt )
pParentFmt = (SwSectionFmt*)0xFFFFFFFF;
ULONG nRstLnNum;
- if( aIdx.GetNode().IsCntntNode() )
+ if ( aIdx.GetNode().IsCntntNode() )
nRstLnNum = ((SwCntntNode&)aIdx.GetNode()).GetSwAttrSet().
GetLineNumber().GetStartValue();
else
nRstLnNum = 0;
- pSepx->AppendSep( Fc2Cp( Strm().Tell() ),
- pAktPageDesc, pParentFmt, nRstLnNum );
+ AppendSection( pAktPageDesc, pParentFmt, nRstLnNum );
}
}
- else if (pNd->IsEndNode())
+ else if ( pNd->IsEndNode() )
{
- OutWW8_SwEndNode(pNd);
+ OutputEndNode( *pNd->GetEndNode() );
}
- if( pNd == &pNd->GetNodes().GetEndOfContent() )
+ if ( pNd == &pNd->GetNodes().GetEndOfContent() )
break;
SwNode * pCurrentNode = &pCurPam->GetPoint()->nNode.GetNode();
@@ -2392,7 +2497,7 @@ void SwWW8Writer::WriteText()
pCurPam->GetPoint()->nNode++;
ULONG nPos = pCurPam->GetPoint()->nNode.GetIndex();
- ::SetProgressState( nPos, pCurPam->GetDoc()->GetDocShell() ); // Wie weit ?
+ ::SetProgressState( nPos, pCurPam->GetDoc()->GetDocShell() );
}
#ifdef DEBUG
@@ -2400,7 +2505,7 @@ void SwWW8Writer::WriteText()
#endif
}
-void SwWW8Writer::WriteMainText()
+void WW8Export::WriteMainText()
{
#ifdef DEBUG
::std::clog << "<WriteMainText>" << ::std::endl;
@@ -2432,7 +2537,7 @@ void SwWW8Writer::WriteMainText()
#endif
}
-void SwWW8Writer::WriteFkpPlcUsw()
+void WW8Export::WriteFkpPlcUsw()
{
if( !bWrtWW8 )
{
@@ -2448,7 +2553,7 @@ void SwWW8Writer::WriteFkpPlcUsw()
pChpPlc->WriteFkps(); // Fkp.Chpx
pPapPlc->WriteFkps(); // Fkp.Papx
- pStyles->OutStyleTab(); // Styles
+ pStyles->OutputStylesTable(); // Styles
pFtn->WritePlc( *this ); // Footnote-Ref & Text Plc
pEdn->WritePlc( *this ); // Endnote-Ref & Text Plc
pAtn->WritePlc( *this ); // Annotation-Ref & Text Plc
@@ -2458,11 +2563,12 @@ void SwWW8Writer::WriteFkpPlcUsw()
pPapPlc->WritePlc(); // Plcx.Papx
maFontHelper.WriteFontTable(pTableStrm, *pFib); // FFNs
if( pRedlAuthors )
- pRedlAuthors->Write( *this ); // sttbfRMark (RedlineAuthors)
+ pRedlAuthors->Write( GetWriter() ); // sttbfRMark (RedlineAuthors)
pFldMain->Write( *this ); // Fields ( Main Text )
pFldHdFt->Write( *this ); // Fields ( Header/Footer )
pFldFtn->Write( *this ); // Fields ( FootNotes )
pFldEdn->Write( *this ); // Fields ( EndNotes )
+ pFldAtn->Write( *this ); // Fields ( Annotations )
pBkmks->Write( *this ); // Bookmarks - sttbfBkmk/
// plcfBkmkf/plcfBkmkl
WriteDop( *this ); // Document-Properties
@@ -2479,7 +2585,7 @@ void SwWW8Writer::WriteFkpPlcUsw()
pSepx->WriteSepx( Strm() ); // Sepx
// Ausagbe in Table-Stream
- pStyles->OutStyleTab(); // fuer WW8 StyleTab
+ pStyles->OutputStylesTable(); // fuer WW8 StyleTab
pFtn->WritePlc( *this ); // Footnote-Ref & Text Plc
pEdn->WritePlc( *this ); // Endnote-Ref & Text Plc
pTxtBxs->WritePlc( *this ); // Textbox Text Plc
@@ -2493,11 +2599,12 @@ void SwWW8Writer::WriteFkpPlcUsw()
pPapPlc->WritePlc(); // Plcx.Papx
if( pRedlAuthors )
- pRedlAuthors->Write( *this ); // sttbfRMark (RedlineAuthors)
+ pRedlAuthors->Write( GetWriter() ); // sttbfRMark (RedlineAuthors)
pFldMain->Write( *this ); // Fields ( Main Text )
pFldHdFt->Write( *this ); // Fields ( Header/Footer )
pFldFtn->Write( *this ); // Fields ( FootNotes )
pFldEdn->Write( *this ); // Fields ( EndNotes )
+ pFldAtn->Write( *this ); // Fields ( Annotations )
pFldTxtBxs->Write( *this ); // Fields ( Textboxes )
pFldHFTxtBxs->Write( *this ); // Fields ( Head/Foot-Textboxes )
@@ -2523,7 +2630,7 @@ void SwWW8Writer::WriteFkpPlcUsw()
#10570# Similiarly having msvbasic storage seems to also trigger
creating this stream
*/
- GetStorage().OpenSotStorage(CREATE_CONST_ASC(SL::aObjectPool),
+ GetWriter().GetStorage().OpenSotStorage(CREATE_CONST_ASC(SL::aObjectPool),
STREAM_READWRITE | STREAM_SHARE_DENYALL);
}
@@ -2538,9 +2645,7 @@ void SwWW8Writer::WriteFkpPlcUsw()
pBkmks->Write( *this ); // Bookmarks - sttbfBkmk/
// plcfBkmkf/plcfBkmkl
- OutListTab(); // listformats - LSTF
- OutOverrideListTab(); // - "" - - LFO
- OutListNamesTab(); // - "" - - ListNames
+ WriteNumbering();
RestoreMacroCmds();
@@ -2559,7 +2664,7 @@ void SwWW8Writer::WriteFkpPlcUsw()
pFib->Write( Strm() ); // FIB
}
-void SwWW8Writer::StoreDoc1()
+void WW8Export::StoreDoc1()
{
bool bNeedsFinalPara = false;
// Start of Text ( Mangel ueber )
@@ -2596,7 +2701,7 @@ void SwWW8Writer::StoreDoc1()
WriteFkpPlcUsw(); // FKP, PLC, .....
}
-void SwWW8Writer::AddLinkTarget(const String& rURL)
+void MSWordExportBase::AddLinkTarget(const String& rURL)
{
if( !rURL.Len() || rURL.GetChar(0) != INET_MARK_TOKEN )
return;
@@ -2632,12 +2737,7 @@ void SwWW8Writer::AddLinkTarget(const String& rURL)
}
}
-void SwWW8Writer::AddBookmark(String sBkmkName)
-{
- pBkmks->Append(Fc2Cp(Strm().Tell()), BookmarkToWord(sBkmkName));
-}
-
-void SwWW8Writer::CollectOutlineBookmarks(const SwDoc &rDoc)
+void MSWordExportBase::CollectOutlineBookmarks(const SwDoc &rDoc)
{
const SwFmtINetFmt* pINetFmt;
const SwTxtINetFmt* pTxtAttr;
@@ -2680,7 +2780,29 @@ void SwWW8Writer::CollectOutlineBookmarks(const SwDoc &rDoc)
}
}
-ULONG SwWW8Writer::StoreDoc()
+namespace
+{
+ const ULONG WW_BLOCKSIZE = 0x200;
+
+ void EncryptRC4(svx::MSCodec_Std97& rCtx, SvStream &rIn, SvStream &rOut)
+ {
+ rIn.Seek(STREAM_SEEK_TO_END);
+ ULONG nLen = rIn.Tell();
+ rIn.Seek(0);
+
+ sal_uInt8 in[WW_BLOCKSIZE];
+ for (ULONG nI = 0, nBlock = 0; nI < nLen; nI += WW_BLOCKSIZE, ++nBlock)
+ {
+ ULONG nBS = (nLen - nI > WW_BLOCKSIZE) ? WW_BLOCKSIZE : nLen - nI;
+ rIn.Read(in, nBS);
+ rCtx.InitCipher(nBlock);
+ rCtx.Encode(in, nBS, in, nBS);
+ rOut.Write(in, nBS);
+ }
+ }
+}
+
+void MSWordExportBase::ExportDocument( bool bWriteAll )
{
nCharFmtStart = ANZ_DEFAULT_STYLES;
nFmtCollStart = nCharFmtStart + pDoc->GetCharFmts()->Count() - 1;
@@ -2701,67 +2823,95 @@ ULONG SwWW8Writer::StoreDoc()
// <--
nStyleBeforeFly = nLastFmtId = 0;
pStyAttr = 0;
+ pCurrentStyle = NULL;
pOutFmtNode = 0;
pEscher = 0;
pRedlAuthors = 0;
- if( aTOXArr.Count() )
+ if ( aTOXArr.Count() )
aTOXArr.Remove( 0, aTOXArr.Count() );
- if( !pOLEExp )
+ if ( !pOLEExp )
{
UINT32 nSvxMSDffOLEConvFlags = 0;
const SvtFilterOptions* pOpt = SvtFilterOptions::Get();
- if( pOpt->IsMath2MathType() )
+ if ( pOpt->IsMath2MathType() )
nSvxMSDffOLEConvFlags |= OLE_STARMATH_2_MATHTYPE;
- if( pOpt->IsWriter2WinWord() )
+ if ( pOpt->IsWriter2WinWord() )
nSvxMSDffOLEConvFlags |= OLE_STARWRITER_2_WINWORD;
- if( pOpt->IsCalc2Excel() )
+ if ( pOpt->IsCalc2Excel() )
nSvxMSDffOLEConvFlags |= OLE_STARCALC_2_EXCEL;
- if( pOpt->IsImpress2PowerPoint() )
+ if ( pOpt->IsImpress2PowerPoint() )
nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT;
pOLEExp = new SvxMSExportOLEObjects( nSvxMSDffOLEConvFlags );
}
- if( !pOleMap)
+ if ( !pOleMap)
pOleMap = new WW8OleMaps;
- if( !pOCXExp )
- pOCXExp = new SwMSConvertControls(pDoc->GetDocShell(),pCurPam);
-
- PrepareStorage();
+ if ( !pOCXExp )
+ pOCXExp = new SwMSConvertControls( pDoc->GetDocShell(), pCurPam );
// --> OD 2007-10-08 #i81405#
// Collect anchored objects before changing the redline mode.
- if (bWrtWW8)
- maFrames = GetAllFrames(*pDoc, bWriteAll ? 0 : pOrigPam);
- else
- maFrames = GetNonDrawingFrames(*pDoc, bWriteAll ? 0 : pOrigPam);
+ maFrames = GetFrames( *pDoc, bWriteAll? NULL : pOrigPam );
// <--
- USHORT nRedlineMode = pDoc->GetRedlineMode();
- if (pDoc->GetRedlineTbl().Count())
+ mnRedlineMode = pDoc->GetRedlineMode();
+ if ( pDoc->GetRedlineTbl().Count() )
{
- pDoc->SetRedlineMode((RedlineMode_t)(nRedlineMode | nsRedlineMode_t::REDLINE_SHOW_DELETE |
- nsRedlineMode_t::REDLINE_SHOW_INSERT));
+ pDoc->SetRedlineMode( (RedlineMode_t)(mnRedlineMode | nsRedlineMode_t::REDLINE_SHOW_DELETE |
+ nsRedlineMode_t::REDLINE_SHOW_INSERT) );
}
- maFontHelper.InitFontTable(bWrtWW8, *pDoc);
+ maFontHelper.InitFontTable( HackIsWW8OrHigher(), *pDoc );
GatherChapterFields();
+ CollectOutlineBookmarks(*pDoc);
+
+ // make unique OrdNums (Z-Order) for all drawing-/fly Objects
+ if ( pDoc->GetDrawModel() )
+ pDoc->GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums();
+
+ ExportDocument_Impl();
+
+ if ( mnRedlineMode != pDoc->GetRedlineMode() )
+ pDoc->SetRedlineMode( (RedlineMode_t)(mnRedlineMode) );
+}
+
+String SwWW8Writer::GetPassword()
+{
+ String sUniPassword;
+ if ( mpMedium )
+ {
+ SfxItemSet* pSet = mpMedium->GetItemSet();
+
+ const SfxPoolItem* pPasswordItem = NULL;
+ if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, sal_True, &pPasswordItem ) )
+ if( pPasswordItem != NULL )
+ sUniPassword = ( (const SfxStringItem*)pPasswordItem )->GetValue();
+ }
+
+ return sUniPassword;
+}
+
+void WW8Export::ExportDocument_Impl()
+{
+ PrepareStorage();
+
pFib = new WW8Fib( bWrtWW8 ? 8 : 6 );
- SvStream* pOldStrm = pStrm; // JP 19.05.99: wozu das ???
- SvStorageStreamRef xWwStrm( pStg->OpenSotStream( aMainStg ) );
+ SvStream* pOldStrm = &(Strm()); // JP 19.05.99: wozu das ???
+ SvStorageStreamRef xWwStrm( GetWriter().GetStorage().OpenSotStream( aMainStg ) );
SvStorageStreamRef xTableStrm( xWwStrm ), xDataStrm( xWwStrm );
xWwStrm->SetBufferSize( 32768 );
if( bWrtWW8 )
{
pFib->fWhichTblStm = 1;
- xTableStrm = pStg->OpenSotStream(CREATE_CONST_ASC(SL::a1Table),
+ xTableStrm = GetWriter().GetStorage().OpenSotStream(CREATE_CONST_ASC(SL::a1Table),
STREAM_STD_WRITE );
- xDataStrm = pStg->OpenSotStream(CREATE_CONST_ASC(SL::aData),
+ xDataStrm = GetWriter().GetStorage().OpenSotStream(CREATE_CONST_ASC(SL::aData),
STREAM_STD_WRITE );
xDataStrm->SetBufferSize( 32768 ); // fuer Grafiken
@@ -2771,59 +2921,43 @@ ULONG SwWW8Writer::StoreDoc()
xDataStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
}
- pStrm = &xWwStrm;
+ GetWriter().SetStrm( *xWwStrm );
pTableStrm = &xTableStrm;
pDataStrm = &xDataStrm;
- pStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ Strm().SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
- const SwSectionFmt *pFmt=0;
- // Default: "Standard"
- pAktPageDesc = &const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 );
- pSepx = new WW8_WrPlcSepx; // Sepx
- {
- const SfxPoolItem* pI;
- const SwNode* pNd = pCurPam->GetCntntNode();
- const SfxItemSet* pSet = pNd ? &((SwCntntNode*)pNd)->GetSwAttrSet()
- : 0;
+ String sUniPassword( GetWriter().GetPassword() );
- ULONG nRstLnNum = pSet ? ((SwFmtLineNumber&)pSet->Get(
- RES_LINENUMBER )).GetStartValue()
- : 0;
+ utl::TempFile aTempMain;
+ aTempMain.EnableKillingFile();
+ utl::TempFile aTempTable;
+ aTempTable.EnableKillingFile();
+ utl::TempFile aTempData;
+ aTempData.EnableKillingFile();
- const SwTableNode* pTblNd = pCurPam->GetNode()->FindTableNode();
- const SwSectionNode* pSectNd;
- if( pTblNd )
- {
- pSet = &pTblNd->GetTable().GetFrmFmt()->GetAttrSet();
- pNd = pTblNd;
- }
- else if( 0 != ( pSectNd = pNd->FindSectionNode() ) )
- {
- if( TOX_HEADER_SECTION == pSectNd->GetSection().GetType() &&
- pSectNd->StartOfSectionNode()->IsSectionNode() )
- pSectNd = pSectNd->StartOfSectionNode()->GetSectionNode();
+ bool bEncrypt = false;
- if( TOX_CONTENT_SECTION == pSectNd->GetSection().GetType() )
- {
- pNd = pSectNd;
- pCurPam->GetPoint()->nNode = *pNd;
- }
+ xub_StrLen nLen = sUniPassword.Len();
+ if ( nLen > 0 && nLen <= 15) // Password has been set
+ {
+ bEncrypt =true;
- if (CONTENT_SECTION == pSectNd->GetSection().GetType())
- pFmt = pSectNd->GetSection().GetFmt();
- }
+ GetWriter().SetStrm( *aTempMain.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ) );
- // Hole evtl. Pagedesc des 1. Nodes
- if( pSet && SFX_ITEM_ON == pSet->GetItemState(RES_PAGEDESC, true, &pI)
- && ((SwFmtPageDesc*)pI)->GetPageDesc() )
- pSepx->AppendSep( 0, *(SwFmtPageDesc*)pI, *pNd, pFmt, nRstLnNum );
- else
- pSepx->AppendSep( 0, pAktPageDesc, pFmt, nRstLnNum );
+ pTableStrm = aTempTable.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE );
+
+ pDataStrm = aTempData.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE );
+
+ sal_uInt8 aRC4EncryptionHeader[ 52 ] = {0};
+ pTableStrm->Write( aRC4EncryptionHeader, 52 );
}
- pFtn = new WW8_WrPlcFtnEdn( TXT_FTN ); // Ftn
- pEdn = new WW8_WrPlcFtnEdn( TXT_EDN ); // Edn
+ // Default: "Standard"
+ pSepx = new WW8_WrPlcSepx( *this ); // Sections/headers/footers
+
+ pFtn = new WW8_WrPlcFtnEdn( TXT_FTN ); // Footnotes
+ pEdn = new WW8_WrPlcFtnEdn( TXT_EDN ); // Endnotes
pAtn = new WW8_WrPlcPostIt; // PostIts
pTxtBxs = new WW8_WrPlcTxtBoxes( TXT_TXTBOX );
pHFTxtBxs = new WW8_WrPlcTxtBoxes( TXT_HFTXTBOX );
@@ -2832,16 +2966,17 @@ ULONG SwWW8Writer::StoreDoc()
pHFSdrObjs = new HdFtPlcDrawObj; // Draw-/Fly-Objects for header/footer
pBkmks = new WW8_WrtBookmarks; // Bookmarks
- CreateBookmarkTbl();
+ GetWriter().CreateBookmarkTbl();
pPapPlc = new WW8_WrPlcPn( *this, PAP, pFib->fcMin );
pChpPlc = new WW8_WrPlcPn( *this, CHP, pFib->fcMin );
pO = new WW8Bytes( 128, 128 );
- pStyles = new WW8WrtStyle( *this );
+ pStyles = new MSWordStyles( *this );
pFldMain = new WW8_WrPlcFld( 2, TXT_MAINTEXT );
pFldHdFt = new WW8_WrPlcFld( 2, TXT_HDFT );
pFldFtn = new WW8_WrPlcFld( 2, TXT_FTN );
pFldEdn = new WW8_WrPlcFld( 2, TXT_EDN );
+ pFldAtn = new WW8_WrPlcFld( 2, TXT_ATN );
pFldTxtBxs = new WW8_WrPlcFld( 2, TXT_TXTBOX );
pFldHFTxtBxs = new WW8_WrPlcFld( 2, TXT_HFTXTBOX );
@@ -2852,12 +2987,10 @@ ULONG SwWW8Writer::StoreDoc()
pDop = new WW8Dop;
- pDop->fRevMarking = 0 != (nsRedlineMode_t::REDLINE_ON & nRedlineMode);
- pDop->fRMView = 0 != ( nsRedlineMode_t::REDLINE_SHOW_DELETE & nRedlineMode );
+ pDop->fRevMarking = 0 != ( nsRedlineMode_t::REDLINE_ON & mnRedlineMode );
+ pDop->fRMView = 0 != ( nsRedlineMode_t::REDLINE_SHOW_DELETE & mnRedlineMode );
pDop->fRMPrint = pDop->fRMView;
- CollectOutlineBookmarks(*pDoc);
-
// set AutoHyphenation flag if found in default para style
const SfxPoolItem* pItem;
SwTxtFmtColl* pStdTxtFmtColl =
@@ -2868,14 +3001,63 @@ ULONG SwWW8Writer::StoreDoc()
pDop->fAutoHyphen = ((const SvxHyphenZoneItem*)pItem)->IsHyphen();
}
- // make unique OrdNums (Z-Order) for all drawing-/fly Objects
- if (pDoc->GetDrawModel())
- pDoc->GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums();
-
StoreDoc1();
- if (nRedlineMode != pDoc->GetRedlineMode())
- pDoc->SetRedlineMode((RedlineMode_t)(nRedlineMode));
+ if ( bEncrypt )
+ {
+ // Generate random number with a seed of time as salt.
+ TimeValue aTime;
+ osl_getSystemTime( &aTime );
+ rtlRandomPool aRandomPool = rtl_random_createPool ();
+ rtl_random_addBytes ( aRandomPool, &aTime, 8 );
+
+ sal_uInt8 aDocId[ 16 ] = {0};
+ rtl_random_getBytes( aRandomPool, aDocId, 16 );
+
+ rtl_random_destroyPool( aRandomPool );
+
+ sal_Unicode aPassword[16] = {0};
+ for (xub_StrLen nChar = 0; nChar < nLen; ++nChar )
+ aPassword[nChar] = sUniPassword.GetChar(nChar);
+
+ svx::MSCodec_Std97 aCtx;
+ aCtx.InitKey(aPassword, aDocId);
+
+ SvStream *pStrmTemp, *pTableStrmTemp, *pDataStrmTemp;
+ pStrmTemp = &xWwStrm;
+ pTableStrmTemp = &xTableStrm;
+ pDataStrmTemp = &xDataStrm;
+
+ if ( pDataStrmTemp && pDataStrmTemp != pStrmTemp)
+ EncryptRC4(aCtx, *pDataStrm, *pDataStrmTemp);
+
+ EncryptRC4(aCtx, *pTableStrm, *pTableStrmTemp);
+
+ // Write Unencrypted Header 52 bytes to the start of the table stream
+ // EncryptionVersionInfo (4 bytes): A Version structure where Version.vMajor MUST be 0x0001, and Version.vMinor MUST be 0x0001.
+ pTableStrmTemp->Seek( 0 );
+ sal_uInt32 nEncType = 0x10001;
+ *pTableStrmTemp << nEncType;
+
+ sal_uInt8 pSaltData[16] = {0};
+ sal_uInt8 pSaltDigest[16] = {0};
+ aCtx.GetEncryptKey( aDocId, pSaltData, pSaltDigest );
+
+ pTableStrmTemp->Write( aDocId, 16 );
+ pTableStrmTemp->Write( pSaltData, 16 );
+ pTableStrmTemp->Write( pSaltDigest, 16 );
+
+ EncryptRC4(aCtx, GetWriter().Strm(), *pStrmTemp);
+
+ // Write Unencrypted Fib 68 bytes to the start of the workdocument stream
+ pFib->fEncrypted = 1; // fEncrypted indicates the document is encrypted.
+ pFib->fObfuscated = 0; // Must be 0 for RC4.
+ pFib->nHash = 0x34; // encrypt header bytes count of table stream.
+ pFib->nKey = 0; // lkey2 must be 0 for RC4.
+
+ pStrmTemp->Seek( 0 );
+ pFib->WriteHeader( *pStrmTemp );
+ }
if (pUsedNumTbl) // all used NumRules
{
@@ -2891,6 +3073,7 @@ ULONG SwWW8Writer::StoreDoc()
DELETEZ( pFldFtn );
DELETEZ( pFldTxtBxs );
DELETEZ( pFldHFTxtBxs );
+ DELETEZ( pFldAtn );
DELETEZ( pFldEdn );
DELETEZ( pFldHdFt );
DELETEZ( pFldMain );
@@ -2912,7 +3095,7 @@ ULONG SwWW8Writer::StoreDoc()
delete pPiece;
delete pDop;
delete pFib;
- pStrm = pOldStrm;
+ GetWriter().SetStrm( *pOldStrm );
xWwStrm->SetBufferSize( 0 );
@@ -2924,15 +3107,13 @@ ULONG SwWW8Writer::StoreDoc()
{
xDataStrm.Clear();
pDataStrm = 0;
- pStg->Remove(CREATE_CONST_ASC(SL::aData));
+ GetWriter().GetStorage().Remove(CREATE_CONST_ASC(SL::aData));
}
}
-
- return 0;
}
-void SwWW8Writer::PrepareStorage()
+void WW8Export::PrepareStorage()
{
ULONG nLen;
const BYTE* pData;
@@ -2993,8 +3174,8 @@ void SwWW8Writer::PrepareStorage()
SvGlobalName aGName( nId1, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x46 );
- pStg->SetClass( aGName, 0, String::CreateFromAscii( pName ));
- SvStorageStreamRef xStor( pStg->OpenSotStream(sCompObj) );
+ GetWriter().GetStorage().SetClass( aGName, 0, String::CreateFromAscii( pName ));
+ SvStorageStreamRef xStor( GetWriter().GetStorage().OpenSotStream(sCompObj) );
xStor->Write( pData, nLen );
SwDocShell* pDocShell = pDoc->GetDocShell ();
@@ -3015,10 +3196,10 @@ void SwWW8Writer::PrepareStorage()
pDocShell->GetPreviewMetaFile (sal_False);
uno::Sequence<sal_uInt8> metaFile(
sfx2::convertMetaFile(pMetaFile.get()));
- sfx2::SaveOlePropertySet(xDocProps, pStg, &metaFile);
+ sfx2::SaveOlePropertySet(xDocProps, &GetWriter().GetStorage(), &metaFile);
}
else
- sfx2::SaveOlePropertySet( xDocProps, pStg );
+ sfx2::SaveOlePropertySet( xDocProps, &GetWriter().GetStorage() );
}
}
}
@@ -3042,11 +3223,16 @@ ULONG SwWW8Writer::WriteStorage()
pCurPam->GetPoint()->nNode = *pTNd;
}
- ULONG nRet = StoreDoc();
+ // Do the actual export
+ {
+ WW8Export aExport( this, pDoc, pCurPam, pOrigPam, m_bWrtWW8 );
+ m_pExport = &aExport;
+ aExport.ExportDocument( bWriteAll );
+ m_pExport = NULL;
+ }
::EndProgress( pDoc->GetDocShell() );
- bWrtWW8 = false; // sicherheitshalber: Default fuer's naechste Mal
- return nRet;
+ return 0;
}
ULONG SwWW8Writer::WriteMedium( SfxMedium& )
@@ -3054,18 +3240,29 @@ ULONG SwWW8Writer::WriteMedium( SfxMedium& )
return WriteStorage();
}
-SwWW8Writer::SwWW8Writer(const String& rFltName, const String& rBaseURL)
+ULONG SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed,
+ const String* pFileName )
+{
+ mpMedium = &rMed;
+ ULONG nRet = StgWriter::Write( rPaM, rMed, pFileName );
+ mpMedium = NULL;
+ return nRet;
+}
+
+MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam )
: aMainStg(sMainStream), pISet(0), pUsedNumTbl(0), mpTopNodeOfHdFtPage(0),
pBmpPal(0), pKeyMap(0), pOLEExp(0), pOCXExp(0), pOleMap(0),
mpTableInfo(new ww8::WW8TableInfo()), nUniqueList(0),
- mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0), pO(0),
- bHasHdr(false), bHasFtr(false)
+ mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0),
+ pStyles( NULL ),
+ bHasHdr(false), bHasFtr(false),
+ pDoc( pDocument ),
+ pCurPam( pCurrentPam ),
+ pOrigPam( pOriginalPam )
{
- SetBaseURL( rBaseURL );
- bWrtWW8 = rFltName.EqualsAscii(FILTER_WW8);
}
-SwWW8Writer::~SwWW8Writer()
+MSWordExportBase::~MSWordExportBase()
{
delete pBmpPal;
if (pKeyMap)
@@ -3075,12 +3272,54 @@ SwWW8Writer::~SwWW8Writer()
delete pOleMap;
}
+WW8Export::WW8Export( SwWW8Writer *pWriter,
+ SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam,
+ bool bIsWW8 )
+ : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ),
+ pO( NULL ),
+ mpTableAt( NULL ),
+ mnTableStdAtLen( 0 ),
+ pSepx( NULL ),
+ bWrtWW8( bIsWW8 ),
+ m_pWriter( pWriter ),
+ m_pAttrOutput( new WW8AttributeOutput( *this ) )
+{
+}
+
+WW8Export::~WW8Export()
+{
+ delete m_pAttrOutput, m_pAttrOutput = NULL;
+}
+
+AttributeOutputBase& WW8Export::AttrOutput() const
+{
+ return *m_pAttrOutput;
+}
+
+MSWordSections& WW8Export::Sections() const
+{
+ return *pSepx;
+}
+
+SwWW8Writer::SwWW8Writer(const String& rFltName, const String& rBaseURL)
+ : StgWriter(),
+ m_bWrtWW8( rFltName.EqualsAscii( FILTER_WW8 ) ),
+ m_pExport( NULL ),
+ mpMedium( 0 )
+{
+ SetBaseURL( rBaseURL );
+}
+
+SwWW8Writer::~SwWW8Writer()
+{
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const String& rFltName, const String& rBaseURL, WriterRef& xRet )
{
xRet = new SwWW8Writer( rFltName, rBaseURL );
}
-bool WW8_WrPlcFtnEdn::WriteTxt( SwWW8Writer& rWrt )
+bool WW8_WrPlcFtnEdn::WriteTxt( WW8Export& rWrt )
{
bool bRet = false;
if (TXT_FTN == nTyp)
@@ -3099,7 +3338,7 @@ bool WW8_WrPlcFtnEdn::WriteTxt( SwWW8Writer& rWrt )
return bRet;
}
-void WW8_WrPlcFtnEdn::WritePlc( SwWW8Writer& rWrt ) const
+void WW8_WrPlcFtnEdn::WritePlc( WW8Export& rWrt ) const
{
if( TXT_FTN == nTyp )
{
@@ -3116,19 +3355,23 @@ void WW8_WrPlcFtnEdn::WritePlc( SwWW8Writer& rWrt ) const
}
-bool WW8_WrPlcPostIt::WriteTxt(SwWW8Writer& rWrt)
+bool WW8_WrPlcPostIt::WriteTxt( WW8Export& rWrt )
{
- return WriteGenericTxt( rWrt, TXT_ATN, rWrt.pFib->ccpAtn );
+ bool bRet = WriteGenericTxt( rWrt, TXT_ATN, rWrt.pFib->ccpAtn );
+ rWrt.pFldAtn->Finish( rWrt.Fc2Cp( rWrt.Strm().Tell() ),
+ rWrt.pFib->ccpText + rWrt.pFib->ccpFtn
+ + rWrt.pFib->ccpHdr );
+ return bRet;
}
-void WW8_WrPlcPostIt::WritePlc( SwWW8Writer& rWrt ) const
+void WW8_WrPlcPostIt::WritePlc( WW8Export& rWrt ) const
{
WriteGenericPlc( rWrt, TXT_ATN, rWrt.pFib->fcPlcfandTxt,
rWrt.pFib->lcbPlcfandTxt, rWrt.pFib->fcPlcfandRef,
rWrt.pFib->lcbPlcfandRef );
}
-void WW8_WrPlcTxtBoxes::WritePlc( SwWW8Writer& rWrt ) const
+void WW8_WrPlcTxtBoxes::WritePlc( WW8Export& rWrt ) const
{
if( TXT_TXTBOX == nTyp )
{
@@ -3144,7 +3387,7 @@ void WW8_WrPlcTxtBoxes::WritePlc( SwWW8Writer& rWrt ) const
}
}
-void SwWW8Writer::RestoreMacroCmds()
+void WW8Export::RestoreMacroCmds()
{
pFib->fcCmds = pTableStrm->Tell();
@@ -3178,23 +3421,25 @@ void SwWW8Writer::RestoreMacroCmds()
pFib->lcbCmds = pTableStrm->Tell() - pFib->fcCmds;
}
-void WW8SHDLong::Write(SwWW8Writer & rWriter)
+void WW8SHDLong::Write( WW8Export& rExport )
{
- rWriter.InsUInt32(m_cvFore);
- rWriter.InsUInt32(m_cvBack);
- rWriter.InsUInt16(m_ipat);
+ rExport.InsUInt32( m_cvFore );
+ rExport.InsUInt32( m_cvBack );
+ rExport.InsUInt16( m_ipat );
}
-void SwWW8Writer::WriteFormData(const ::sw::mark::IFieldmark& rFieldmark)
+void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
{
- ASSERT(bWrtWW8, "No 95 export yet");
- if (!bWrtWW8) return;
+ ASSERT( bWrtWW8, "No 95 export yet" );
+ if ( !bWrtWW8 )
+ return;
const ::sw::mark::IFieldmark* pFieldmark = &rFieldmark;
- const ::sw::mark::ICheckboxFieldmark* pAsCheckbox = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >(pFieldmark);
+ const ::sw::mark::ICheckboxFieldmark* pAsCheckbox = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >( pFieldmark );
- int type=0; // TextFieldmark
- if(pAsCheckbox) type=1;
+ int type = 0; // TextFieldmark
+ if ( pAsCheckbox )
+ type = 1;
const ::rtl::OUString ffname = rFieldmark.GetFieldname();
@@ -3213,7 +3458,7 @@ void SwWW8Writer::WriteFormData(const ::sw::mark::IFieldmark& rFieldmark)
BYTE* pDataAdr = aArr1 + 2;
Set_UInt32(pDataAdr, nDataStt);
- pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof(aArr1), aArr1);
+ pChpPlc->AppendFkpEntry( Strm().Tell(), sizeof( aArr1 ), aArr1 );
sal_uInt8 aFldHeader[] =
{
@@ -3222,10 +3467,10 @@ void SwWW8Writer::WriteFormData(const ::sw::mark::IFieldmark& rFieldmark)
};
aFldHeader[4] |= (type & 0x03);
- int ffres=0; // rFieldmark.GetFFRes();
- if(pAsCheckbox && pAsCheckbox->IsChecked())
- ffres=1;
- aFldHeader[4] |= ((ffres<<2) & 0x7C);
+ int ffres = 0; // rFieldmark.GetFFRes();
+ if ( pAsCheckbox && pAsCheckbox->IsChecked() )
+ ffres = 1;
+ aFldHeader[4] |= ( (ffres<<2) & 0x7C );
const ::rtl::OUString ffdeftext;
const ::rtl::OUString ffformat;
@@ -3244,42 +3489,39 @@ void SwWW8Writer::WriteFormData(const ::sw::mark::IFieldmark& rFieldmark)
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // | /16
0,0,0,0, // / /4
};
- int slen=sizeof(aFldData)
- +sizeof(aFldHeader)
- +2*ffname.getLength()+4
- +2*ffdeftext.getLength()+4
- +2*ffformat.getLength()+4
- +2*ffhelptext.getLength()+4
- +2*ffstattext.getLength()+4
- +2*ffentrymcr.getLength()+4
- +2*ffexitmcr.getLength()+4;
+ int slen = sizeof( aFldData )
+ + sizeof( aFldHeader )
+ + 2*ffname.getLength() + 4
+ + 2*ffdeftext.getLength() + 4
+ + 2*ffformat.getLength() + 4
+ + 2*ffhelptext.getLength() + 4
+ + 2*ffstattext.getLength() + 4
+ + 2*ffentrymcr.getLength() + 4
+ + 2*ffexitmcr.getLength() + 4;
#ifdef OSL_BIGENDIAN
- slen=SWAPLONG(slen);
+ slen = SWAPLONG( slen );
#endif // OSL_BIGENDIAN
- *((sal_uInt32 *)aFldData)=slen;
- int len=sizeof(aFldData);
- OSL_ENSURE(len==0x44,
- "SwWW8Writer::WriteFormData(..)"
- " - wrong aFldData length");
- pDataStrm->Write(aFldData, len);
-
- len=sizeof(aFldHeader);
- OSL_ENSURE(len==8,
- "SwWW8Writer::WriteFormData(..)"
- " - wrong aFldHeader length");
- pDataStrm->Write(aFldHeader, len);
-
- WriteString_xstz(*pDataStrm, ffname, true); // Form field name
-
- if (type==0)
- WriteString_xstz(*pDataStrm, ffdeftext, true);
+ *( (sal_uInt32 *)aFldData ) = slen;
+ int len = sizeof( aFldData );
+ OSL_ENSURE( len == 0x44, "SwWW8Writer::WriteFormData(..) - wrong aFldData length" );
+ pDataStrm->Write( aFldData, len );
+
+ len = sizeof( aFldHeader );
+ OSL_ENSURE( len == 8, "SwWW8Writer::WriteFormData(..) - wrong aFldHeader length" );
+ pDataStrm->Write( aFldHeader, len );
+
+ SwWW8Writer::WriteString_xstz( *pDataStrm, ffname, true ); // Form field name
+
+ if ( type == 0 )
+ SwWW8Writer::WriteString_xstz( *pDataStrm, ffdeftext, true );
else
- pDataStrm->WriteNumber((sal_uInt16)0);
- WriteString_xstz(*pDataStrm, String(ffformat), true);
- WriteString_xstz(*pDataStrm, String(ffhelptext), true);
- WriteString_xstz(*pDataStrm, String(ffstattext), true);
- WriteString_xstz(*pDataStrm, String(ffentrymcr), true);
- WriteString_xstz(*pDataStrm, String(ffexitmcr), true);
+ pDataStrm->WriteNumber( (sal_uInt16)0 );
+
+ SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffformat ), true );
+ SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffhelptext ), true );
+ SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffstattext ), true );
+ SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffentrymcr ), true );
+ SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffexitmcr ), true );
// if (type==2) {
// // 0xFF, 0xFF
// // sal_uInt32 number of strings
@@ -3287,30 +3529,30 @@ void SwWW8Writer::WriteFormData(const ::sw::mark::IFieldmark& rFieldmark)
// }
}
-void SwWW8Writer::OutWW8_TableNodeInfoInner(ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner)
+void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner )
{
SVBT16 nStyle;
- ShortToSVBT16(nStyleBeforeFly, nStyle);
+ ShortToSVBT16( m_rWW8Export.nStyleBeforeFly, nStyle );
#ifdef DEBUG
::std::clog << "<OutWW8_TableNodeInfoInner>" << pNodeInfoInner->toString();
#endif
- pO->Remove( 0, pO->Count() ); // leeren
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
if (pNodeInfoInner->isEndOfCell())
{
#ifdef DEBUG
::std::clog << "<endOfCell/>" << ::std::endl;
#endif
- WriteCR(pNodeInfoInner);
+ m_rWW8Export.WriteCR(pNodeInfoInner);
- pO->Insert( (BYTE*)&nStyle, 2, pO->Count() ); // Style #
- OutWW8TableInfoCell(pNodeInfoInner);
- pPapPlc->AppendFkpEntry( Strm().Tell(), pO->Count(),
- pO->GetData() );
+ m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2, m_rWW8Export.pO->Count() ); // Style #
+ TableInfoCell(pNodeInfoInner);
+ m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(),
+ m_rWW8Export.pO->GetData() );
- pO->Remove( 0, pO->Count() ); // leeren
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
}
if (pNodeInfoInner->isEndOfLine())
@@ -3318,28 +3560,27 @@ void SwWW8Writer::OutWW8_TableNodeInfoInner(ww8::WW8TableNodeInfoInner::Pointer_
#ifdef DEBUG
::std::clog << "<endOfLine/>" << ::std::endl;
#endif
- WriteRowEnd(pNodeInfoInner->getDepth());
+ TableRowEnd(pNodeInfoInner->getDepth());
- pO->Insert( (BYTE*)&nStyle, 2, pO->Count() ); // Style #
- OutWW8TableInfoRow(pNodeInfoInner);
- pPapPlc->AppendFkpEntry( Strm().Tell(), pO->Count(),
- pO->GetData() );
+ m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2, m_rWW8Export.pO->Count() ); // Style #
+ TableInfoRow(pNodeInfoInner);
+ m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(),
+ m_rWW8Export.pO->GetData() );
- pO->Remove( 0, pO->Count() ); // leeren
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
}
#ifdef DEBUG
::std::clog << "</OutWW8_TableNodeInfoInner>" << ::std::endl;
#endif
}
-void SwWW8Writer::OutWW8_SwEndNode(SwNode * pNode)
+void MSWordExportBase::OutputEndNode( const SwEndNode &rNode )
{
#ifdef DEBUG
- ::std::clog << "<OutWW8_SwEndNode>" << dbg_out(pNode) << ::std::endl;
+ ::std::clog << "<OutWW8_SwEndNode>" << dbg_out(&rNode) << ::std::endl;
#endif
- ww8::WW8TableNodeInfo::Pointer_t pNodeInfo =
- mpTableInfo->getTableNodeInfo(pNode);
+ ww8::WW8TableNodeInfo::Pointer_t pNodeInfo = mpTableInfo->getTableNodeInfo( &rNode );
if (pNodeInfo)
{
@@ -3355,7 +3596,7 @@ void SwWW8Writer::OutWW8_SwEndNode(SwNode * pNode)
while (aIt != aEnd)
{
ww8::WW8TableNodeInfoInner::Pointer_t pInner = aIt->second;
- OutWW8_TableNodeInfoInner(pInner);
+ AttrOutput().TableNodeInfoInner(pInner);
aIt++;
}
}
@@ -3363,9 +3604,6 @@ void SwWW8Writer::OutWW8_SwEndNode(SwNode * pNode)
#ifdef DEBUG
::std::clog << "</OutWW8_SwEndNode>" << ::std::endl;
#endif
-
}
-
-
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 87414259edbe..75b59638ccde 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -39,24 +39,14 @@
#include <svtools/svstdarr.hxx>
#endif
-#ifndef __SGI_STL_MAP
#include <map>
-#endif
-#ifndef __SGI_STL_VECTOR
#include <vector>
-#endif
-#ifndef SHELLIO_HXX
#include <shellio.hxx>
-#endif
-#ifndef WRT_FN_HXX
#include <wrt_fn.hxx>
-#endif
#include <svx/msocximex.hxx>
-#ifndef WW8STRUC_HXX
#include "ww8struc.hxx"
-#endif
#include "ww8scan.hxx"
#include "fields.hxx"
#include "types.hxx"
@@ -65,10 +55,14 @@
#include <expfld.hxx>
// einige Forward Deklarationen
+class SwAttrIter;
+class AttributeOutputBase;
+class DocxAttributeOutput;
class BitmapPalette;
class SwEscherEx;
class DateTime;
class Font;
+class MSWordExportBase;
class SdrObject;
class SfxItemSet;
class SvStream;
@@ -103,9 +97,11 @@ class SwTxtFmtColl;
class SwTxtNode;
class SwWW8WrGrf;
class SwWW8Writer;
-class WW8WrtStyle;
+class MSWordStyles;
+class WW8AttributeOutput;
class WW8Bytes;
-class WW8_AttrIter;
+class WW8Export;
+class MSWordAttrIter;
class WW8_WrFkp;
class WW8_WrPlc0;
class WW8_WrPlc1;
@@ -114,7 +110,7 @@ class WW8_WrMagicTable;
class WW8_WrPlcFtnEdn;
class WW8_WrPlcPn;
class WW8_WrPlcPostIt;
-class WW8_WrPlcSepx;
+class MSWordSections;
class WW8_WrPlcTxtBoxes;
class WW8_WrPct; // Verwaltung
class WW8_WrPcPtrs;
@@ -139,11 +135,11 @@ class SvxBrushItem;
typedef BYTE FieldFlags;
namespace nsFieldFlags // for InsertField- Method
{
- const FieldFlags WRITEFIELD_START = 0x01;
- const FieldFlags WRITEFIELD_CMD_START = 0x02;
+ const FieldFlags WRITEFIELD_START = 0x01;
+ const FieldFlags WRITEFIELD_CMD_START = 0x02;
const FieldFlags WRITEFIELD_CMD_END = 0x04;
const FieldFlags WRITEFIELD_END = 0x10;
- const FieldFlags WRITEFIELD_CLOSE = 0x20;
+ const FieldFlags WRITEFIELD_CLOSE = 0x20;
const FieldFlags WRITEFIELD_ALL = 0xFF;
}
@@ -153,9 +149,6 @@ enum TxtTypes //enums for TextTypes
TXT_EDN = 4, TXT_ATN = 5, TXT_TXTBOX = 6, TXT_HFTXTBOX= 7
};
-extern SwNodeFnTab aWW8NodeFnTab;
-extern SwAttrFnTab aWW8AttrFnTab;
-
SV_DECL_VARARR( WW8Bytes, BYTE, 128, 128 )
struct WW8_SepInfo
@@ -173,45 +166,78 @@ struct WW8_SepInfo
{}
WW8_SepInfo( const SwPageDesc* pPD, const SwSectionFmt* pFmt,
- ULONG nLnRestart )
- : pPageDesc(pPD), pSectionFmt(pFmt), pPDNd(0), pNumNd(0),
- nLnNumRestartNo(nLnRestart), nPgRestartNo(0)
+ ULONG nLnRestart, USHORT nPgRestart = 0, const SwNode* pNd = NULL )
+ : pPageDesc( pPD ), pSectionFmt( pFmt ), pPDNd( pNd ), pNumNd( 0 ),
+ nLnNumRestartNo( nLnRestart ), nPgRestartNo( nPgRestart )
{}
+
bool IsProtected() const;
};
-SV_DECL_VARARR( WW8_WrSepInfoPtrs, WW8_SepInfo, 4, 4 )
+SV_DECL_VARARR( WW8_WrSepInfoPtrs, WW8_SepInfo, 4, 4 )
-class WW8_WrPlcSepx // Plc fuer PageDescs -> Sepx ( Section Extensions )
+/// Class to collect and output the sections/headers/footers.
+// Plc fuer PageDescs -> Sepx ( Section Extensions )
+class MSWordSections
{
-private:
+protected:
bool mbDocumentIsProtected;
WW8_WrSepInfoPtrs aSects; // PTRARR von SwPageDesc und SwSectionFmt
- SvULongs aCps; // PTRARR von CPs
- WW8_PdAttrDesc* pAttrs;
- WW8_WrPlc0* pTxtPos; // Pos der einzelnen Header / Footer
- void CheckForFacinPg( SwWW8Writer& rWrt ) const;
- void WriteOlst( SwWW8Writer& rWrt, USHORT i );
- void WriteFtnEndTxt( SwWW8Writer& rWrt, ULONG nCpStt );
- void OutHeader( SwWW8Writer& rWrt, const SwFmt& rFmt,
- ULONG& rCpPos, BYTE nHFFlags, BYTE nFlag );
- void OutFooter( SwWW8Writer& rWrt, const SwFmt& rFmt,
- ULONG& rCpPos, BYTE nHFFlags, BYTE nFlag );
+ void CheckForFacinPg( WW8Export& rWrt ) const;
+ void WriteOlst( WW8Export& rWrt, const WW8_SepInfo& rSectionInfo );
+ void NeedsDocumentProtected(const WW8_SepInfo &rInfo);
+
+ //No copy, no assign
+ MSWordSections( const MSWordSections& );
+ MSWordSections& operator=( const MSWordSections& );
+public:
+ MSWordSections( MSWordExportBase& rExport );
+ ~MSWordSections();
+
+ void AppendSep( const SwPageDesc* pPd,
+ const SwSectionFmt* pSectionFmt = 0,
+ ULONG nLnNumRestartNo = 0 );
+ void AppendSep( const SwFmtPageDesc& rPd,
+ const SwNode& rNd,
+ const SwSectionFmt* pSectionFmt,
+ ULONG nLnNumRestartNo );
+ void SetNum( const SwTxtNode* pNumNd );
+
+ /// Number of columns based on the most recent WW8_SepInfo.
+ sal_uInt16 CurrentNumberOfColumns( const SwDoc &rDoc ) const;
+
+ /// Number of columns of the provided WW8_SepInfo.
+ sal_uInt16 NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo& rInfo ) const;
+
+ bool DocumentIsProtected() const { return mbDocumentIsProtected; }
+
+ /// The most recent WW8_SepInfo.
+ const WW8_SepInfo* CurrentSectionInfo();
+
static void SetHeaderFlag( BYTE& rHeadFootFlags, const SwFmt& rFmt,
BYTE nFlag );
static void SetFooterFlag( BYTE& rHeadFootFlags, const SwFmt& rFmt,
BYTE nFlag );
+
+ /// Should we output borders?
static int HasBorderItem( const SwFmt& rFmt );
+};
- void NeedsDocumentProtected(const WW8_SepInfo &rInfo);
+class WW8_WrPlcSepx : public MSWordSections
+{
+ SvULongs aCps; // PTRARR von CPs
+ WW8_PdAttrDesc* pAttrs;
+ WW8_WrPlc0* pTxtPos; // Pos der einzelnen Header / Footer
+
+ // No copy, no assign
+ WW8_WrPlcSepx( const WW8_WrPlcSepx& );
+ WW8_WrPlcSepx& operator=( const WW8_WrPlcSepx& );
- //No copy, no assign
- WW8_WrPlcSepx(const WW8_WrPlcSepx&);
- WW8_WrPlcSepx& operator=(const WW8_WrPlcSepx&);
public:
- WW8_WrPlcSepx();
+ WW8_WrPlcSepx( MSWordExportBase& rExport );
~WW8_WrPlcSepx();
+
void AppendSep( WW8_CP nStartCp,
const SwPageDesc* pPd,
const SwSectionFmt* pSectionFmt = 0,
@@ -221,13 +247,17 @@ public:
const SwSectionFmt* pSectionFmt,
ULONG nLnNumRestartNo );
void Finish( WW8_CP nEndCp ) { aCps.Insert( nEndCp, aCps.Count() ); }
- void SetNum( const SwTxtNode* pNumNd );
- bool WriteKFTxt( SwWW8Writer& rWrt );
+
+ bool WriteKFTxt( WW8Export& rWrt );
void WriteSepx( SvStream& rStrm ) const;
- void WritePlcSed( SwWW8Writer& rWrt ) const;
- void WritePlcHdd( SwWW8Writer& rWrt ) const;
- sal_uInt16 CurrentNoColumns(const SwDoc &rDoc) const;
- bool DocumentIsProtected() const { return mbDocumentIsProtected; }
+ void WritePlcSed( WW8Export& rWrt ) const;
+ void WritePlcHdd( WW8Export& rWrt ) const;
+
+private:
+ void WriteFtnEndTxt( WW8Export& rWrt, ULONG nCpStt );
+public:
+ void OutHeaderFooter(WW8Export& rWrt, bool bHeader,
+ const SwFmt& rFmt, ULONG& rCpPos, BYTE nHFFlags, BYTE nFlag, BYTE nBreakCode);
};
//--------------------------------------------------------------------------
@@ -242,12 +272,13 @@ public:
WW8_WrPct(WW8_FC nStartFc, bool bSaveUniCode);
~WW8_WrPct();
void AppendPc(WW8_FC nStartFc, bool bIsUnicode);
- void WritePc(SwWW8Writer& rWrt);
+ void WritePc( WW8Export& rWrt );
void SetParaBreak();
bool IsUnicode() const { return bIsUni; }
WW8_CP Fc2Cp( ULONG nFc ) const;
};
+/// Collects and outputs fonts.
class wwFont
{
//In some future land the stream could be converted to a nice stream interface
@@ -258,29 +289,41 @@ private:
String msAltNm;
bool mbAlt;
bool mbWrtWW8;
+ FontPitch mePitch;
+ FontFamily meFamily;
+ rtl_TextEncoding meChrSet;
public:
- wwFont(const String &rFamilyName, FontPitch ePitch, FontFamily eFamily,
- rtl_TextEncoding eChrSet, bool bWrtWW8);
- bool Write(SvStream *pTableStram) const;
+ wwFont( const String &rFamilyName, FontPitch ePitch, FontFamily eFamily,
+ rtl_TextEncoding eChrSet, bool bWrtWW8 );
+ bool Write( SvStream *pTableStram ) const;
+#ifdef DOCX
+ void WriteDocx( const DocxAttributeOutput* rAttrOutput ) const;
+#endif
+ rtl::OUString GetFamilyName() const { return rtl::OUString( msFamilyNm ); }
friend bool operator < (const wwFont &r1, const wwFont &r2);
};
class wwFontHelper
{
private:
- /*
- * Keep track of fonts that need to be exported.
- */
+ /// Keep track of fonts that need to be exported.
::std::map<wwFont, USHORT> maFonts;
bool mbWrtWW8;
+
+ /// Convert from fast insertion map to linear vector in the order that we want to write.
+ ::std::vector< const wwFont* > AsVector() const;
+
public:
wwFontHelper() : mbWrtWW8(false) {}
- //rDoc used only to get the initial standard font(s) in use.
+ /// rDoc used only to get the initial standard font(s) in use.
void InitFontTable(bool bWrtWW8, const SwDoc& rDoc);
USHORT GetId(const Font& rFont);
USHORT GetId(const SvxFontItem& rFont);
USHORT GetId(const wwFont& rFont);
- void WriteFontTable(SvStream *pTableStream, WW8Fib& pFib );
+ void WriteFontTable( SvStream *pTableStream, WW8Fib& pFib );
+#ifdef DOCX
+ void WriteFontTable( const DocxAttributeOutput& rAttrOutput );
+#endif
};
class DrawObj
@@ -320,9 +363,9 @@ protected:
virtual WW8_CP GetCpOffset(const WW8Fib &rFib) const = 0;
public:
PlcDrawObj() {}
- void WritePlc(SwWW8Writer& rWrt) const;
- bool Append(SwWW8Writer&, WW8_CP nCp, const sw::Frame& rFmt,
- const Point& rNdTopLeft);
+ void WritePlc( WW8Export& rWrt ) const;
+ bool Append( WW8Export&, WW8_CP nCp, const sw::Frame& rFmt,
+ const Point& rNdTopLeft );
int size() { return maDrawObjs.size(); };
DrawObjVector &GetObjArr() { return maDrawObjs; }
virtual ~PlcDrawObj();
@@ -370,13 +413,42 @@ class WW8_WrtRedlineAuthor : public sw::util::WrtRedlineAuthor
virtual void Write(Writer &rWrt);
};
-// der WW8-Writer
-class SwWW8Writer: public StgWriter
+/** Structure that is used to save some of the WW8Export/DocxExport data.
+
+ It is used to be able to recurse inside of the WW8Export/DocxExport (eg.
+ for the needs of the tables) - you need to tall WriteText() from there with
+ new values of PaM etc.
+
+ It must contain all the stuff that might be saved either in WW8Export or in
+ DocxExport, because it makes no sense to do it abstract, and specialize it
+ for each of the cases. If you implement other *Export, just add the needed
+ members here, and store them in the appropriate SaveData() method.
+ */
+struct MSWordSaveData
{
-friend bool WW8_WrPlcSepx::WriteKFTxt( SwWW8Writer& rWrt ); // pO
-friend class WW8_WrPlcSepx;
-friend Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode );
+ Point* pOldFlyOffset;
+ RndStdIds eOldAnchorType;
+ WW8Bytes* pOOld; ///< WW8Export only
+ WW8Bytes* mpTableAtOld; ///< WW8Export only: Additional buffer for the output of the tables
+ sal_uInt16 mnTableStdAtLenOld; ///< WW8Export only: Standard length of mpTableAt
+ SwPaM* pOldPam, *pOldEnd;
+ const sw::Frame* pOldFlyFmt;
+ const SwPageDesc* pOldPageDesc;
+ BYTE bOldWriteAll : 1; ///< WW8Export only
+ BYTE bOldOutTable : 1;
+ BYTE bOldIsInTable: 1;
+ BYTE bOldFlyFrmAttrs : 1;
+ BYTE bOldStartTOX : 1;
+ BYTE bOldInWriteTOX : 1;
+ // bOutPageDesc muss nicht gesichert werden, da es nur nicht waehrend der
+ // Ausgabe von Spezial-Texten veraendert wird.
+};
+
+/// Base class for WW8Export and DocxExport
+class MSWordExportBase
+{
+public:
wwFontHelper maFontHelper;
std::vector<ULONG> maChapterFieldLocs;
typedef std::vector<ULONG>::const_iterator mycCFIter;
@@ -385,9 +457,9 @@ friend Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode );
const SfxItemSet* pISet; // fuer Doppel-Attribute
WW8_WrPct* pPiece; // Pointer auf Piece-Table
SwNumRuleTbl* pUsedNumTbl; // alle used NumRules
- const SwTxtNode *mpTopNodeOfHdFtPage; //top node of host page when in hd/ft
- std::map<USHORT, USHORT> aRuleDuplicates; //map to Duplicated numrules
- std::stack<xub_StrLen> maCurrentCharPropStarts;
+ const SwTxtNode *mpTopNodeOfHdFtPage; ///< Top node of host page when in hd/ft
+ std::map< USHORT, USHORT > aRuleDuplicates; //map to Duplicated numrules
+ std::stack< xub_StrLen > m_aCurrentCharPropStarts; ///< To remember the position in a run.
WW8_WrtBookmarks* pBkmks;
WW8_WrtRedlineAuthor* pRedlAuthors;
BitmapPalette* pBmpPal;
@@ -399,66 +471,23 @@ friend Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode );
USHORT nCharFmtStart;
USHORT nFmtCollStart;
- USHORT nStyleBeforeFly; // Style-Nummer des Nodes,
- // in/an dem ein Fly verankert ist
- USHORT nLastFmtId; // Style of last TxtNode in normal range
- USHORT nUniqueList; // current number for creating unique list names
+ USHORT nStyleBeforeFly; ///< Style-Nummer des Nodes,
+ ///< in/an dem ein Fly verankert ist
+ USHORT nLastFmtId; ///< Style of last TxtNode in normal range
+ USHORT nUniqueList; ///< current number for creating unique list names
unsigned int mnHdFtIndex;
- virtual ULONG WriteStorage();
- virtual ULONG WriteMedium( SfxMedium& );
+ USHORT mnRedlineMode; ///< Remember the original redline mode
- void PrepareStorage();
- void WriteFkpPlcUsw();
- void WriteMainText();
- void StoreDoc1();
- ULONG StoreDoc();
- void Out_Olst( const SwNumRule& rRule );
- void Out_WwNumLvl( BYTE nWwLevel );
- void Out_SwNumLvl( BYTE nSwLevel );
- void Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFmt& rFmt,
- BYTE nSwLevel );
- void BuildAnlvBulletBase( WW8_ANLV& rAnlv, BYTE*& rpCh, USHORT& rCharLen,
- const SwNumFmt& rFmt );
- void SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet,
- String& rFontName) const;
-
- static void BuildAnlvBase( WW8_ANLV& rAnlv, BYTE*& rpCh, USHORT& rCharLen,
- const SwNumRule& rRul, const SwNumFmt& rFmt, BYTE nSwLevel );
-
- void Out_BorderLine(WW8Bytes& rO, const SvxBorderLine* pLine,
- USHORT nDist, USHORT nSprmNo, bool bShadow);
-
- void OutListTab();
- void OutOverrideListTab();
- void OutListNamesTab();
-
- void RestoreMacroCmds();
-
- void InitFontTable();
-
- bool MiserableFormFieldExportHack(const SwFrmFmt& rFrmFmt);
- void DoComboBox(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPropSet);
- void DoCheckBox(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPropSet);
- void GatherChapterFields();
- bool FmtHdFtContainsChapterField(const SwFrmFmt &rFmt) const;
- bool CntntContainsChapterField(const SwFmtCntnt &rCntnt) const;
- void OutWW8_SwEndNode( SwNode * pNode );
public:
-
/* implicit bookmark vector containing pairs of node indexes and bookmark names */
SwImplBookmarks maImplicitBookmarks;
sw::Frames maFrames; // The floating frames in this document
const SwPageDesc *pAktPageDesc;
- WW8Fib* pFib;
- WW8Dop* pDop;
WW8_WrPlcPn* pPapPlc;
WW8_WrPlcPn* pChpPlc;
- WW8_AttrIter* pChpIter;
- WW8WrtStyle* pStyles;
- WW8_WrPlcSepx* pSepx;
- WW8_WrPlcFtnEdn* pFtn;
- WW8_WrPlcFtnEdn* pEdn;
+ MSWordAttrIter* pChpIter;
+ MSWordStyles* pStyles;
WW8_WrPlcPostIt* pAtn;
WW8_WrPlcTxtBoxes *pTxtBxs, *pHFTxtBxs;
@@ -473,6 +502,7 @@ public:
WW8_WrPlcFld* pFldHdFt; // Felder in Header/Footer
WW8_WrPlcFld* pFldFtn; // Felder in FootNotes
WW8_WrPlcFld* pFldEdn; // Felder in EndNotes
+ WW8_WrPlcFld* pFldAtn; // Felder in Annotations
WW8_WrPlcFld* pFldTxtBxs; // fields in textboxes
WW8_WrPlcFld* pFldHFTxtBxs; // fields in header/footer textboxes
WW8_WrMagicTable *pMagicTable; // keeps track of table cell positions, and
@@ -482,14 +512,11 @@ public:
SwWW8WrGrf* pGrf;
const SwAttrSet* pStyAttr; // StyleAttr fuer Tabulatoren
const SwModify* pOutFmtNode; // write Format or Node
+ const SwFmt *pCurrentStyle; // iff bStyDef=true, then this store the current style
MainTxtPlcDrawObj *pSdrObjs; // Draw-/Fly-Objects
HdFtPlcDrawObj *pHFSdrObjs; // Draw-/Fly-Objects in header or footer
- WW8Bytes* pO;
-
- SvStream *pTableStrm, *pDataStrm; // Streams fuer WW97 Export
-
SwEscherEx* pEscher; // escher export class
// --> OD 2007-04-19 #i43447# - removed
// SwTwips nFlyWidth, nFlyHeight; // Fuer Anpassung Graphic
@@ -501,14 +528,13 @@ public:
BYTE bBreakBefore : 1; // Breaks werden 2mal ausgegeben
BYTE bOutKF : 1; // Kopf/Fusstexte werden ausgegeben
BYTE bOutFlyFrmAttrs : 1; // Rahmen-Attr von Flys werden ausgegeben
- BYTE bOutPageDescs : 1; // PageDescs werden ausgegeben ( am Doc-Ende )
+ BYTE bOutPageDescs : 1; ///< PageDescs (section properties) are being written
BYTE bOutFirstPage : 1; // write Attrset of FirstPageDesc
BYTE bOutTable : 1; // Tabelle wird ausgegeben
// ( wird zB bei Flys in Tabelle zurueckgesetzt )
BYTE bIsInTable : 1; // wird sind innerhalb der Ausgabe einer Tabelle
// ( wird erst nach der Tabelle zurueckgesetzt )
BYTE bOutGrf : 1; // Grafik wird ausgegeben
- BYTE bWrtWW8 : 1; // Schreibe WW95 oder WW97 FileFormat
BYTE bInWriteEscher : 1; // in write textboxes
BYTE bStartTOX : 1; // true: a TOX is startet
BYTE bInWriteTOX : 1; // true: all content are in a TOX
@@ -517,87 +543,455 @@ public:
BYTE bHasHdr : 1;
BYTE bHasFtr : 1;
+ SwDoc *pDoc;
+ SwPaM *pCurPam, *pOrigPam;
+ /// Stack to remember the nesting (see MSWordSaveData for more)
+ ::std::stack< MSWordSaveData > maSaveData;
+public:
+ /// The main function to export the document.
+ void ExportDocument( bool bWriteAll );
- SvxMSExportOLEObjects& GetOLEExp() { return *pOLEExp; }
- SwMSConvertControls& GetOCXExp() { return *pOCXExp; }
- WW8OleMaps& GetOLEMap() { return *pOleMap; }
- void ExportDopTypography(WW8DopTypography &rTypo);
+ /// Iterate through the nodes and call the appropriate OutputNode() on them.
+ void WriteText();
- const SfxPoolItem* HasItem( USHORT nWhich ) const;
- const SfxPoolItem& GetItem( USHORT nWhich ) const;
+ /// Set the pCurPam appropriately and call WriteText().
+ ///
+ /// Used to export paragraphs in footnotes/endnotes/etc.
+ void WriteSpecialText( ULONG nStart, ULONG nEnd, BYTE nTTyp );
+
+ /// Export the pool items to attributes (through an attribute output class).
+ void ExportPoolItemsToCHP( sw::PoolItems &rItems, USHORT nScript );
+
+ /// Return the numeric id of the numbering rule
+ USHORT GetId( const SwNumRule& rNumRule );
+ /// Return the numeric id of the style.
USHORT GetId( const SwTxtFmtColl& rColl ) const;
+
+ /// Return the numeric id of the style.
USHORT GetId( const SwCharFmt& rFmt ) const;
- USHORT GetId( const SwNumRule& rNumRule ) const;
+
USHORT GetId( const SwTOXType& rTOXType );
+
+ const SfxPoolItem& GetItem( USHORT nWhich ) const;
+
+ /// Find the reference.
+ bool HasRefToObject( USHORT nTyp, const String* pName, USHORT nSeqNo );
+
+ /// Find the bookmark name.
+ String GetBookmarkName( USHORT nTyp, const String* pName, USHORT nSeqNo );
+
+ /// Add a bookmark converted to a Word name.
+ void AppendWordBookmark( const String& rName );
+
+ /// Use OutputItem() on an item set according to the parameters.
+ void OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript );
+
+ short GetDefaultFrameDirection( ) const;
+
+ /// Right to left?
+ short TrueFrameDirection( const SwFrmFmt& rFlyFmt ) const;
+
+ /// Right to left?
+ short GetCurrentPageDirection() const;
+
+ /// In case of numbering restart.
+
+ /// List is set to restart at a particular value so for export make a
+ /// completely new list based on this one and export that instead,
+ /// which duplicates words behaviour in this respect.
+ USHORT DuplicateNumRule( const SwNumRule *pRule, BYTE nLevel, USHORT nVal );
+
+ /// Access to the attribute output class.
+ virtual AttributeOutputBase& AttrOutput() const = 0;
+
+ /// Access to the sections/headers/footres.
+ virtual MSWordSections& Sections() const = 0;
+
+ /// Hack, unfortunately necessary at some places for now.
+ /// FIXME remove it when possible.
+ virtual bool HackIsWW8OrHigher() const = 0;
+
+ /// Guess the script (asian/western).
+ ///
+ /// Sadly word does not have two different sizes for asian font size and
+ /// western font size, it has two different fonts, but not sizes, so we
+ /// have to use our guess as to the script used and disable the export of
+ /// one type. The same occurs for font weight and posture (bold and
+ /// italic).
+ ///
+ /// In addition WW7- has only one character language identifier while WW8+
+ /// has two
+ virtual bool CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich ) = 0;
+
+ virtual void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, xub_StrLen nLen ) = 0;
+
+ virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ) = 0;
+
+ // FIXME probably a hack...
+ virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t() ) = 0;
+
+ // FIXME definitely a hack, must not be here - it can't do anything
+ // sensible for docx
+ virtual void WriteChar( sal_Unicode c ) = 0;
+
+ /// Output attributes.
+ void OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpFmt, bool bFlyFmt = false );
+
+ /// Getter for pISet.
+ const SfxItemSet* GetCurItemSet() const { return pISet; }
+
+ /// Setter for pISet.
+ void SetCurItemSet( const SfxItemSet* pS ) { pISet = pS; }
+
+ /// Remember some of the memebers so that we can recurse in WriteText().
+ virtual void SaveData( ULONG nStt, ULONG nEnd );
+
+ /// Restore what was saved in SaveData().
+ virtual void RestoreData();
+
+ /// The return value indicates, if a follow page desc is written.
+ bool OutputFollowPageDesc( const SfxItemSet* pSet,
+ const SwTxtNode* pNd );
+
+ /// Write header/footer text.
+ void WriteHeaderFooterText( const SwFmt& rFmt, bool bHeader);
+
+ /// Format of the section.
+ const SwSectionFmt* GetSectionFormat( const SwNode& rNd ) const;
+
+ /// Line number of the section start.
+ ULONG GetSectionLineNo( const SfxItemSet* pSet, const SwNode& rNd ) const;
+
+ /// Start new section.
+ void OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd );
+
+ /// Write section properties.
+ ///
+ /// pA is ignored for docx.
+ void SectionProperties( const WW8_SepInfo& rSectionInfo, WW8_PdAttrDesc* pA = NULL );
+
+ /// Output the numbering table.
+ virtual void WriteNumbering() = 0;
+
+ /// Write static data of SwNumRule - LSTF
+ void NumberingDefinitions();
+
+ /// Write all Levels for all SwNumRules - LVLF
+ void AbstractNumberingDefinitions();
+
+ // Convert the bullet according to the font.
+ void SubstituteBullet( String& rNumStr, rtl_TextEncoding& rChrSet,
+ String& rFontName ) const;
+
+ /// No-op for the newer WW versions.
+ virtual void OutputOlst( const SwNumRule& /*rRule*/ ) {}
+
+ /// Setup the pA's info.
+ virtual void SetupSectionPositions( WW8_PdAttrDesc* /*pA*/ ) {}
+
+ /// Top node of host page when in header/footer.
+ void SetHdFtPageRoot( const SwTxtNode *pNd ) { mpTopNodeOfHdFtPage = pNd; }
+
+ /// Top node of host page when in header/footer.
+ const SwTxtNode *GetHdFtPageRoot() const { return mpTopNodeOfHdFtPage; }
+
+ /// Output the actual headers and footers.
+ virtual void WriteHeadersFooters( BYTE nHeadFootFlags,
+ const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt,
+ BYTE nBreakCode) = 0;
+
+ /// Write the field
+ virtual void OutputField( const SwField* pFld, ww::eField eFldType,
+ const String& rFldCmd, BYTE nMode = nsFieldFlags::WRITEFIELD_ALL ) = 0;
+
+ /// Write the data of the form field
+ virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) = 0;
+
+ virtual void DoComboBox(const rtl::OUString &rName,
+ const rtl::OUString &rHelp,
+ const rtl::OUString &ToolTip,
+ const rtl::OUString &rSelected,
+ com::sun::star::uno::Sequence<rtl::OUString> &rListItems) = 0;
+
+ virtual void DoFormText(const SwInputField * pFld) = 0;
+
+ static bool NoPageBreakSection( const SfxItemSet *pSet );
+
+ // Compute the number format for WW dates
+ bool GetNumberFmt(const SwField& rFld, String& rStr);
+
+ virtual ULONG ReplaceCr( BYTE nChar ) = 0;
+
+ const SfxPoolItem* HasItem( USHORT nWhich ) const;
+
+
+protected:
+ /// Format-dependant part of the actual export.
+ virtual void ExportDocument_Impl() = 0;
+
+ /// Get the next position in the text node to output
+ virtual xub_StrLen GetNextPos( SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos );
+
+ /// Update the information for GetNextPos().
+ virtual void UpdatePosition( SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd );
+
+ /// Output SwTxtNode
+ void OutputTextNode( const SwTxtNode& );
+
+ /// Output SwTableNode
+ void OutputTableNode( const SwTableNode& );
+
+ /// Setup the chapter fields (maChapterFieldLocs).
+ void GatherChapterFields();
+
+ void AddLinkTarget( const String& rURL );
+ void CollectOutlineBookmarks( const SwDoc &rDoc );
+
+ bool SetAktPageDescFromNode(const SwNode &rNd);
+ bool CntntContainsChapterField(const SwFmtCntnt &rCntnt) const;
+ bool FmtHdFtContainsChapterField(const SwFrmFmt &rFmt) const;
+
+ virtual void SectionBreaksAndFrames( const SwTxtNode& rNode ) = 0;
+
+ virtual void PrepareNewPageDesc( const SfxItemSet* pSet,
+ const SwNode& rNd,
+ const SwFmtPageDesc* pNewPgDescFmt = 0,
+ const SwPageDesc* pNewPgDesc = 0 ) = 0;
+
+ /// Return value indicates if an inherited outline numbering is suppressed.
+ virtual bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt) = 0;
+
+protected:
+ /// Output SwEndNode
+ virtual void OutputEndNode( const SwEndNode& );
+
+ /// Output SwGrfNode
+ virtual void OutputGrfNode( const SwGrfNode& ) = 0;
+
+ /// Output SwOLENode
+ virtual void OutputOLENode( const SwOLENode& ) = 0;
+
+ /// Output SwSectionNode
+ virtual void OutputSectionNode( const SwSectionNode& );
+
+ virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, ULONG nLnNum ) = 0;
+
+ /// Call the right (virtual) function according to the type of the item.
+ ///
+ /// One of OutputTextNode(), OutputGrfNode(), or OutputOLENode()
+ void OutputContentNode( const SwCntntNode& );
+
+public:
+ MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam );
+ virtual ~MSWordExportBase();
+
+ // TODO move as much as possible here from WW8Export! ;-)
+
+ static void CorrectTabStopInSet( SfxItemSet& rSet, USHORT nAbsLeft );
+
+private:
+ /// No copying.
+ MSWordExportBase( const MSWordExportBase& );
+ /// No copying.
+ MSWordExportBase& operator=( const MSWordExportBase& );
+};
+
+/// The writer class that gets called for the WW8 filter.
+class SwWW8Writer: public StgWriter
+{
+// friends to get access to m_pExport
+// FIXME avoid that, this is probably not what we want
+// (if yes, remove the friends, and provide here a GetExport() method)
+friend void WW8_WrtRedlineAuthor::Write(Writer &rWrt);
+
+ bool m_bWrtWW8;
+ WW8Export *m_pExport;
+ SfxMedium *mpMedium;
+
+public:
+ SwWW8Writer( const String& rFltName, const String& rBaseURL );
+ virtual ~SwWW8Writer();
+
+ virtual ULONG WriteStorage();
+ virtual ULONG WriteMedium( SfxMedium& );
+
+ // TODO most probably we want to be able to get these in
+ // MSExportFilterBase
+ using Writer::getIDocumentSettingAccess;
+
+public:
+#if 1
+ /// Prefer ww::bytes to WW8Bytes, migrate away from the other ones.
+ static void InsUInt16(ww::bytes &rO, sal_uInt16 n);
+ static void InsUInt32(ww::bytes &rO, sal_uInt32 n);
+ static void InsAsString16(ww::bytes &rO, const String& rStr);
+ static void InsAsString8(ww::bytes & O, const String& rStr,
+ rtl_TextEncoding eCodeSet);
+#endif
+
+ static void InsUInt16( WW8Bytes& rO, UINT16 );
+ static void InsUInt32( WW8Bytes& rO, UINT32 );
+ static void InsAsString16( WW8Bytes& rO, const String& );
+ static void InsAsString8( WW8Bytes& rO, const String& rStr,
+ rtl_TextEncoding eCodeSet );
+
+ static ULONG FillUntil( SvStream& rStrm, ULONG nEndPos = 0 );
+ static void FillCount( SvStream& rStrm, ULONG nCount );
+
+ static void WriteShort( SvStream& rStrm, INT16 nVal ) { rStrm << nVal; }
+ static void WriteShort( SvStream& rStrm, ULONG nPos, INT16 nVal );
+
+ static void WriteLong( SvStream& rStrm, INT32 nVal ) { rStrm << nVal; }
+ static void WriteLong( SvStream& rStrm, ULONG nPos, INT32 nVal );
+
+ static void WriteString16(SvStream& rStrm, const String& rStr,
+ bool bAddZero);
+ static void WriteString8(SvStream& rStrm, const String& rStr,
+ bool bAddZero, rtl_TextEncoding eCodeSet);
+
+ static void WriteString_xstz(SvStream& rStrm, const String& rStr, bool bAddZero);
+
+ String GetPassword();
+
+ using StgWriter::Write;
+ virtual ULONG Write( SwPaM&, SfxMedium&, const String* = 0 );
+
+private:
+ /// No copying.
+ SwWW8Writer(const SwWW8Writer&);
+ /// No copying.
+ SwWW8Writer& operator=(const SwWW8Writer&);
+};
+
+/// Exporter of the binary Word file formats.
+class WW8Export : public MSWordExportBase
+{
+public:
+ WW8Bytes* pO; ///< Buffer
+ WW8Bytes* mpTableAt; ///< Additional buffer for the output of the tables
+ sal_uInt16 mnTableStdAtLen; ///< Standard length of mpTableAt
+
+ SvStream *pTableStrm, *pDataStrm; ///< Streams for WW97 Export
+
+ WW8Fib* pFib; ///< File Information Block
+ WW8Dop* pDop; ///< DOcument Properties
+ WW8_WrPlcFtnEdn *pFtn; ///< Footnotes - structure to remember them, and output
+ WW8_WrPlcFtnEdn *pEdn; ///< Endnotes - structure to remember them, and output
+ WW8_WrPlcSepx* pSepx; ///< Sections/headers/footers
+
+ BYTE bWrtWW8 : 1; ///< Write WW95 (false) or WW97 (true) file format
+
+protected:
+ SwWW8Writer *m_pWriter; ///< Pointer to the writer
+ WW8AttributeOutput *m_pAttrOutput; ///< Converting attributes to stream data
+
+public:
+ /// Access to the attribute output class.
+ virtual AttributeOutputBase& AttrOutput() const;
+
+ /// Access to the sections/headers/footres.
+ virtual MSWordSections& Sections() const;
+
+ /// False for WW6, true for WW8.
+ virtual bool HackIsWW8OrHigher() const { return bWrtWW8; }
+
+private:
+ /// Format-dependant part of the actual export.
+ virtual void ExportDocument_Impl();
+
+ void PrepareStorage();
+ void WriteFkpPlcUsw();
+ void WriteMainText();
+ void StoreDoc1();
+ void Out_WwNumLvl( BYTE nWwLevel );
+ void BuildAnlvBulletBase( WW8_ANLV& rAnlv, BYTE*& rpCh, USHORT& rCharLen,
+ const SwNumFmt& rFmt );
+ static void BuildAnlvBase( WW8_ANLV& rAnlv, BYTE*& rpCh, USHORT& rCharLen,
+ const SwNumRule& rRul, const SwNumFmt& rFmt, BYTE nSwLevel );
+
+ void Out_BorderLine(WW8Bytes& rO, const SvxBorderLine* pLine,
+ USHORT nDist, sal_uInt16 nSprmNo, bool bShadow);
+
+ /// Output the numbering table.
+ virtual void WriteNumbering();
+
+ void OutOverrideListTab();
+ void OutListNamesTab();
+
+ void RestoreMacroCmds();
+
+ void InitFontTable();
+
+ void DoComboBox(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPropSet);
+ void DoCheckBox(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPropSet);
+
+public:
+ virtual void OutputOlst( const SwNumRule& rRule );
+
+ /// Setup the pA's info.
+ virtual void SetupSectionPositions( WW8_PdAttrDesc* pA );
+
+ void Out_SwNumLvl( BYTE nSwLevel );
+ void Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFmt& rFmt,
+ BYTE nSwLevel );
+
+ bool MiserableFormFieldExportHack(const SwFrmFmt& rFrmFmt);
+
+ SvxMSExportOLEObjects& GetOLEExp() { return *pOLEExp; }
+ SwMSConvertControls& GetOCXExp() { return *pOCXExp; }
+ WW8OleMaps& GetOLEMap() { return *pOleMap; }
+ void ExportDopTypography(WW8DopTypography &rTypo);
+
+ using MSWordExportBase::GetId;
USHORT GetId( const SvxFontItem& rFont)
{
return maFontHelper.GetId(rFont);
}
- void OutRedline( const SwRedlineData& rRedline );
USHORT AddRedlineAuthor( USHORT nId );
- void StartTOX( const SwSection& rSect );
- void EndTOX( const SwSection& rSect );
-
- void WriteSpecialText( ULONG nStart, ULONG nEnd, BYTE nTTyp );
- void WriteKFTxt1( const SwFmtCntnt& rCntnt );
void WriteFtnBegin( const SwFmtFtn& rFtn, WW8Bytes* pO = 0 );
void WritePostItBegin( WW8Bytes* pO = 0 );
- short TrueFrameDirection(const SwFrmFmt &rFlyFmt) const;
- short GetCurrentPageDirection() const;
const SvxBrushItem* GetCurrentPageBgBrush() const;
SvxBrushItem TrueFrameBgBrush(const SwFrmFmt &rFlyFmt) const;
- void OutWW8FlyFrmsInCntnt( const SwTxtNode& rNd );
- void OutWW8FlyFrm(const sw::Frame& rFmt, const Point& rNdTopLeft);
- void OutFlyFrm(const sw::Frame& rFmt);
+
+ /// Output all textframes anchored as character for the winword 7- format.
+ void OutWW6FlyFrmsInCntnt( const SwTxtNode& rNd );
+
void AppendFlyInFlys(const sw::Frame& rFrmFmt, const Point& rNdTopLeft);
void WriteOutliner(const OutlinerParaObject& rOutliner, BYTE nTyp);
void WriteSdrTextObj(const SdrObject& rObj, BYTE nTyp);
- void OutWW8TableInfoCell(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableInfoRow(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableBackgrounds(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableHeight(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableCanSplit(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableBidi(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableVerticalCell(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo);
- void OutWW8TableNodeInfo(ww8::WW8TableNodeInfo::Pointer_t pNodeInfo);
- void OutWW8_TableNodeInfoInner(ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner);
- void OutWW8TableOrientation(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner);
UINT32 GetSdrOrdNum( const SwFrmFmt& rFmt ) const;
void CreateEscher();
void WriteEscher();
bool Out_SwNum(const SwTxtNode* pNd);
- void Out_SwFmt(const SwFmt& rFmt, bool bPapFmt, bool bChpFmt,
- bool bFlyFmt = false);
- bool GetNumberFmt(const SwField& rFld, String& rStr);
- void OutField(const SwField* pFld, ww::eField eFldType,
- const String& rFldCmd, BYTE nMode = nsFieldFlags::WRITEFIELD_ALL);
+
+ /// Write the field
+ virtual void OutputField( const SwField* pFld, ww::eField eFldType,
+ const String& rFldCmd, BYTE nMode = nsFieldFlags::WRITEFIELD_ALL );
+
void StartCommentOutput( const String& rName );
void EndCommentOutput( const String& rName );
void OutGrf(const sw::Frame &rFrame);
bool TestOleNeedsGraphic(const SwAttrSet& rSet, SvStorageRef xOleStg,
SvStorageRef xObjStg, String &rStorageName, SwOLENode *pOLENd);
- void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos,
- xub_StrLen nLen );
- void AppendBookmark( const String& rName, USHORT nOffset = 0 );
- String GetBookmarkName( USHORT nTyp, const String* pNm, USHORT nSeqNo );
+
+ virtual void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, xub_StrLen nLen );
+ virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false );
void MoveFieldMarks(ULONG nFrom, ULONG nTo);
- bool HasRefToObject(USHORT nTyp, const String* pNm, USHORT nSeqNo);
void WriteAsStringTable(const ::std::vector<String>&, INT32& rfcSttbf,
INT32& rlcbSttbf, USHORT nExtraLen = 0);
- void WriteText();
- void WriteCR(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t());
+
+ virtual ULONG ReplaceCr( BYTE nChar );
+
+ virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t() );
void WriteChar( sal_Unicode c );
- void WriteRowEnd(sal_uInt32 nDepth = 1);
#if 0
USHORT StartTableFromFrmFmt(WW8Bytes &rAt, const SwFrmFmt *pFmt,
SwTwips &rPageSize);
@@ -606,8 +1000,6 @@ public:
void OutSwString(const String&, xub_StrLen nStt, xub_StrLen nLen,
bool bUnicode, rtl_TextEncoding eChrSet);
- ULONG ReplaceCr( BYTE nChar );
-
WW8_CP Fc2Cp( ULONG nFc ) const { return pPiece->Fc2Cp( nFc ); }
// einige z.T. static halb-interne Funktions-Deklarationen
@@ -617,24 +1009,14 @@ public:
inline bool IsUnicode() const { return pPiece->IsUnicode(); }
- const SfxItemSet* GetCurItemSet() const { return pISet; }
- void SetCurItemSet( const SfxItemSet* pS ) { pISet = pS; }
+ virtual void SectionBreaksAndFrames( const SwTxtNode& rNode );
- void ExportPoolItemsToCHP(sw::PoolItems &rItems, USHORT nScript);
- void Out_SfxItemSet(const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt,
- USHORT nScript);
- void Out_SfxBreakItems(const SfxItemSet *pSet, const SwNode& rNd);
- bool SetAktPageDescFromNode(const SwNode &rNd);
- // --> OD 2007-05-29 #i76300#
- // return value indicates, if a follow page desc is written.
- bool Out_FollowPageDesc( const SfxItemSet* pSet,
- const SwTxtNode* pNd );
- // helper method for <Out_SfxBreakItems(..)> and <Out_FollowPageDesc(..)>
- void PrepareNewPageDesc( const SfxItemSet* pSet,
- const SwNode& rNd,
- const SwFmtPageDesc* pNewPgDescFmt = 0,
- const SwPageDesc* pNewPgDesc = 0 );
- // <--
+ /// Helper method for OutputSectionBreaks() and OutputFollowPageDesc().
+ // OD 2007-05-29 #i76300#
+ virtual void PrepareNewPageDesc( const SfxItemSet* pSet,
+ const SwNode& rNd,
+ const SwFmtPageDesc* pNewPgDescFmt = 0,
+ const SwPageDesc* pNewPgDesc = 0 );
void Out_SwFmtBox(const SvxBoxItem& rBox, bool bShadow);
void Out_SwFmtTableBox( WW8Bytes& rO, const SvxBoxItem& rBox );
@@ -643,56 +1025,31 @@ public:
WW8_BRC TranslateBorderLine(const SvxBorderLine& pLine,
USHORT nDist, bool bShadow);
- void ExportOutlineNumbering(BYTE nLvl, const SwNumFmt &rNFmt,
- const SwFmt &rFmt);
// --> OD 2007-06-04 #i77805#
// new return value indicates, if an inherited outline numbering is suppressed
- bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt);
+ virtual bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt);
// <--
unsigned int GetHdFtIndex() const { return mnHdFtIndex; }
void SetHdFtIndex(unsigned int nHdFtIndex) { mnHdFtIndex = nHdFtIndex; }
+ void IncrementHdFtIndex() { ++mnHdFtIndex; }
static long GetDTTM( const DateTime& rDT );
+ /// Convert the SVX numbering type to id
static BYTE GetNumId( USHORT eNumType );
- static void CorrTabStopInSet( SfxItemSet& rSet, USHORT nAbsLeft );
-
- static ULONG FillUntil( SvStream& rStrm, ULONG nEndPos = 0 );
- static void FillCount( SvStream& rStrm, ULONG nCount );
- static void WriteShort( SvStream& rStrm, INT16 nVal ) { rStrm << nVal; }
- static void WriteShort( SvStream& rStrm, ULONG nPos, INT16 nVal );
+ /// Guess the script (asian/western).
+ virtual bool CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich );
- static void WriteLong( SvStream& rStrm, INT32 nVal ) { rStrm << nVal; }
- static void WriteLong( SvStream& rStrm, ULONG nPos, INT32 nVal );
-
- static void WriteString16(SvStream& rStrm, const String& rStr,
- bool bAddZero);
- static void WriteString8(SvStream& rStrm, const String& rStr,
- bool bAddZero, rtl_TextEncoding eCodeSet);
-
- static void WriteString_xstz(SvStream& rStrm, const String& rStr, bool bAddZero);
-#if 1
- //Prefer ww::bytes to WW8Bytes, migrate away from the other ones.
- static void InsUInt16(ww::bytes &rO, sal_uInt16 n);
- static void InsUInt32(ww::bytes &rO, sal_uInt32 n);
- static void InsAsString16(ww::bytes &rO, const String& rStr);
- static void InsAsString8(ww::bytes & O, const String& rStr,
- rtl_TextEncoding eCodeSet);
-#endif
-
- static void InsUInt16( WW8Bytes& rO, UINT16 );
- static void InsUInt32( WW8Bytes& rO, UINT32 );
- static void InsAsString16( WW8Bytes& rO, const String& );
- static void InsAsString8( WW8Bytes& rO, const String& rStr,
- rtl_TextEncoding eCodeSet );
- bool CollapseScriptsforWordOk(USHORT nScript, USHORT nWhich);
USHORT DupNumRuleWithLvlStart(const SwNumRule *pRule,BYTE nLvl,USHORT nVal);
SwTwips CurrentPageWidth(SwTwips &rLeft, SwTwips &rRight) const;
+
+ /// Nasty swap for bidi if neccessary
bool MiserableRTLFrmFmtHack(SwTwips &rLeft, SwTwips &rRight,
const sw::Frame &rFrmFmt);
+
void InsUInt16( UINT16 n ) { SwWW8Writer::InsUInt16( *pO, n ); }
void InsUInt32( UINT32 n ) { SwWW8Writer::InsUInt32( *pO, n ); }
void InsAsString16( const String& rStr )
@@ -701,41 +1058,56 @@ public:
{ SwWW8Writer::InsAsString8( *pO, rStr, eCodeSet ); }
void WriteStringAsPara( const String& rTxt, USHORT nStyleId = 0 );
- // nach aussen interessant
-
- SwWW8Writer( const String& rFltName, const String& rBaseURL );
- virtual ~SwWW8Writer();
+ /// Setup the exporter.
+ WW8Export( SwWW8Writer *pWriter,
+ SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam,
+ bool bIsWW8 );
+ virtual ~WW8Export();
- // fuer WW8SaveData
- SwPaM* GetEndPaM() { return pOrigPam; }
- void SetEndPaM( SwPaM* pPam ) { pOrigPam = pPam; }
-
- void DoComboBox(const rtl::OUString &rName,
+ virtual void DoComboBox(const rtl::OUString &rName,
const rtl::OUString &rHelp,
const rtl::OUString &ToolTip,
const rtl::OUString &rSelected,
com::sun::star::uno::Sequence<rtl::OUString> &rListItems);
- void DoFormText(const SwInputField * pFld);
+ virtual void DoFormText(const SwInputField * pFld);
- static bool NoPageBreakSection(const SfxItemSet *pSet);
- void push_charpropstart(xub_StrLen nPos);
- void pop_charpropstart();
- xub_StrLen top_charpropstart() const;
void GetCurrentItems(WW8Bytes &rItems) const;
- void SetHdFtPageRoot(const SwTxtNode *pNd) { mpTopNodeOfHdFtPage = pNd; }
- const SwTxtNode *GetHdFtPageRoot() const { return mpTopNodeOfHdFtPage; }
- void AddLinkTarget(const String& rURL);
- void CollectOutlineBookmarks(const SwDoc &rDoc);
- void AddBookmark(String sBkmkName);
+ /// Write the data of the form field
+ virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark );
- void WriteFormData(const ::sw::mark::IFieldmark& rFieldmark);
+ /// Fields.
WW8_WrPlcFld* CurrentFieldPlc() const;
+
+ SwWW8Writer& GetWriter() const { return *m_pWriter; }
+ SvStream& Strm() const { return m_pWriter->Strm(); }
+
+ /// Remember some of the memebers so that we can recurse in WriteText().
+ virtual void SaveData( ULONG nStt, ULONG nEnd );
+
+ /// Restore what was saved in SaveData().
+ virtual void RestoreData();
+
+ /// Output the actual headers and footers.
+ virtual void WriteHeadersFooters( BYTE nHeadFootFlags,
+ const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt,
+ BYTE nBreakCode);
+
+protected:
+ /// Output SwGrfNode
+ virtual void OutputGrfNode( const SwGrfNode& );
+
+ /// Output SwOLENode
+ virtual void OutputOLENode( const SwOLENode& );
+
+ virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, ULONG nLnNum );
+
private:
- //No copying
- SwWW8Writer(const SwWW8Writer&);
- SwWW8Writer& operator=(const SwWW8Writer&);
+ /// No copying.
+ WW8Export(const WW8Export&);
+ /// No copying.
+ WW8Export& operator=(const WW8Export&);
};
class WW8_WrPlcSubDoc // Doppel-Plc fuer Foot-/Endnotes und Postits
@@ -752,8 +1124,8 @@ protected:
WW8_WrPlcSubDoc();
virtual ~WW8_WrPlcSubDoc();
- bool WriteGenericTxt(SwWW8Writer& rWrt, BYTE nTTyp, WW8_CP& rCount);
- void WriteGenericPlc( SwWW8Writer& rWrt, BYTE nTTyp, WW8_FC& rTxtStt,
+ bool WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp, WW8_CP& rCount );
+ void WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp, WW8_FC& rTxtStt,
sal_Int32& rTxtCnt, WW8_FC& rRefStt, sal_Int32& rRefCnt ) const;
virtual const SvULongs* GetShapeIdArr() const;
@@ -771,8 +1143,8 @@ private:
public:
WW8_WrPlcFtnEdn( BYTE nTTyp ) : nTyp( nTTyp ) {}
- bool WriteTxt(SwWW8Writer& rWrt);
- void WritePlc( SwWW8Writer& rWrt ) const;
+ bool WriteTxt( WW8Export& rWrt );
+ void WritePlc( WW8Export& rWrt ) const;
void Append( WW8_CP nCp, const SwFmtFtn& rFtn );
};
@@ -787,8 +1159,8 @@ public:
WW8_WrPlcPostIt() {}
void Append( WW8_CP nCp, const SwPostItField& rPostIt );
- bool WriteTxt(SwWW8Writer& rWrt);
- void WritePlc( SwWW8Writer& rWrt ) const;
+ bool WriteTxt( WW8Export& rWrt );
+ void WritePlc( WW8Export& rWrt ) const;
};
class WW8_WrPlcTxtBoxes : public WW8_WrPlcSubDoc // Doppel-Plc fuer Textboxen
@@ -804,8 +1176,8 @@ private:
public:
WW8_WrPlcTxtBoxes( BYTE nTTyp ) : nTyp( nTTyp ) {}
- bool WriteTxt(SwWW8Writer& rWrt);
- void WritePlc( SwWW8Writer& rWrt ) const;
+ bool WriteTxt( WW8Export& rWrt );
+ void WritePlc( WW8Export& rWrt ) const;
void Append( const SdrObject& rObj, UINT32 nShapeId );
USHORT Count() const { return aCntnt.Count(); }
USHORT GetPos( const VoidPtr& p ) const { return aCntnt.GetPos( p ); }
@@ -817,7 +1189,7 @@ SV_DECL_PTRARR( WW8_WrFkpPtrs, WW8_FkpPtr, 4, 4 )
class WW8_WrPlcPn // Plc fuer Page Numbers
{
private:
- SwWW8Writer& rWrt;
+ WW8Export& rWrt;
WW8_WrFkpPtrs aFkps; // PTRARR
USHORT nFkpStartPage;
ePLCFT ePlc;
@@ -828,7 +1200,7 @@ private:
WW8_WrPlcPn(const WW8_WrPlcPn&);
WW8_WrPlcPn& operator=(const WW8_WrPlcPn&);
public:
- WW8_WrPlcPn( SwWW8Writer& rWrt, ePLCFT ePl, WW8_FC nStartFc );
+ WW8_WrPlcPn( WW8Export& rWrt, ePLCFT ePl, WW8_FC nStartFc );
~WW8_WrPlcPn();
void AppendFkpEntry(WW8_FC nEndFc,short nVarLen = 0,const BYTE* pSprms = 0);
void WriteFkps();
@@ -873,7 +1245,7 @@ public:
WW8_WrPlcFld( USHORT nStructSz, BYTE nTTyp )
: WW8_WrPlc1( nStructSz ), nTxtTyp( nTTyp ), nResults(0)
{}
- bool Write( SwWW8Writer& rWrt );
+ bool Write( WW8Export& rWrt );
void ResultAdded() { ++nResults; }
USHORT ResultCount() const { return nResults; }
};
@@ -887,7 +1259,7 @@ private:
public:
WW8_WrMagicTable() : WW8_WrPlc1( 4 ) {Append(0,0);}
void Append( WW8_CP nCp, ULONG nData );
- bool Write(SwWW8Writer& rWrt);
+ bool Write( WW8Export& rWrt );
};
class GraphicDetails
@@ -916,7 +1288,9 @@ public:
class SwWW8WrGrf
{
private:
- SwWW8Writer& rWrt; // SwWW8Writer fuer Zugriff auf die Vars
+ /// for access to the variables
+ WW8Export& rWrt;
+
std::vector<GraphicDetails> maDetails;
typedef std::vector<GraphicDetails>::iterator myiter;
USHORT mnIdx; // Index in File-Positionen
@@ -932,102 +1306,76 @@ private:
SwWW8WrGrf(const SwWW8WrGrf&);
SwWW8WrGrf& operator=(const SwWW8WrGrf&);
public:
- SwWW8WrGrf(SwWW8Writer& rW) : rWrt(rW), mnIdx(0) {}
+ SwWW8WrGrf( WW8Export& rW ) : rWrt( rW ), mnIdx( 0 ) {}
void Insert(const sw::Frame &rFly);
void Write();
ULONG GetFPos()
{ return (mnIdx < maDetails.size()) ? maDetails[mnIdx++].mnPos : 0; }
};
-// The class WW8_AttrIter is a helper class to build the Fkp.chpx. This
-// class may be overloaded for output the SwTxtAttrs and the
-// EditEngineTxtAttrs.
-class WW8_AttrIter
+/** The class MSWordAttrIter is a helper class to build the Fkp.chpx.
+ This class may be overloaded for output the SwTxtAttrs and the
+ EditEngineTxtAttrs.
+*/
+class MSWordAttrIter
{
private:
- WW8_AttrIter* pOld;
+ MSWordAttrIter* pOld;
//No copying
- WW8_AttrIter(const WW8_AttrIter&);
- WW8_AttrIter& operator=(const WW8_AttrIter&);
+ MSWordAttrIter(const MSWordAttrIter&);
+ MSWordAttrIter& operator=(const MSWordAttrIter&);
protected:
- SwWW8Writer& rWrt;
+ MSWordExportBase& m_rExport;
public:
- WW8_AttrIter( SwWW8Writer& rWrt );
- virtual ~WW8_AttrIter();
+ MSWordAttrIter( MSWordExportBase& rExport );
+ virtual ~MSWordAttrIter();
virtual const SfxPoolItem* HasTextItem( USHORT nWhich ) const = 0;
virtual const SfxPoolItem& GetItem( USHORT nWhich ) const = 0;
- void StartURL(const String &rUrl, const String &rTarget);
- void EndURL();
};
-class WW8WrtStyle
+/// Class to collect and output the styles table.
+class MSWordStyles
{
- SwWW8Writer& rWrt;
+ MSWordExportBase& m_rExport;
SwFmt** pFmtA;
- USHORT nPOPosStdLen1, nPOPosStdLen2;
USHORT nUsedSlots;
- void BuildStyleTab();
- void BuildUpx(const SwFmt* pFmt, bool bPap, USHORT nPos,
- bool bInsDefCharSiz);
- USHORT Build_GetWWSlot( const SwFmt& rFmt );
- USHORT GetWWId( const SwFmt& rFmt ) const;
- void Set1StyleDefaults(const SwFmt& rFmt, bool bPap);
- void Out1Style( SwFmt* pFmt, USHORT nPos );
+ /// Create the style table, called from the constructor.
+ void BuildStylesTable();
- void WriteStyle( SvStream& rStrm );
- void SkipOdd();
- void BuildStd(const String& rName, bool bPapFmt, short nWwBase,
- short nWwNext, USHORT nWwId);
- //No copying
- WW8WrtStyle(const WW8WrtStyle&);
- WW8WrtStyle& operator=(const WW8WrtStyle&);
-public:
- WW8WrtStyle( SwWW8Writer& rWr );
- ~WW8WrtStyle();
+ /// Get slot number during building the style table.
+ USHORT BuildGetSlot( const SwFmt& rFmt );
- void OutStyleTab();
- USHORT Sty_GetWWSlot( const SwFmt& rFmt ) const;
- SwFmt* GetSwFmt(){return (*pFmtA);}
-};
+ /// Return information about one style.
+ void GetStyleData( SwFmt* pFmt, bool& bFmtColl, USHORT& nBase, USHORT& nNext );
-class WW8SaveData
-{
-private:
- //No copying
- WW8SaveData(const WW8SaveData&);
- WW8SaveData& operator=(const WW8SaveData &);
-public:
- SwWW8Writer& rWrt;
- Point* pOldFlyOffset;
- RndStdIds eOldAnchorType;
- WW8Bytes* pOOld;
- SwPaM* pOldPam, *pOldEnd;
- const sw::Frame* pOldFlyFmt;
- const SwPageDesc* pOldPageDesc;
+ /// Outputs attributes of one style.
+ void WriteProperties( const SwFmt* pFmt, bool bPap, USHORT nPos, bool bInsDefCharSiz );
- BYTE bOldWriteAll : 1;
- BYTE bOldOutTable : 1;
- BYTE bOldIsInTable: 1;
- BYTE bOldFlyFrmAttrs : 1;
- BYTE bOldStartTOX : 1;
- BYTE bOldInWriteTOX : 1;
- // bOutPageDesc muss nicht gesichert werden, da es nur nicht waehrend der
- // Ausgabe von Spezial-Texten veraendert wird.
+ USHORT GetWWId( const SwFmt& rFmt ) const;
- WW8SaveData( SwWW8Writer&, ULONG nStt, ULONG nEnd );
- ~WW8SaveData();
-};
+ void SetStyleDefaults( const SwFmt& rFmt, bool bPap );
+
+ /// Outputs one style - called (in a loop) from OutputStylesTable().
+ void OutputStyle( SwFmt* pFmt, USHORT nPos );
+
+ // No copying
+ MSWordStyles( const MSWordStyles& );
+ MSWordStyles& operator=( const MSWordStyles& );
-// einige halb-interne Funktions-Deklarationen fuer die Node-Tabelle
+public:
+ MSWordStyles( MSWordExportBase& rExport );
+ ~MSWordStyles();
+
+ /// Output the styles table.
+ void OutputStylesTable();
-Writer& OutWW8_SwGrfNode( Writer& rWrt, SwCntntNode& rNode );
-Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode );
-Writer& OutWW8_SwSectionNode(Writer& rWrt, SwSectionNode& rSectionNode );
+ /// Get id of the style (rFmt).
+ USHORT GetSlot( const SwFmt& rFmt ) const;
-Writer& OutWW8_SwFmtHoriOrient( Writer& rWrt, const SfxPoolItem& rHt );
-Writer& OutWW8_SwFmtVertOrient( Writer& rWrt, const SfxPoolItem& rHt );
+ SwFmt* GetSwFmt() { return (*pFmtA); }
+};
sal_Int16 GetWordFirstLineOffset(const SwNumFmt &rFmt);
//A bit of a bag on the side for now
@@ -1044,12 +1392,20 @@ public:
WW8SHDLong() : m_cvFore(0), m_cvBack(0), m_ipat(0) {}
virtual ~WW8SHDLong() {}
- void Write(SwWW8Writer & rWriter);
+ void Write(WW8Export & rExport);
void setCvFore(sal_uInt32 cvFore) { m_cvFore = cvFore; }
void setCvBack(sal_uInt32 cvBack) { m_cvBack = cvBack; }
void setIPat(sal_uInt16 ipat) { m_ipat = ipat; }
};
+/// For the output of sections.
+struct WW8_PdAttrDesc
+{
+ BYTE* pData;
+ USHORT nLen;
+ WW8_FC nSepxFcPos;
+};
+
#endif // _WRTWW8_HXX
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index ba6c8a44a260..aaafe0ee49fc 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -42,13 +42,8 @@
#include <svtools/embedhlp.hxx>
-#ifndef _VIRDEV_HXX //autogen
#include <vcl/virdev.hxx>
-#endif
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
-
#include <hintids.hxx>
#include <svx/boxitem.hxx>
@@ -70,6 +65,8 @@
#include <fmtfsize.hxx>
#include <fmtornt.hxx>
+#include <writerfilter/doctok/sprmids.hxx>
+
#include <doc.hxx>
#include "writerhelper.hxx"
#include "writerwordglue.hxx"
@@ -98,20 +95,20 @@ using namespace nsFieldFlags;
// in der Graf-Klasse der GrfNode-Ptr gemerkt ( fuers spaetere Ausgeben der
// Grafiken und Patchen der PicLocFc-Attribute )
-Writer& OutWW8_SwGrfNode( Writer& rWrt, SwCntntNode& /*rNode*/ )
+void WW8Export::OutputGrfNode( const SwGrfNode& /*rNode*/ )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- ASSERT(rWW8Wrt.mpParentFrame, "frame not set!");
- if (rWW8Wrt.mpParentFrame)
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "WW8Export::OutputGrfNode( const SwGrfNode& )\n" );
+#endif
+ ASSERT( mpParentFrame, "frame not set!" );
+ if ( mpParentFrame )
{
- rWW8Wrt.OutGrf(*rWW8Wrt.mpParentFrame);
- rWW8Wrt.pFib->fHasPic = 1;
+ OutGrf( *mpParentFrame );
+ pFib->fHasPic = 1;
}
-
- return rWrt;
}
-bool SwWW8Writer::TestOleNeedsGraphic(const SwAttrSet& rSet,
+bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet,
SvStorageRef xOleStg, SvStorageRef xObjStg, String &rStorageName,
SwOLENode *pOLENd)
{
@@ -220,9 +217,11 @@ bool SwWW8Writer::TestOleNeedsGraphic(const SwAttrSet& rSet,
#endif
}
-Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode )
+void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "WW8Export::OutputOLENode( const SwOLENode& rOLENode )\n" );
+#endif
BYTE *pSpecOLE;
BYTE *pDataAdr;
short nSize;
@@ -237,7 +236,7 @@ Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode )
118, 1 // sprmCFObj
};
- if( rWW8Wrt.bWrtWW8 )
+ if ( bWrtWW8 )
{
pSpecOLE = aSpecOLE_WW8;
nSize = sizeof( aSpecOLE_WW8 );
@@ -248,15 +247,14 @@ Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode )
nSize = sizeof( aSpecOLE_WW6 );
}
pDataAdr = pSpecOLE + 2; //WW6 sprm is 1 but has 1 byte len as well.
- SwOLENode *pOLENd = rNode.GetOLENode();
- SvStorageRef xObjStg = rWW8Wrt.GetStorage().OpenSotStorage(
+ SvStorageRef xObjStg = GetWriter().GetStorage().OpenSotStorage(
CREATE_CONST_ASC(SL::aObjectPool), STREAM_READWRITE |
STREAM_SHARE_DENYALL );
if( xObjStg.Is() )
{
- uno::Reference < embed::XEmbeddedObject > xObj(pOLENd->GetOLEObj().GetOleRef());
+ uno::Reference < embed::XEmbeddedObject > xObj(const_cast<SwOLENode&>(rOLENode).GetOLEObj().GetOleRef());
if( xObj.is() )
{
embed::XEmbeddedObject *pObj = xObj.get();
@@ -265,7 +263,7 @@ Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode )
WW8OleMap *pMap = new WW8OleMap(nPictureId);
bool bDuplicate = false;
- WW8OleMaps &rOleMap = rWW8Wrt.GetOLEMap();
+ WW8OleMaps &rOleMap = GetOLEMap();
USHORT nPos;
if ( rOleMap.Seek_Entry(pMap, &nPos) )
{
@@ -287,9 +285,9 @@ Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode )
*/
if (!bDuplicate)
{
- sal_Int64 nAspect = pOLENd->GetAspect();
+ sal_Int64 nAspect = rOLENode.GetAspect();
svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
- rWW8Wrt.GetOLEExp().ExportOLEObject( aObjRef, *xOleStg );
+ GetOLEExp().ExportOLEObject( aObjRef, *xOleStg );
if ( nAspect == embed::Aspects::MSOLE_ICON )
{
::rtl::OUString aObjInfo( RTL_CONSTASCII_USTRINGPARAM( "\3ObjInfo" ) );
@@ -312,10 +310,10 @@ Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode )
sServer += xOleStg->GetUserName();
sServer += ' ';
- rWW8Wrt.OutField(0, ww::eEMBED, sServer, WRITEFIELD_START |
+ OutputField(0, ww::eEMBED, sServer, WRITEFIELD_START |
WRITEFIELD_CMD_START | WRITEFIELD_CMD_END);
- rWW8Wrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(),
+ pChpPlc->AppendFkpEntry( Strm().Tell(),
nSize, pSpecOLE );
bool bEndCR = true;
@@ -330,22 +328,22 @@ Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode )
*/
bool bGraphicNeeded = false;
- if (rWW8Wrt.mpParentFrame)
+ if (mpParentFrame)
{
bGraphicNeeded = true;
- if (rWW8Wrt.mpParentFrame->IsInline())
+ if (mpParentFrame->IsInline())
{
const SwAttrSet& rSet =
- rWW8Wrt.mpParentFrame->GetFrmFmt().GetAttrSet();
+ mpParentFrame->GetFrmFmt().GetAttrSet();
bEndCR = false;
- bGraphicNeeded = rWW8Wrt.TestOleNeedsGraphic(rSet,
- xOleStg, xObjStg, sStorageName, pOLENd);
+ bGraphicNeeded = TestOleNeedsGraphic(rSet,
+ xOleStg, xObjStg, sStorageName, const_cast<SwOLENode*>(&rOLENode));
}
}
if (!bGraphicNeeded)
- rWW8Wrt.WriteChar(0x1);
+ WriteChar(0x1);
else
{
/*
@@ -355,26 +353,25 @@ Writer& OutWW8_SwOleNode( Writer& rWrt, SwCntntNode& rNode )
has no place to find the dimensions of the ole
object, and will not be able to draw it
*/
- rWW8Wrt.OutGrf(*rWW8Wrt.mpParentFrame);
+ OutGrf(*mpParentFrame);
}
- rWW8Wrt.OutField(0, ww::eEMBED, aEmptyStr,
+ OutputField(0, ww::eEMBED, aEmptyStr,
WRITEFIELD_END | WRITEFIELD_CLOSE);
if (bEndCR) //No newline in inline case
- rWW8Wrt.WriteCR();
+ WriteCR();
}
}
}
- return rWrt;
}
-void SwWW8Writer::OutGrf(const sw::Frame &rFrame)
+void WW8Export::OutGrf(const sw::Frame &rFrame)
{
// GrfNode fuer spaeteres rausschreiben der Grafik merken
pGrf->Insert(rFrame);
- pChpPlc->AppendFkpEntry( pStrm->Tell(), pO->Count(), pO->GetData() );
+ pChpPlc->AppendFkpEntry( Strm().Tell(), pO->Count(), pO->GetData() );
pO->Remove( 0, pO->Count() ); // leeren
// --> OD 2007-06-06 #i29408#
@@ -395,7 +392,7 @@ void SwWW8Writer::OutGrf(const sw::Frame &rFrame)
}
sStr.APPEND_CONST_ASC("\" \\d");
- OutField( 0, ww::eINCLUDEPICTURE, sStr,
+ OutputField( 0, ww::eINCLUDEPICTURE, sStr,
WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END );
}
// <--
@@ -431,7 +428,7 @@ void SwWW8Writer::OutGrf(const sw::Frame &rFrame)
nHeight-=nFontHeight/20;
if (bWrtWW8)
- Set_UInt16( pArr, 0x4845 );
+ Set_UInt16( pArr, NS_sprm::LN_CHpsPos );
else
Set_UInt8( pArr, 101 );
Set_UInt16( pArr, -((INT16)nHeight));
@@ -448,7 +445,7 @@ void SwWW8Writer::OutGrf(const sw::Frame &rFrame)
// sprmCPicLocation
if( bWrtWW8 )
- Set_UInt16( pArr, 0x6a03 );
+ Set_UInt16( pArr, NS_sprm::LN_CPicLocation );
else
{
Set_UInt8( pArr, 68 );
@@ -461,7 +458,7 @@ void SwWW8Writer::OutGrf(const sw::Frame &rFrame)
static BYTE nAttrMagicIdx = 0;
--pArr;
Set_UInt8( pArr, nAttrMagicIdx++ );
- pChpPlc->AppendFkpEntry( pStrm->Tell(), static_cast< short >(pArr - aArr), aArr );
+ pChpPlc->AppendFkpEntry( Strm().Tell(), static_cast< short >(pArr - aArr), aArr );
// --> OD 2007-04-23 #i75464#
// Check, if graphic isn't exported as-character anchored.
@@ -479,17 +476,17 @@ void SwWW8Writer::OutGrf(const sw::Frame &rFrame)
bool bOldGrf = bOutGrf;
bOutGrf = true;
- Out_SwFmt(rFrame.GetFrmFmt(), false, false, true); // Fly-Attrs
+ OutputFormat( rFrame.GetFrmFmt(), false, false, true ); // Fly-Attrs
bOutGrf = bOldGrf;
- pPapPlc->AppendFkpEntry( pStrm->Tell(), pO->Count(), pO->GetData() );
+ pPapPlc->AppendFkpEntry( Strm().Tell(), pO->Count(), pO->GetData() );
pO->Remove( 0, pO->Count() ); // leeren
}
// --> OD 2007-06-06 #i29408#
// linked, as-character anchored graphics have to be exported as fields.
else if ( pGrfNd && pGrfNd->IsLinkedFile() )
{
- OutField( 0, ww::eINCLUDEPICTURE, String(), WRITEFIELD_CLOSE );
+ OutputField( 0, ww::eINCLUDEPICTURE, String(), WRITEFIELD_CLOSE );
}
// <--
}
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index d0e09c58a759..45416d4dbc4d 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -33,23 +33,19 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
/*
- * Dieses File enthaelt alle Ausgabe-Funktionen des WW8-Writers;
- * fuer alle Nodes, Attribute, Formate und Chars.
+ * This file contains methods for the WW8 output
+ * (nodes, attributes, formats und chars).
*/
-
#include <hintids.hxx>
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
#include <vcl/salbtype.hxx>
#include <svtools/zformat.hxx>
#include <svtools/itemiter.hxx>
+#include <svtools/whiter.hxx>
#include <svx/fontitem.hxx>
-#ifndef _SVX_TSTPITEM_HXX //autogen
#include <svx/tstpitem.hxx>
-#endif
#include <svx/adjitem.hxx>
#include <svx/spltitem.hxx>
#include <svx/widwitem.hxx>
@@ -104,15 +100,15 @@
#include <txtfld.hxx>
#include <txtftn.hxx>
#include <poolfmt.hxx>
-#include <doc.hxx> // Doc fuer Fussnoten
+#include <doc.hxx> // Doc for footnotes
#include <pam.hxx>
#include <paratr.hxx>
-#include <fldbas.hxx> // fuer SwField ...
-#include <docufld.hxx> // fuer SwField ...
+#include <fldbas.hxx> // for SwField
+#include <docufld.hxx> // for SwField
#include <expfld.hxx>
-#include <pagedesc.hxx> // fuer SwPageDesc...
-#include <flddat.hxx> // fuer Datum-Felder
-#include <ndtxt.hxx> // fuer Numrules
+#include <pagedesc.hxx> // for SwPageDesc
+#include <flddat.hxx> // for Date fields
+#include <ndtxt.hxx> // for Numrules
#include <fmthbsh.hxx>
#include <swrect.hxx>
#include <reffld.hxx>
@@ -124,15 +120,15 @@
#include <tox.hxx>
#include <fmtftntx.hxx>
#include <breakit.hxx>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
#include <unotools/localedatawrapper.hxx>
#include <tgrditem.hxx>
#include <flddropdown.hxx>
#include <chpfld.hxx>
#include <fmthdft.hxx>
+#include <writerfilter/doctok/sprmids.hxx>
+
#if OSL_DEBUG_LEVEL > 1
# include <fmtcntnt.hxx>
#endif
@@ -140,6 +136,7 @@
#include "writerwordglue.hxx"
#include "wrtww8.hxx"
#include "ww8par.hxx"
+#include "ww8attributeoutput.hxx"
#include "fields.hxx"
#include <vcl/outdev.hxx>
#include <i18npool/mslangid.hxx>
@@ -148,7 +145,6 @@ using namespace ::com::sun::star;
using namespace nsFieldFlags;
using namespace nsSwDocInfoSubType;
-
/*
* um nicht immer wieder nach einem Update festzustellen, das irgendwelche
* Hint-Ids dazugekommen sind, wird hier definiert, die Groesse der Tabelle
@@ -175,30 +171,17 @@ using namespace nsSwDocInfoSubType;
using namespace sw::util;
using namespace sw::types;
-//------------------------------------------------------------
-// Forward-Declarationen
-//------------------------------------------------------------
-static Writer& OutWW8_SwFmtBreak( Writer& rWrt, const SfxPoolItem& rHt );
-static Writer& OutWW8_SwNumRuleItem( Writer& rWrt, const SfxPoolItem& rHt );
-/*
-Sadly word does not have two different sizes for asian font size and western
-font size, it has two different fonts, but not sizes, so we have to use our
-guess as to the script used and disable the export of one type. The same
-occurs for font weight and posture (bold and italic)
-
-In addition WW7- has only one character language identifier while WW8+ has two
-*/
-bool SwWW8Writer::CollapseScriptsforWordOk(USHORT nScript, USHORT nWhich)
+bool WW8Export::CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich )
{
bool bRet = true;
- if (nScript == i18n::ScriptType::ASIAN)
+ if ( nScript == i18n::ScriptType::ASIAN )
{
//for asian in ww8, there is only one fontsize
//and one fontstyle (posture/weight) for ww6
//there is the additional problem that there
//is only one font setting for all three scripts
- switch (nWhich)
+ switch ( nWhich )
{
case RES_CHRATR_FONTSIZE:
case RES_CHRATR_POSTURE:
@@ -217,14 +200,14 @@ bool SwWW8Writer::CollapseScriptsforWordOk(USHORT nScript, USHORT nWhich)
break;
}
}
- else if (nScript == i18n::ScriptType::COMPLEX)
+ else if ( nScript == i18n::ScriptType::COMPLEX )
{
//Complex is ok in ww8, but for ww6 there is only
//one font, one fontsize, one fontsize (weight/posture)
//and only one language
- if (bWrtWW8 == 0)
+ if ( bWrtWW8 == 0 )
{
- switch (nWhich)
+ switch ( nWhich )
{
case RES_CHRATR_CJK_FONT:
case RES_CHRATR_CJK_FONTSIZE:
@@ -249,7 +232,7 @@ bool SwWW8Writer::CollapseScriptsforWordOk(USHORT nScript, USHORT nWhich)
//and one fontstyle (posture/weight) for ww6
//there is the additional problem that there
//is only one font setting for all three scripts
- switch (nWhich)
+ switch ( nWhich )
{
case RES_CHRATR_CJK_FONTSIZE:
case RES_CHRATR_CJK_POSTURE:
@@ -262,7 +245,7 @@ bool SwWW8Writer::CollapseScriptsforWordOk(USHORT nScript, USHORT nWhich)
case RES_CHRATR_CTL_LANGUAGE:
case RES_CHRATR_CTL_POSTURE:
case RES_CHRATR_CTL_WEIGHT:
- if (bWrtWW8 == 0)
+ if ( bWrtWW8 == 0 )
bRet = false;
default:
break;
@@ -275,19 +258,16 @@ bool SwWW8Writer::CollapseScriptsforWordOk(USHORT nScript, USHORT nWhich)
// Hilfsroutinen fuer Styles
//------------------------------------------------------------
-void SwWW8Writer::ExportPoolItemsToCHP(sw::PoolItems &rItems, USHORT nScript)
+void MSWordExportBase::ExportPoolItemsToCHP( sw::PoolItems &rItems, USHORT nScript )
{
sw::cPoolItemIter aEnd = rItems.end();
- for (sw::cPoolItemIter aI = rItems.begin(); aI != aEnd; ++aI)
+ for ( sw::cPoolItemIter aI = rItems.begin(); aI != aEnd; ++aI )
{
const SfxPoolItem *pItem = aI->second;
USHORT nWhich = pItem->Which();
- if (FnAttrOut pOut = aWW8AttrFnTab[nWhich - RES_CHRATR_BEGIN])
+ if ( ( isCHRATR( nWhich ) || isTXTATR( nWhich ) ) && CollapseScriptsforWordOk( nScript, nWhich ) )
{
- if (nWhich < RES_CHRATR_BEGIN || nWhich >= RES_TXTATR_END)
- continue;
- if (SwWW8Writer::CollapseScriptsforWordOk(nScript, nWhich))
- (*pOut)(*this, *pItem);
+ AttrOutput().OutputItem( *pItem );
}
}
}
@@ -297,71 +277,62 @@ void SwWW8Writer::ExportPoolItemsToCHP(sw::PoolItems &rItems, USHORT nScript)
* - gebe die Attribute aus; ohne Parents!
*/
-void SwWW8Writer::Out_SfxItemSet(const SfxItemSet& rSet, bool bPapFmt,
- bool bChpFmt, USHORT nScript)
+void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript )
{
- if (rSet.Count())
+ if ( rSet.Count() )
{
const SfxPoolItem* pItem;
- FnAttrOut pOut;
-
pISet = &rSet; // fuer Doppel-Attribute
- //If frame dir is set, but not adjust, then force adjust as well
- if (bPapFmt && SFX_ITEM_SET == rSet.GetItemState(RES_FRAMEDIR, false))
+ // If frame dir is set, but not adjust, then force adjust as well
+ if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, false ) )
{
- //No explicit adjust set ?
- if (SFX_ITEM_SET != rSet.GetItemState(RES_PARATR_ADJUST, false))
+ // No explicit adjust set ?
+ if ( SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_ADJUST, false ) )
{
- if (0 != (pItem = rSet.GetItem(RES_PARATR_ADJUST)))
+ if ( 0 != ( pItem = rSet.GetItem( RES_PARATR_ADJUST ) ) )
{
// then set the adjust used by the parent format
- pOut = aWW8AttrFnTab[ static_cast< USHORT >(RES_PARATR_ADJUST) - RES_CHRATR_BEGIN];
- (*pOut)( *this, *pItem );
+ AttrOutput().OutputItem( *pItem );
}
}
}
- if (bPapFmt && SFX_ITEM_SET == rSet.GetItemState(RES_PARATR_NUMRULE,
- false, &pItem))
+ if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pItem ) )
{
- pOut = aWW8AttrFnTab[ static_cast< USHORT >(RES_PARATR_NUMRULE) - RES_CHRATR_BEGIN ];
- (*pOut)( *this, *pItem );
+ AttrOutput().OutputItem( *pItem );
+
// switch off the numerbering?
- if( !((SwNumRuleItem*)pItem)->GetValue().Len() && SFX_ITEM_SET
- != rSet.GetItemState( RES_LR_SPACE, false) && SFX_ITEM_SET
- == rSet.GetItemState( RES_LR_SPACE, true, &pItem ) )
+ if ( !( (SwNumRuleItem*)pItem )->GetValue().Len() &&
+ SFX_ITEM_SET != rSet.GetItemState( RES_LR_SPACE, false) &&
+ SFX_ITEM_SET == rSet.GetItemState( RES_LR_SPACE, true, &pItem ) )
{
// the set the LR-Space of the parentformat!
- pOut = aWW8AttrFnTab[ static_cast< USHORT >(RES_LR_SPACE) - RES_CHRATR_BEGIN ];
- (*pOut)( *this, *pItem );
+ AttrOutput().OutputItem( *pItem );
}
}
sw::PoolItems aItems;
- GetPoolItems(rSet, aItems);
- if (bChpFmt)
+ GetPoolItems( rSet, aItems );
+ if ( bChpFmt )
ExportPoolItemsToCHP(aItems, nScript);
- sw::cPoolItemIter aEnd = aItems.end();
- for (sw::cPoolItemIter aI = aItems.begin(); aI != aEnd; ++aI)
+ if ( bPapFmt )
{
- pItem = aI->second;
- USHORT nWhich = pItem->Which();
- pOut = aWW8AttrFnTab[nWhich - RES_CHRATR_BEGIN];
- if( 0 != pOut && (!bPapFmt || RES_PARATR_NUMRULE != nWhich ))
+ sw::cPoolItemIter aEnd = aItems.end();
+ for ( sw::cPoolItemIter aI = aItems.begin(); aI != aEnd; ++aI )
{
- bool bPap = nWhich >= RES_PARATR_BEGIN
- && nWhich < RES_FRMATR_END;
- if (bPapFmt && bPap)
- (*pOut)(*this, *pItem);
+ pItem = aI->second;
+ USHORT nWhich = pItem->Which();
+ if ( nWhich >= RES_PARATR_BEGIN && nWhich < RES_FRMATR_END && nWhich != RES_PARATR_NUMRULE)
+ AttrOutput().OutputItem( *pItem );
}
}
pISet = 0; // fuer Doppel-Attribute
}
}
-void SwWW8Writer::GatherChapterFields()
+void MSWordExportBase::GatherChapterFields()
{
//If the header/footer contains a chapter field
SwClientIter aIter(*pDoc->GetSysFldType(RES_CHAPTERFLD));
@@ -378,20 +349,20 @@ void SwWW8Writer::GatherChapterFields()
}
}
-bool SwWW8Writer::CntntContainsChapterField(const SwFmtCntnt &rCntnt) const
+bool MSWordExportBase::CntntContainsChapterField(const SwFmtCntnt &rCntnt) const
{
bool bRet = false;
- if (const SwNodeIndex* pSttIdx = rCntnt.GetCntntIdx())
+ if ( const SwNodeIndex* pSttIdx = rCntnt.GetCntntIdx() )
{
- SwNodeIndex aIdx(*pSttIdx, 1);
- SwNodeIndex aEnd(*pSttIdx->GetNode().EndOfSectionNode());
+ SwNodeIndex aIdx( *pSttIdx, 1 );
+ SwNodeIndex aEnd( *pSttIdx->GetNode().EndOfSectionNode() );
ULONG nStart = aIdx.GetIndex();
ULONG nEnd = aEnd.GetIndex();
//If the header/footer contains a chapter field
mycCFIter aIEnd = maChapterFieldLocs.end();
- for (mycCFIter aI = maChapterFieldLocs.begin(); aI != aIEnd; ++aI)
+ for ( mycCFIter aI = maChapterFieldLocs.begin(); aI != aIEnd; ++aI )
{
- if ((nStart <= *aI) && (*aI <= nEnd))
+ if ( ( nStart <= *aI ) && ( *aI <= nEnd ) )
{
bRet = true;
break;
@@ -401,22 +372,25 @@ bool SwWW8Writer::CntntContainsChapterField(const SwFmtCntnt &rCntnt) const
return bRet;
}
-bool SwWW8Writer::FmtHdFtContainsChapterField(const SwFrmFmt &rFmt) const
+bool MSWordExportBase::FmtHdFtContainsChapterField(const SwFrmFmt &rFmt) const
{
- if (maChapterFieldLocs.empty())
+ if ( maChapterFieldLocs.empty() )
return false;
- bool bRet = false;
const SwFrmFmt *pFmt = 0;
- if (0 != (pFmt = rFmt.GetHeader().GetHeaderFmt()))
- bRet = CntntContainsChapterField(pFmt->GetCntnt());
- if (!bRet && 0 != (pFmt = rFmt.GetFooter().GetFooterFmt()))
- bRet = CntntContainsChapterField(pFmt->GetCntnt());
- return bRet;
+ pFmt = rFmt.GetHeader().GetHeaderFmt();
+ if ( pFmt && CntntContainsChapterField( pFmt->GetCntnt() ) )
+ return true;
+
+ pFmt = rFmt.GetFooter().GetFooterFmt();
+ if ( pFmt && CntntContainsChapterField( pFmt->GetCntnt() ) )
+ return true;
+
+ return false;
}
-bool SwWW8Writer::SetAktPageDescFromNode(const SwNode &rNd)
+bool MSWordExportBase::SetAktPageDescFromNode(const SwNode &rNd)
{
bool bNewPageDesc = false;
const SwPageDesc* pCurrent = SwPageDesc::GetPageDescOfNode(rNd);
@@ -453,13 +427,9 @@ bool SwWW8Writer::SetAktPageDescFromNode(const SwNode &rNd)
// Es duerfen nur Funktionen gerufen werden, die nicht in den
// Ausgabebereich pO schreiben, da dieser nur einmal fuer CHP und PAP existiert
// und damit im falschen landen wuerden.
-void SwWW8Writer::Out_SfxBreakItems(const SfxItemSet *pSet, const SwNode& rNd)
+void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd )
{
- bool bAllowOutputPageDesc = false;
- if (!bStyDef && !bOutKF && !bInWriteEscher && !bOutPageDescs)
- bAllowOutputPageDesc = true;
-
- if (!bAllowOutputPageDesc)
+ if ( bStyDef || bOutKF || bInWriteEscher || bOutPageDescs )
return;
bBreakBefore = true;
@@ -474,17 +444,17 @@ void SwWW8Writer::Out_SfxBreakItems(const SfxItemSet *pSet, const SwNode& rNd)
//section.
bool bBreakSet = false;
- if (pSet && pSet->Count())
+ if ( pSet && pSet->Count() )
{
- if (SFX_ITEM_SET == pSet->GetItemState(RES_PAGEDESC, false, &pItem)
- && ((SwFmtPageDesc*)pItem)->GetRegisteredIn())
+ if ( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem )
+ && ( (SwFmtPageDesc*)pItem )->GetRegisteredIn() )
{
bBreakSet = true;
bNewPageDesc = true;
pPgDesc = (const SwFmtPageDesc*)pItem;
pAktPageDesc = pPgDesc->GetPageDesc();
}
- else if (SFX_ITEM_SET == pSet->GetItemState(RES_BREAK, false, &pItem))
+ else if ( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, false, &pItem ) )
{
// --> FME 2007-05-30 #146867# Word does not like hard break attributes in some table cells
bool bRemoveHardBreakInsideTable = false;
@@ -521,7 +491,7 @@ void SwWW8Writer::Out_SfxBreakItems(const SfxItemSet *pSet, const SwNode& rNd)
done when it happens when we get a new pagedesc because we
overflow from the first page style.
*/
- if (pAktPageDesc)
+ if ( pAktPageDesc )
{
// --> OD 2007-05-30 #i76301#
// assure that there is a page break before set at the node.
@@ -529,12 +499,12 @@ void SwWW8Writer::Out_SfxBreakItems(const SfxItemSet *pSet, const SwNode& rNd)
if ( pBreak &&
pBreak->GetBreak() == SVX_BREAK_PAGE_BEFORE )
{
- bNewPageDesc = SetAktPageDescFromNode(rNd);
+ bNewPageDesc = SetAktPageDescFromNode( rNd );
}
// <--
}
- if (!bNewPageDesc)
- OutWW8_SwFmtBreak( *this, *pItem );
+ if ( !bNewPageDesc )
+ AttrOutput().OutputItem( *pItem );
}
}
}
@@ -547,72 +517,41 @@ void SwWW8Writer::Out_SfxBreakItems(const SfxItemSet *pSet, const SwNode& rNd)
that moves onto a new page because of layout, but that would be insane.
*/
bool bHackInBreak = false;
- if (!bBreakSet)
+ if ( !bBreakSet )
{
- if (const SwCntntNode *pNd = rNd.GetCntntNode())
+ if ( const SwCntntNode *pNd = rNd.GetCntntNode() )
{
const SvxFmtBreakItem &rBreak =
- ItemGet<SvxFmtBreakItem>(*pNd, RES_BREAK);
- if (rBreak.GetBreak() == SVX_BREAK_PAGE_BEFORE)
+ ItemGet<SvxFmtBreakItem>( *pNd, RES_BREAK );
+ if ( rBreak.GetBreak() == SVX_BREAK_PAGE_BEFORE )
bHackInBreak = true;
else
{ // Even a pagedesc item is set, the break item can be set 'NONE',
// but a pagedesc item is an implicit page break before...
const SwFmtPageDesc &rPageDesc =
ItemGet<SwFmtPageDesc>( *pNd, RES_PAGEDESC );
- if( rPageDesc.GetRegisteredIn() )
+ if ( rPageDesc.GetRegisteredIn() )
bHackInBreak = true;
}
}
}
- if (bHackInBreak)
+ if ( bHackInBreak )
{
- ASSERT(pAktPageDesc, "should not be possible");
- if (pAktPageDesc)
- bNewPageDesc = SetAktPageDescFromNode(rNd);
+ ASSERT( pAktPageDesc, "should not be possible" );
+ if ( pAktPageDesc )
+ bNewPageDesc = SetAktPageDescFromNode( rNd );
}
- if (bNewPageDesc && pAktPageDesc)
+ if ( bNewPageDesc && pAktPageDesc )
{
- // --> OD 2007-05-29 #i76300#
- // code moved code to method <SwWW8Writer::PrepareNewPageDesc(..)>
-// // Die PageDescs werden beim Auftreten von PageDesc-Attributen nur in
-// // WW8Writer::pSepx mit der entsprechenden Position eingetragen. Das
-// // Aufbauen und die Ausgabe der am PageDesc haengenden Attribute und
-// // Kopf/Fusszeilen passiert nach dem Haupttext und seinen Attributen.
-
-// ULONG nFcPos = ReplaceCr(0x0c); // Page/Section-Break
-
-// const SwSectionFmt *pFmt = 0;
-// const SwSectionNode* pSect = rNd.FindSectionNode();
-// if (pSect && CONTENT_SECTION == pSect->GetSection().GetType())
-// pFmt = pSect->GetSection().GetFmt();
-
-// // tatsaechlich wird hier NOCH NICHTS ausgegeben, sondern
-// // nur die Merk-Arrays aCps, aSects entsprechend ergaenzt
-// if (nFcPos)
-// {
-// const SwFmtLineNumber *pNItem = 0;
-// if (pSet)
-// pNItem = &(ItemGet<SwFmtLineNumber>(*pSet,RES_LINENUMBER));
-// else if (const SwCntntNode *pNd = rNd.GetCntntNode())
-// pNItem = &(ItemGet<SwFmtLineNumber>(*pNd,RES_LINENUMBER));
-// ULONG nLnNm = pNItem ? pNItem->GetStartValue() : 0;
-
-// if (pPgDesc)
-// pSepx->AppendSep(Fc2Cp(nFcPos), *pPgDesc, rNd, pFmt, nLnNm);
-// else
-// pSepx->AppendSep(Fc2Cp(nFcPos), pAktPageDesc, rNd, pFmt, nLnNm);
-// }
PrepareNewPageDesc( pSet, rNd, pPgDesc, pAktPageDesc );
}
bBreakBefore = false;
}
// --> OD 2007-05-29 #i76300#
-bool SwWW8Writer::Out_FollowPageDesc( const SfxItemSet* pSet,
- const SwTxtNode* pNd )
+bool MSWordExportBase::OutputFollowPageDesc( const SfxItemSet* pSet, const SwTxtNode* pNd )
{
bool bRet = false;
@@ -627,8 +566,35 @@ bool SwWW8Writer::Out_FollowPageDesc( const SfxItemSet* pSet,
return bRet;
}
-// initial version by extracting corresponding code from method <SwWW8Writer::Out_SfxBreakItems(..)>
-void SwWW8Writer::PrepareNewPageDesc( const SfxItemSet*pSet,
+const SwSectionFmt* MSWordExportBase::GetSectionFormat( const SwNode& rNd ) const
+{
+ const SwSectionFmt* pFmt = NULL;
+ const SwSectionNode* pSect = rNd.FindSectionNode();
+ if ( pSect &&
+ CONTENT_SECTION == pSect->GetSection().GetType() )
+ {
+ pFmt = pSect->GetSection().GetFmt();
+ }
+
+ return pFmt;
+}
+
+ULONG MSWordExportBase::GetSectionLineNo( const SfxItemSet* pSet, const SwNode& rNd ) const
+{
+ const SwFmtLineNumber* pNItem = 0;
+ if ( pSet )
+ {
+ pNItem = &( ItemGet<SwFmtLineNumber>( *pSet, RES_LINENUMBER ) );
+ }
+ else if ( const SwCntntNode *pNd = rNd.GetCntntNode() )
+ {
+ pNItem = &( ItemGet<SwFmtLineNumber>( *pNd, RES_LINENUMBER ) );
+ }
+
+ return pNItem? pNItem->GetStartValue() : 0;
+}
+
+void WW8Export::PrepareNewPageDesc( const SfxItemSet*pSet,
const SwNode& rNd,
const SwFmtPageDesc* pNewPgDescFmt,
const SwPageDesc* pNewPgDesc )
@@ -638,63 +604,45 @@ void SwWW8Writer::PrepareNewPageDesc( const SfxItemSet*pSet,
// Aufbauen und die Ausgabe der am PageDesc haengenden Attribute und
// Kopf/Fusszeilen passiert nach dem Haupttext und seinen Attributen.
- ULONG nFcPos = ReplaceCr(0x0c); // Page/Section-Break
-
- const SwSectionFmt* pFmt = 0;
- const SwSectionNode* pSect = rNd.FindSectionNode();
- if ( pSect &&
- CONTENT_SECTION == pSect->GetSection().GetType() )
- {
- pFmt = pSect->GetSection().GetFmt();
- }
+ ULONG nFcPos = ReplaceCr( msword::PageBreak ); // Page/Section-Break
// tatsaechlich wird hier NOCH NICHTS ausgegeben, sondern
// nur die Merk-Arrays aCps, aSects entsprechend ergaenzt
- if ( nFcPos )
- {
- const SwFmtLineNumber* pNItem = 0;
- if ( pSet )
- {
- pNItem = &(ItemGet<SwFmtLineNumber>(*pSet,RES_LINENUMBER));
- }
- else if (const SwCntntNode *pNd = rNd.GetCntntNode())
- {
- pNItem = &(ItemGet<SwFmtLineNumber>(*pNd,RES_LINENUMBER));
- }
- const ULONG nLnNm = pNItem ? pNItem->GetStartValue() : 0;
+ if ( !nFcPos )
+ return;
- if ( pNewPgDescFmt )
- {
- pSepx->AppendSep(Fc2Cp(nFcPos), *pNewPgDescFmt, rNd, pFmt, nLnNm);
- }
- else if ( pNewPgDesc )
- {
- pSepx->AppendSep(Fc2Cp(nFcPos), pNewPgDesc, rNd, pFmt, nLnNm);
- }
- else
- {
- ASSERT( false, "<SwWW8Writer::PrepareNewPageDesc(..)> - misusage: neither page desc format nor page desc provided." );
- }
+ const SwSectionFmt* pFmt = GetSectionFormat( rNd );
+ const ULONG nLnNm = GetSectionLineNo( pSet, rNd );
+
+ ASSERT( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." );
+
+ if ( pNewPgDescFmt )
+ {
+ pSepx->AppendSep( Fc2Cp( nFcPos ), *pNewPgDescFmt, rNd, pFmt, nLnNm );
+ }
+ else if ( pNewPgDesc )
+ {
+ pSepx->AppendSep( Fc2Cp( nFcPos ), pNewPgDesc, rNd, pFmt, nLnNm );
}
}
-// <--
-
-void SwWW8Writer::CorrTabStopInSet(SfxItemSet& rSet, USHORT nAbsLeft)
+void MSWordExportBase::CorrectTabStopInSet( SfxItemSet& rSet, USHORT nAbsLeft )
{
const SvxTabStopItem *pItem =
- sw::util::HasItem<SvxTabStopItem>(rSet, RES_PARATR_TABSTOP);
+ sw::util::HasItem<SvxTabStopItem>( rSet, RES_PARATR_TABSTOP );
- if (pItem)
+ if ( pItem )
{
// dann muss das fuer die Ausgabe korrigiert werden
SvxTabStopItem aTStop(*pItem);
- for(USHORT nCnt = 0; nCnt < aTStop.Count(); ++nCnt)
+ for ( USHORT nCnt = 0; nCnt < aTStop.Count(); ++nCnt )
{
SvxTabStop& rTab = (SvxTabStop&)aTStop[ nCnt ];
- if( SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment() &&
+ if ( SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment() &&
rTab.GetTabPos() >= nAbsLeft )
+ {
rTab.GetTabPos() -= nAbsLeft;
+ }
else
{
aTStop.Remove( nCnt );
@@ -705,7 +653,7 @@ void SwWW8Writer::CorrTabStopInSet(SfxItemSet& rSet, USHORT nAbsLeft)
}
}
-BYTE SwWW8Writer::GetNumId( USHORT eNumType )
+BYTE WW8Export::GetNumId( USHORT eNumType )
{
BYTE nRet = 0;
switch( eNumType )
@@ -726,26 +674,25 @@ BYTE SwWW8Writer::GetNumId( USHORT eNumType )
return nRet;
}
-void SwWW8Writer::ExportOutlineNumbering(BYTE nLvl, const SwNumFmt &rNFmt,
- const SwFmt &rFmt)
+void WW8AttributeOutput::OutlineNumbering( BYTE nLvl, const SwNumFmt &rNFmt, const SwFmt &rFmt )
{
- if (nLvl >= WW8ListManager::nMaxLevel)
+ if ( nLvl >= WW8ListManager::nMaxLevel )
nLvl = WW8ListManager::nMaxLevel-1;
- if( bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
// write sprmPOutLvl sprmPIlvl and sprmPIlfo
- SwWW8Writer::InsUInt16( *pO, 0x2640 );
- pO->Insert( nLvl, pO->Count() );
- SwWW8Writer::InsUInt16( *pO, 0x260a );
- pO->Insert( nLvl, pO->Count() );
- SwWW8Writer::InsUInt16( *pO, 0x460b );
- SwWW8Writer::InsUInt16( *pO, 1 + GetId(
- *pDoc->GetOutlineNumRule() ) );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_POutLvl );
+ m_rWW8Export.pO->Insert( nLvl, m_rWW8Export.pO->Count() );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlvl );
+ m_rWW8Export.pO->Insert( nLvl, m_rWW8Export.pO->Count() );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlfo );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO,
+ 1 + m_rWW8Export.GetId( *m_rWW8Export.pDoc->GetOutlineNumRule() ) );
}
else
{
- Out_SwNumLvl( nLvl );
+ m_rWW8Export.Out_SwNumLvl( nLvl );
// --> OD 2008-06-03 #i86652#
// if (rNFmt.GetAbsLSpace())
if ( rNFmt.GetPositionAndSpaceMode() ==
@@ -753,22 +700,25 @@ void SwWW8Writer::ExportOutlineNumbering(BYTE nLvl, const SwNumFmt &rNFmt,
rNFmt.GetAbsLSpace() )
// <--
{
- SwNumFmt aNumFmt(rNFmt);
+ SwNumFmt aNumFmt( rNFmt );
const SvxLRSpaceItem& rLR =
- ItemGet<SvxLRSpaceItem>(rFmt, RES_LR_SPACE);
- aNumFmt.SetAbsLSpace(writer_cast<short>(
- aNumFmt.GetAbsLSpace() + rLR.GetLeft()));
- Out_NumRuleAnld( *pDoc->GetOutlineNumRule(),
- aNumFmt, nLvl );
+ ItemGet<SvxLRSpaceItem>( rFmt, RES_LR_SPACE );
+
+ aNumFmt.SetAbsLSpace( writer_cast<short>(
+ aNumFmt.GetAbsLSpace() + rLR.GetLeft() ) );
+ m_rWW8Export.Out_NumRuleAnld(
+ *m_rWW8Export.pDoc->GetOutlineNumRule(),
+ aNumFmt, nLvl );
}
else
- Out_NumRuleAnld( *pDoc->GetOutlineNumRule(),
- rNFmt, nLvl );
+ m_rWW8Export.Out_NumRuleAnld(
+ *m_rWW8Export.pDoc->GetOutlineNumRule(),
+ rNFmt, nLvl );
}
}
// --> OD 2007-06-04 #i77805#
-bool SwWW8Writer::DisallowInheritingOutlineNumbering(const SwFmt &rFmt)
+bool WW8Export::DisallowInheritingOutlineNumbering(const SwFmt &rFmt)
{
bool bRet( false );
@@ -780,16 +730,13 @@ bool SwWW8Writer::DisallowInheritingOutlineNumbering(const SwFmt &rFmt)
{
if (const SwFmt *pParent = rFmt.DerivedFrom())
{
- //BYTE nLvl = ((const SwTxtFmtColl*)pParent)->GetOutlineLevel(); //#outline level,removed by zhaojianwei
- //if (MAXLEVEL > nLvl)
- //{ //<-end, ->add by zhaojianwei
if (((const SwTxtFmtColl*)pParent)->IsAssignedToListLevelOfOutlineStyle())
- { //<-end,zhaojianwei
+ {
if (bWrtWW8)
{
- SwWW8Writer::InsUInt16(*pO, 0x2640);
+ SwWW8Writer::InsUInt16(*pO, NS_sprm::LN_POutLvl);
pO->Insert(BYTE(9), pO->Count());
- SwWW8Writer::InsUInt16(*pO, 0x460b);
+ SwWW8Writer::InsUInt16(*pO, NS_sprm::LN_PIlfo);
SwWW8Writer::InsUInt16(*pO, 0);
bRet = true;
@@ -803,8 +750,7 @@ bool SwWW8Writer::DisallowInheritingOutlineNumbering(const SwFmt &rFmt)
}
// <--
-void SwWW8Writer::Out_SwFmt(const SwFmt& rFmt, bool bPapFmt, bool bChpFmt,
- bool bFlyFmt)
+void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpFmt, bool bFlyFmt )
{
bool bCallOutSet = true;
const SwModify* pOldMod = pOutFmtNode;
@@ -816,18 +762,15 @@ void SwWW8Writer::Out_SwFmt(const SwFmt& rFmt, bool bPapFmt, bool bChpFmt,
case RES_TXTFMTCOLL:
if( bPapFmt )
{
- //BYTE nLvl = ((const SwTxtFmtColl&)rFmt).GetOutlineLevel(); //#outline level,removed by zhaojianwei
- //if (MAXLEVEL > nLvl)
- //{ //<-end, ->add by zhaojianwei
if (((const SwTxtFmtColl&)rFmt).IsAssignedToListLevelOfOutlineStyle())
{
- int nLvl = ((const SwTxtFmtColl&)rFmt).GetAssignedOutlineStyleLevel(); //<-end,zhaojianwei
+ int nLvl = ((const SwTxtFmtColl&)rFmt).GetAssignedOutlineStyleLevel();
//if outline numbered
// if Write StyleDefinition then write the OutlineRule
- const SwNumFmt& rNFmt = pDoc->GetOutlineNumRule()->Get(static_cast<USHORT>(nLvl));
- if (bStyDef)
- ExportOutlineNumbering(static_cast<BYTE>(nLvl), rNFmt, rFmt);
+ const SwNumFmt& rNFmt = pDoc->GetOutlineNumRule()->Get( static_cast<USHORT>( nLvl ) );
+ if ( bStyDef )
+ AttrOutput().OutlineNumbering( static_cast< BYTE >( nLvl ), rNFmt, rFmt );
// --> OD 2008-06-03 #i86652#
// if (rNFmt.GetAbsLSpace())
@@ -844,8 +787,8 @@ void SwWW8Writer::Out_SwFmt(const SwFmt& rFmt, bool bPapFmt, bool bChpFmt,
aLR.SetTxtFirstLineOfst( GetWordFirstLineOffset(rNFmt));
aSet.Put( aLR );
- SwWW8Writer::CorrTabStopInSet( aSet, rNFmt.GetAbsLSpace() );
- Out_SfxItemSet( aSet, bPapFmt, bChpFmt,
+ CorrectTabStopInSet( aSet, rNFmt.GetAbsLSpace() );
+ OutputItemSet( aSet, bPapFmt, bChpFmt,
i18n::ScriptType::LATIN);
bCallOutSet = false;
}
@@ -863,7 +806,7 @@ void SwWW8Writer::Out_SwFmt(const SwFmt& rFmt, bool bPapFmt, bool bChpFmt,
SvxLRSpaceItem aLR(
ItemGet<SvxLRSpaceItem>(aSet, RES_LR_SPACE));
aSet.Put( aLR );
- Out_SfxItemSet( aSet, bPapFmt, bChpFmt,
+ OutputItemSet( aSet, bPapFmt, bChpFmt,
com::sun::star::i18n::ScriptType::LATIN);
bCallOutSet = false;
}
@@ -903,7 +846,7 @@ void SwWW8Writer::Out_SwFmt(const SwFmt& rFmt, bool bPapFmt, bool bChpFmt,
bOutFlyFrmAttrs = true;
//script doesn't matter if not exporting chp
- Out_SfxItemSet(aSet, true, false,
+ OutputItemSet(aSet, true, false,
i18n::ScriptType::LATIN);
bOutFlyFrmAttrs = false;
@@ -917,55 +860,64 @@ void SwWW8Writer::Out_SwFmt(const SwFmt& rFmt, bool bPapFmt, bool bChpFmt,
}
if( bCallOutSet )
- Out_SfxItemSet( rFmt.GetAttrSet(), bPapFmt, bChpFmt,
+ OutputItemSet( rFmt.GetAttrSet(), bPapFmt, bChpFmt,
i18n::ScriptType::LATIN);
pOutFmtNode = pOldMod;
}
-bool SwWW8Writer::HasRefToObject(USHORT nTyp, const String* pNm, USHORT nSeqNo)
+bool MSWordExportBase::HasRefToObject( USHORT nTyp, const String* pName, USHORT nSeqNo )
{
- bool bFnd = false;
const SwTxtNode* pNd;
- SwClientIter aIter( *pDoc->GetSysFldType( RES_GETREFFLD ));
- for( SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
- pFld && !bFnd; pFld = (SwFmtFld*)aIter.Next() )
- if( pFld->GetTxtFld() && nTyp == pFld->GetFld()->GetSubType() &&
- 0 != ( pNd = pFld->GetTxtFld()->GetpTxtNode() ) &&
- pNd->GetNodes().IsDocNodes() )
+ SwClientIter aIter( *pDoc->GetSysFldType( RES_GETREFFLD ) );
+ for ( SwFmtFld* pFld = static_cast< SwFmtFld* >( aIter.First( TYPE( SwFmtFld ) ) );
+ pFld;
+ pFld = static_cast< SwFmtFld* >( aIter.Next() ) )
+ {
+ if ( pFld->GetTxtFld() && nTyp == pFld->GetFld()->GetSubType() &&
+ 0 != ( pNd = pFld->GetTxtFld()->GetpTxtNode() ) &&
+ pNd->GetNodes().IsDocNodes() )
{
- const SwGetRefField& rRFld = *(SwGetRefField*)pFld->GetFld();
- switch( nTyp )
+ const SwGetRefField& rRFld = *static_cast< SwGetRefField* >( pFld->GetFld() );
+ switch ( nTyp )
{
- case REF_BOOKMARK:
- case REF_SETREFATTR:
- bFnd = (*pNm == rRFld.GetSetRefName()) ? true : false;
- break;
- case REF_FOOTNOTE:
- case REF_ENDNOTE:
- bFnd = (nSeqNo == rRFld.GetSeqNo()) ? true : false;
- break;
- case REF_SEQUENCEFLD: break; // ???
- case REF_OUTLINE: break; // ???
+ case REF_BOOKMARK:
+ case REF_SETREFATTR:
+ if ( pName && *pName == rRFld.GetSetRefName() )
+ return true;
+ break;
+ case REF_FOOTNOTE:
+ case REF_ENDNOTE:
+ if ( nSeqNo == rRFld.GetSeqNo() )
+ return true;
+ break;
+ case REF_SEQUENCEFLD:
+ break; // ???
+ case REF_OUTLINE:
+ break; // ???
}
}
+ }
- return bFnd;
+ return false;
}
-String SwWW8Writer::GetBookmarkName( USHORT nTyp, const String* pNm,
- USHORT nSeqNo )
+String MSWordExportBase::GetBookmarkName( USHORT nTyp, const String* pName, USHORT nSeqNo )
{
String sRet;
- switch( nTyp )
+ switch ( nTyp )
{
case REF_SETREFATTR:
- sRet.APPEND_CONST_ASC( "Ref_" );
- sRet += *pNm;
+ if ( pName )
+ {
+ sRet.APPEND_CONST_ASC( "Ref_" );
+ sRet += *pName;
+ }
break;
case REF_SEQUENCEFLD:
break; // ???
case REF_BOOKMARK:
- sRet = *pNm;
+ if ( pName )
+ sRet = *pName;
break;
case REF_OUTLINE:
break; // ???
@@ -986,238 +938,307 @@ String SwWW8Writer::GetBookmarkName( USHORT nTyp, const String* pNm,
//-----------------------------------------------------------------------
/* */
/* File CHRATR.HXX: */
+void WW8AttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript )
+{
+ if ( m_rWW8Export.bWrtWW8 && bIsRTL )
+ {
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CFBiDi );
+ m_rWW8Export.pO->Insert( (BYTE)1, m_rWW8Export.pO->Count() );
+ }
-static Writer& OutWW8_SwBoldUSW(Writer& rWrt, BYTE nId, bool bVal)
+ // #i46087# patch from james_clark; complex texts needs the undocumented SPRM CComplexScript with param 0x81.
+ if ( m_rWW8Export.bWrtWW8 && nScript == i18n::ScriptType::COMPLEX && !bIsRTL )
+ {
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CComplexScript );
+ m_rWW8Export.pO->Insert( (BYTE)0x81, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pDop->bUseThaiLineBreakingRules = true;
+ }
+}
+
+void WW8AttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16(8 == nId ? 0x2a53 : 0x0835 + nId);
+ m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(), m_rWW8Export.pO->GetData() );
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // delete
+
+ if ( pTextNodeInfoInner.get() != NULL )
+ {
+ if ( pTextNodeInfoInner->isEndOfLine() )
+ {
+ TableRowEnd( pTextNodeInfoInner->getDepth() );
+
+ SVBT16 nSty;
+ ShortToSVBT16( m_rWW8Export.nStyleBeforeFly, nSty );
+ m_rWW8Export.pO->Insert( (BYTE*)&nSty, 2, m_rWW8Export.pO->Count() ); // Style #
+ TableInfoRow( pTextNodeInfoInner );
+ m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(),
+ m_rWW8Export.pO->GetData() );
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // delete
+ }
+ }
+}
+
+void WW8AttributeOutput::StartRunProperties()
+{
+ WW8_WrPlcFld* pCurrentFields = m_rWW8Export.CurrentFieldPlc();
+ m_nFieldResults = pCurrentFields ? pCurrentFields->ResultCount() : 0;
+}
+
+void WW8AttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData )
+{
+ Redline( pRedlineData );
+
+ WW8_WrPlcFld* pCurrentFields = m_rWW8Export.CurrentFieldPlc();
+ USHORT nNewFieldResults = pCurrentFields ? pCurrentFields->ResultCount() : 0;
+
+ bool bExportedFieldResult = ( m_nFieldResults != nNewFieldResults );
+
+ // If we have exported a field result, then we will have been forced to
+ // split up the text into a 0x13, 0x14, <result> 0x15 sequence with the
+ // properties forced out at the end of the result, so the 0x15 itself
+ // should remain clean of all other attributes to avoid #iXXXXX#
+ if ( !bExportedFieldResult )
+ {
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(),
+ m_rWW8Export.pO->Count(), m_rWW8Export.pO->GetData() );
+ }
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // delete
+}
+
+void WW8AttributeOutput::RunText( const String& rText, rtl_TextEncoding eCharSet )
+{
+ RawText( rText, m_rWW8Export.bWrtWW8, eCharSet );
+}
+
+void WW8AttributeOutput::RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet )
+{
+ m_rWW8Export.OutSwString( rText, 0, rText.Len(), bForceUnicode, eCharSet );
+}
+
+void WW8AttributeOutput::OutputFKP()
+{
+ if ( m_rWW8Export.pO->Count() )
+ {
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(),
+ m_rWW8Export.pO->Count(), m_rWW8Export.pO->GetData() );
+ m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // delete
+ }
+}
+
+void WW8AttributeOutput::ParagraphStyle( USHORT nStyle )
+{
+ ASSERT( !m_rWW8Export.pO->Count(), " pO ist am ZeilenEnde nicht leer" );
+
+ SVBT16 nSty;
+ ShortToSVBT16( nStyle, nSty );
+ m_rWW8Export.pO->Insert( (BYTE*)&nSty, 2, m_rWW8Export.pO->Count() ); // Style #
+}
+
+void WW8AttributeOutput::OutputWW8Attribute( BYTE nId, bool bVal )
+{
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( 8 == nId ? NS_sprm::LN_CFDStrike : NS_sprm::LN_CFBold + nId );
else if (8 == nId )
- return rWrt; // das Attribut gibt es im WW6 nicht
+ return; // no such attribute in WW6
else
- rWrtWW8.pO->Insert( 85 + nId, rWrtWW8.pO->Count() );
- rWrtWW8.pO->Insert( bVal ? 1 : 0, rWrtWW8.pO->Count() );
- return rWrt;
+ m_rWW8Export.pO->Insert( 85 + nId, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.pO->Insert( bVal ? 1 : 0, m_rWW8Export.pO->Count() );
}
-static Writer& OutWW8_SwBoldBiDiUSW(Writer& rWrt, BYTE nId, bool bVal)
+void WW8AttributeOutput::OutputWW8AttributeCTL( BYTE nId, bool bVal )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- ASSERT(nId <= 1, "out of range");
- if (!rWrtWW8.bWrtWW8 || nId > 1)
- return rWrt;
+ ASSERT( nId <= 1, "out of range" );
+ if ( !m_rWW8Export.bWrtWW8 || nId > 1 )
+ return;
- rWrtWW8.InsUInt16(0x085C + nId);
- rWrtWW8.pO->Insert(bVal ? 1 : 0, rWrtWW8.pO->Count());
- return rWrt;
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CFBoldBi + nId );
+ m_rWW8Export.pO->Insert( bVal ? 1 : 0, m_rWW8Export.pO->Count() );
}
-static Writer& OutWW8_SwFont( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharFont( const SvxFontItem& rFont )
{
- const SvxFontItem& rAttr = (const SvxFontItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- USHORT nFontID= rWrtWW8.GetId(rAttr);
+ USHORT nFontID = m_rWW8Export.GetId( rFont );
- if( rWrtWW8.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
- rWrtWW8.InsUInt16( 0x4a4f );
- rWrtWW8.InsUInt16( nFontID );
- rWrtWW8.InsUInt16( 0x4a51 );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc0 );
+ m_rWW8Export.InsUInt16( nFontID );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc2 );
}
else
- rWrtWW8.pO->Insert( 93, rWrtWW8.pO->Count() );
- rWrtWW8.InsUInt16( nFontID );
- return rWrt;
+ m_rWW8Export.pO->Insert( 93, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( nFontID );
}
-static Writer& OutWW8_SwCTLFont(Writer& rWrt, const SfxPoolItem& rHt)
+void WW8AttributeOutput::CharFontCTL( const SvxFontItem& rFont )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (rWrtWW8.bWrtWW8)
+ if ( m_rWW8Export.bWrtWW8 )
{
- rWrtWW8.InsUInt16(0x4A5E);
- rWrtWW8.InsUInt16(rWrtWW8.GetId((const SvxFontItem&)rHt));
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CFtcBi );
+ m_rWW8Export.InsUInt16( m_rWW8Export.GetId( rFont ) );
}
- return rWrt;
}
-static Writer& OutWW8_SwCJKFont( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharFontCJK( const SvxFontItem& rFont )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
- rWrtWW8.InsUInt16( 0x4a50 );
- rWrtWW8.InsUInt16(rWrtWW8.GetId((const SvxFontItem&)rHt));
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc1 );
+ m_rWW8Export.InsUInt16( m_rWW8Export.GetId( rFont ) );
}
- return rWrt;
}
-static Writer& OutWW8_SwBiDiWeight( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharWeightCTL( const SvxWeightItem& rWeight )
{
//Can only export in 8+, in 7- export as normal varient and expect that
//upperlevel code has blocked exporting clobbering attributes
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (rWrtWW8.bWrtWW8)
+ if (m_rWW8Export.bWrtWW8)
{
- OutWW8_SwBoldBiDiUSW(rWrt, 0,
- WEIGHT_BOLD == ((const SvxWeightItem&)rHt).GetWeight());
+ OutputWW8AttributeCTL( 0, WEIGHT_BOLD == rWeight.GetWeight());
}
else
{
- OutWW8_SwBoldUSW(rWrt, 0,
- WEIGHT_BOLD == ((const SvxWeightItem&)rHt).GetWeight());
+ OutputWW8Attribute( 0, WEIGHT_BOLD == rWeight.GetWeight());
}
- return rWrt;
}
-static Writer& OutWW8_SwBiDiPosture( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharPostureCTL( const SvxPostureItem& rPosture )
{
- //Can only export in 8+, in 7- export as normal varient and expect that
- //upperlevel code has blocked exporting clobbering attributes
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (rWrtWW8.bWrtWW8)
+ // Can only export in 8+, in 7- export as normal varient and expect that
+ // upperlevel code has blocked exporting clobbering attributes
+ if (m_rWW8Export.bWrtWW8)
{
- OutWW8_SwBoldBiDiUSW( rWrt, 1,
- ITALIC_NONE != ((const SvxPostureItem&)rHt).GetPosture() );
+ OutputWW8AttributeCTL( 1, ITALIC_NONE != rPosture.GetPosture() );
}
else
{
- OutWW8_SwBoldUSW( rWrt, 1,
- ITALIC_NONE != ((const SvxPostureItem&)rHt).GetPosture() );
+ OutputWW8Attribute( 1, ITALIC_NONE != rPosture.GetPosture() );
}
- return rWrt;
}
-static Writer& OutWW8_SwPosture( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharPosture( const SvxPostureItem& rPosture )
{
- return OutWW8_SwBoldUSW( rWrt, 1,
- ITALIC_NONE != ((const SvxPostureItem&)rHt).GetPosture() );
+ OutputWW8Attribute( 1, ITALIC_NONE != rPosture.GetPosture() );
}
-static Writer& OutWW8_SwWeight( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharWeight( const SvxWeightItem& rWeight )
{
- return OutWW8_SwBoldUSW( rWrt, 0,
- WEIGHT_BOLD == ((const SvxWeightItem&)rHt).GetWeight() );
+ OutputWW8Attribute( 0, WEIGHT_BOLD == rWeight.GetWeight() );
}
-// Shadowed und Contour gibts in WW-UI nicht. JP: ??
-static Writer& OutWW8_SwContour( Writer& rWrt, const SfxPoolItem& rHt )
+// Shadowed und Contour are not in WW-UI. JP: ??
+void WW8AttributeOutput::CharContour( const SvxContourItem& rContour )
{
- return OutWW8_SwBoldUSW(rWrt, 3,
- ((const SvxContourItem&)rHt).GetValue() ? true : false);
+ OutputWW8Attribute( 3, rContour.GetValue() ? true : false);
}
-static Writer& OutWW8_SwShadow( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharShadow( const SvxShadowedItem& rShadow )
{
- return OutWW8_SwBoldUSW(rWrt, 4,
- ((const SvxShadowedItem&)rHt).GetValue() ? true : false);
+ OutputWW8Attribute( 4, rShadow.GetValue() ? true : false);
}
-static Writer& OutWW8_SwKerning( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharKerning( const SvxKerningItem& rKerning )
{
- const SvxKerningItem& rAttr = (const SvxKerningItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x8840 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CDxaSpace );
else
- rWrtWW8.pO->Insert( 96, rWrtWW8.pO->Count() );
- rWrtWW8.InsUInt16( rAttr.GetValue() );
- return rWrt;
+ m_rWW8Export.pO->Insert( 96, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( rKerning.GetValue() );
}
-static Writer& OutWW8_SvxAutoKern( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharAutoKern( const SvxAutoKernItem& rAutoKern )
{
- const SvxAutoKernItem& rAttr = (const SvxAutoKernItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x484B );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CHpsKern );
else
- rWrtWW8.pO->Insert( 107, rWrtWW8.pO->Count() );
- rWrtWW8.InsUInt16( rAttr.GetValue() ? 1 : 0 );
- return rWrt;
+ m_rWW8Export.pO->Insert( 107, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( rAutoKern.GetValue() ? 1 : 0 );
}
-static Writer& OutWW8_SwAnimatedText( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink )
{
- const SvxBlinkItem& rAttr = (const SvxBlinkItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
- rWrtWW8.InsUInt16( 0x2859 );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CSfxText );
// At the moment the only animated text effect we support is blinking
- rWrtWW8.InsUInt16( rAttr.GetValue() ? 2 : 0 );
+ m_rWW8Export.InsUInt16( rBlink.GetValue() ? 2 : 0 );
}
- return rWrt;
}
-
-static Writer& OutWW8_SwCrossedOut( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossed )
{
- FontStrikeout eSt = ((const SvxCrossedOutItem&)rHt).GetStrikeout();
- if( STRIKEOUT_DOUBLE == eSt )
- return OutWW8_SwBoldUSW(rWrt, 8, true);
- if( STRIKEOUT_NONE != eSt )
- return OutWW8_SwBoldUSW(rWrt, 2, true);
+ FontStrikeout eSt = rCrossed.GetStrikeout();
+ if ( STRIKEOUT_DOUBLE == eSt )
+ {
+ OutputWW8Attribute( 8, true );
+ return;
+ }
+ if ( STRIKEOUT_NONE != eSt )
+ {
+ OutputWW8Attribute( 2, true );
+ return;
+ }
- // dann auch beide ausschalten!
- OutWW8_SwBoldUSW(rWrt, 8, false);
- return OutWW8_SwBoldUSW(rWrt, 2, false);
+ // otherwise both off
+ OutputWW8Attribute( 8, false );
+ OutputWW8Attribute( 2, false );
}
-static Writer& OutWW8_SwCaseMap( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharCaseMap( const SvxCaseMapItem& rCaseMap )
{
- USHORT eSt = ((const SvxCaseMapItem&)rHt).GetValue();
- switch (eSt)
+ USHORT eSt = rCaseMap.GetValue();
+ switch ( eSt )
{
case SVX_CASEMAP_KAPITAELCHEN:
- return OutWW8_SwBoldUSW(rWrt, 5, true);
+ OutputWW8Attribute( 5, true );
+ return;
case SVX_CASEMAP_VERSALIEN:
- return OutWW8_SwBoldUSW(rWrt, 6, true);
+ OutputWW8Attribute( 6, true );
+ return;
case SVX_CASEMAP_TITEL:
- //NO such feature in word
+ // no such feature in word
break;
default:
- // dann auch beide ausschalten!
- OutWW8_SwBoldUSW(rWrt, 5, false);
- return OutWW8_SwBoldUSW(rWrt, 6, false);
+ // otherwise both off
+ OutputWW8Attribute( 5, false );
+ OutputWW8Attribute( 6, false );
+ return;
}
- return rWrt;
}
-static Writer& OutWW8_SvxCharHidden(Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharHidden( const SvxCharHiddenItem& rHidden )
{
- OutWW8_SwBoldUSW(rWrt, 7, (item_cast<SvxCharHiddenItem>(rHt)).GetValue());
- return rWrt;
+ OutputWW8Attribute( 7, rHidden.GetValue() );
}
-static Writer& OutWW8_SwUnderline( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline )
{
- const SvxUnderlineItem& rAttr = (const SvxUnderlineItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x2A3E );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CKul );
else
- rWrtWW8.pO->Insert( 94, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( 94, m_rWW8Export.pO->Count() );
- const SfxPoolItem* pItem = ((SwWW8Writer&)rWrt).HasItem(
- RES_CHRATR_WORDLINEMODE );
+ const SfxPoolItem* pItem = m_rWW8Export.HasItem( RES_CHRATR_WORDLINEMODE );
bool bWord = false;
if (pItem)
bWord = ((const SvxWordLineModeItem*)pItem)->GetValue() ? true : false;
- // WW95 - parameters: 0 = none, 1 = single, 2 = by Word,
- // 3 = double, 4 = dotted, 5 = hidden
- // WW97 - additional parameters:
- // 6 = thick, 7 = dash, 8 = dot(not used)
- // 9 = dotdash 10 = dotdotdash, 11 = wave
+ // WW95 - parameters: 0 = none, 1 = single, 2 = by Word,
+ // 3 = double, 4 = dotted, 5 = hidden
+ // WW97 - additional parameters:
+ // 6 = thick, 7 = dash, 8 = dot(not used)
+ // 9 = dotdash 10 = dotdotdash, 11 = wave
BYTE b = 0;
- switch (rAttr.GetLineStyle())
+ switch ( rUnderline.GetLineStyle() )
{
case UNDERLINE_SINGLE:
b = ( bWord ) ? 2 : 1;
break;
case UNDERLINE_BOLD:
- b = rWrtWW8.bWrtWW8 ? 6 : 1;
+ b = m_rWW8Export.bWrtWW8 ? 6 : 1;
break;
case UNDERLINE_DOUBLE:
b = 3;
@@ -1226,286 +1247,265 @@ static Writer& OutWW8_SwUnderline( Writer& rWrt, const SfxPoolItem& rHt )
b = 4;
break;
case UNDERLINE_DASH:
- b = rWrtWW8.bWrtWW8 ? 7 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 7 : 4;
break;
case UNDERLINE_DASHDOT:
- b = rWrtWW8.bWrtWW8 ? 9 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 9 : 4;
break;
case UNDERLINE_DASHDOTDOT:
- b = rWrtWW8.bWrtWW8 ? 10 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 10 : 4;
break;
case UNDERLINE_WAVE:
- b = rWrtWW8.bWrtWW8 ? 11 : 3;
+ b = m_rWW8Export.bWrtWW8 ? 11 : 3;
break;
// ------------ new in WW2000 -------------------------------------
case UNDERLINE_BOLDDOTTED:
- b = rWrtWW8.bWrtWW8 ? 20 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 20 : 4;
break;
case UNDERLINE_BOLDDASH:
- b = rWrtWW8.bWrtWW8 ? 23 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 23 : 4;
break;
case UNDERLINE_LONGDASH:
- b = rWrtWW8.bWrtWW8 ? 39 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 39 : 4;
break;
case UNDERLINE_BOLDLONGDASH:
- b = rWrtWW8.bWrtWW8 ? 55 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 55 : 4;
break;
case UNDERLINE_BOLDDASHDOT:
- b = rWrtWW8.bWrtWW8 ? 25 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 25 : 4;
break;
case UNDERLINE_BOLDDASHDOTDOT:
- b = rWrtWW8.bWrtWW8 ? 26 : 4;
+ b = m_rWW8Export.bWrtWW8 ? 26 : 4;
break;
case UNDERLINE_BOLDWAVE:
- b = rWrtWW8.bWrtWW8 ? 27 : 3;
+ b = m_rWW8Export.bWrtWW8 ? 27 : 3;
break;
case UNDERLINE_DOUBLEWAVE:
- b = rWrtWW8.bWrtWW8 ? 43 : 3;
+ b = m_rWW8Export.bWrtWW8 ? 43 : 3;
break;
case UNDERLINE_NONE:
b = 0;
break;
default:
- ASSERT(rAttr.GetLineStyle() == UNDERLINE_NONE, "Unhandled underline type");
+ ASSERT( rUnderline.GetLineStyle() == UNDERLINE_NONE, "Unhandled underline type" );
break;
}
- rWrtWW8.pO->Insert(b, rWrtWW8.pO->Count());
- return rWrt;
+ m_rWW8Export.pO->Insert( b, m_rWW8Export.pO->Count() );
}
-static Writer& OutWW8_SwLanguage( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharLanguage( const SvxLanguageItem& rLanguage )
{
USHORT nId = 0;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (rWrtWW8.bWrtWW8)
+ if ( m_rWW8Export.bWrtWW8 )
{
- switch (rHt.Which())
+ switch ( rLanguage.Which() )
{
case RES_CHRATR_LANGUAGE:
- nId = 0x486D;
+ nId = NS_sprm::LN_CRgLid0;
break;
case RES_CHRATR_CJK_LANGUAGE:
- nId = 0x486E;
+ nId = NS_sprm::LN_CRgLid1;
break;
case RES_CHRATR_CTL_LANGUAGE:
- nId = 0x485F;
+ nId = NS_sprm::LN_CLidBi;
break;
}
}
else
nId = 97;
- if (nId)
+ if ( nId )
{
- if (rWrtWW8.bWrtWW8) // use sprmCRgLid0 rather than sprmCLid
- rWrtWW8.InsUInt16(nId);
+ if ( m_rWW8Export.bWrtWW8 ) // use sprmCRgLid0 rather than sprmCLid
+ m_rWW8Export.InsUInt16( nId );
else
- rWrtWW8.pO->Insert((BYTE)nId, rWrtWW8.pO->Count());
- rWrtWW8.InsUInt16(((const SvxLanguageItem&)rHt).GetLanguage());
+ m_rWW8Export.pO->Insert( (BYTE)nId, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( rLanguage.GetLanguage() );
- //unknown as to exactly why, but this seems to shadow the other
- //paramater in word 2000 and without it spellchecking doesn't work
- if (nId == 0x486D)
+ // unknown as to exactly why, but this seems to shadow the other
+ // paramater in word 2000 and without it spellchecking doesn't work
+ if ( nId == NS_sprm::LN_CRgLid0 )
{
- rWrtWW8.InsUInt16(0x4873);
- rWrtWW8.InsUInt16(((const SvxLanguageItem&)rHt).GetLanguage());
+ m_rWW8Export.InsUInt16( 0x4873 );
+ m_rWW8Export.InsUInt16( rLanguage.GetLanguage() );
}
- else if (nId == 0x485F)
+ else if ( nId == NS_sprm::LN_CLidBi )
{
- rWrtWW8.InsUInt16(0x4874);
- rWrtWW8.InsUInt16(((const SvxLanguageItem&)rHt).GetLanguage());
+ m_rWW8Export.InsUInt16( 0x4874 );
+ m_rWW8Export.InsUInt16( rLanguage.GetLanguage() );
}
}
- return rWrt;
}
-static Writer& OutWW8_SwEscapement( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement )
{
- const SvxEscapementItem& rAttr = (const SvxEscapementItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
-
BYTE b = 0xFF;
- short nEsc = rAttr.GetEsc(), nProp = rAttr.GetProp();
- if( !nEsc )
+ short nEsc = rEscapement.GetEsc(), nProp = rEscapement.GetProp();
+ if ( !nEsc )
{
b = 0;
nEsc = 0;
nProp = 100;
}
- else if( DFLT_ESC_PROP == nProp )
+ else if ( DFLT_ESC_PROP == nProp )
{
- if( DFLT_ESC_SUB == nEsc || DFLT_ESC_AUTO_SUB == nEsc )
+ if ( DFLT_ESC_SUB == nEsc || DFLT_ESC_AUTO_SUB == nEsc )
b = 2;
- else if( DFLT_ESC_SUPER == nEsc || DFLT_ESC_AUTO_SUPER == nEsc )
+ else if ( DFLT_ESC_SUPER == nEsc || DFLT_ESC_AUTO_SUPER == nEsc )
b = 1;
}
- if( 0xFF != b )
+ if ( 0xFF != b )
{
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x2A48 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CIss );
else
- rWrtWW8.pO->Insert( 104, rWrtWW8.pO->Count() );
- rWrtWW8.pO->Insert( b, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( 104, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.pO->Insert( b, m_rWW8Export.pO->Count() );
}
- if( 0 == b || 0xFF == b )
+ if ( 0 == b || 0xFF == b )
{
- long nHeight = ((SvxFontHeightItem&)rWrtWW8.GetItem(
+ long nHeight = ((SvxFontHeightItem&)m_rWW8Export.GetItem(
RES_CHRATR_FONTSIZE )).GetHeight();
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x4845 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CHpsPos );
else
- rWrtWW8.pO->Insert( 101, rWrtWW8.pO->Count() );
- rWrtWW8.InsUInt16( (short)(( nHeight * nEsc + 500 ) / 1000 ));
+ m_rWW8Export.pO->Insert( 101, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( (short)(( nHeight * nEsc + 500 ) / 1000 ));
if( 100 != nProp || !b )
{
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x4A43 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CHps );
else
- rWrtWW8.pO->Insert( 99, rWrtWW8.pO->Count() );
- rWrtWW8.InsUInt16(
- msword_cast<sal_uInt16>((nHeight * nProp + 500 ) / 1000));
+ m_rWW8Export.pO->Insert( 99, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16(
+ msword_cast<sal_uInt16>((nHeight * nProp + 500 ) / 1000));
}
}
- return rWrt;
}
-static Writer& OutWW8_SwSize( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharFontSize( const SvxFontHeightItem& rHeight )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
USHORT nId = 0;
- if (rWrtWW8.bWrtWW8)
+ if ( m_rWW8Export.bWrtWW8 )
{
- switch (rHt.Which())
+ switch ( rHeight.Which() )
{
case RES_CHRATR_FONTSIZE:
case RES_CHRATR_CJK_FONTSIZE:
- nId = 0x4A43;
+ nId = NS_sprm::LN_CHps;
break;
case RES_CHRATR_CTL_FONTSIZE:
- nId = 0x4A61;
+ nId = NS_sprm::LN_CHpsBi;
break;
}
}
else
nId = 99;
- if( nId )
+ if ( nId )
{
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( nId );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( nId );
else
- rWrtWW8.pO->Insert( (BYTE)nId, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( (BYTE)nId, m_rWW8Export.pO->Count() );
- const SvxFontHeightItem& rAttr = (const SvxFontHeightItem&)rHt;
- rWrtWW8.InsUInt16( (UINT16)(( rAttr.GetHeight() + 5 ) / 10 ) );
+ m_rWW8Export.InsUInt16( (UINT16)(( rHeight.GetHeight() + 5 ) / 10 ) );
}
- return rWrt;
}
-static Writer& OutWW8_ScaleWidth( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharScaleWidth( const SvxCharScaleWidthItem& rScaleWidth )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
- rWrtWW8.InsUInt16( 0x4852 );
- rWrtWW8.InsUInt16( ((SvxCharScaleWidthItem&)rHt).GetValue() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CCharScale );
+ m_rWW8Export.InsUInt16( rScaleWidth.GetValue() );
}
- return rWrt;
}
-static Writer& OutWW8_Relief( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharRelief( const SvxCharReliefItem& rRelief )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
- const SvxCharReliefItem& rAttr = (const SvxCharReliefItem&)rHt;
USHORT nId;
- switch ( rAttr.GetValue() )
+ switch ( rRelief.GetValue() )
{
- case RELIEF_EMBOSSED: nId = 0x858; break;
- case RELIEF_ENGRAVED: nId = 0x854; break;
- default: nId = 0; break;
+ case RELIEF_EMBOSSED: nId = NS_sprm::LN_CFEmboss; break;
+ case RELIEF_ENGRAVED: nId = NS_sprm::LN_CFImprint; break;
+ default: nId = 0; break;
}
if( nId )
{
- rWrtWW8.InsUInt16( nId );
- rWrtWW8.pO->Insert( (BYTE)0x81, rWrtWW8.pO->Count() );
+ m_rWW8Export.InsUInt16( nId );
+ m_rWW8Export.pO->Insert( (BYTE)0x81, m_rWW8Export.pO->Count() );
}
else
{
// switch both flags off
- rWrtWW8.InsUInt16( 0x858 );
- rWrtWW8.pO->Insert( (BYTE)0x0, rWrtWW8.pO->Count() );
- rWrtWW8.InsUInt16( 0x854 );
- rWrtWW8.pO->Insert( (BYTE)0x0, rWrtWW8.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CFEmboss );
+ m_rWW8Export.pO->Insert( (BYTE)0x0, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CFImprint );
+ m_rWW8Export.pO->Insert( (BYTE)0x0, m_rWW8Export.pO->Count() );
}
}
- return rWrt;
}
-
-static Writer& OutWW8_CharRotate( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharRotate( const SvxCharRotateItem& rRotate )
{
// #i28331# - check that a Value is set
- if((static_cast<const SvxCharRotateItem&>(rHt)).GetValue())
+ if ( !rRotate.GetValue() )
+ return;
+
+ if ( m_rWW8Export.bWrtWW8 && !m_rWW8Export.bIsInTable )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 && !rWrtWW8.bIsInTable )
- {
- // #i36867 In word the text in a table is rotated via the TC or 0x7629
- // This means you can only rotate all or none of the text adding 0xCA78
- // here corrupts the table, hence !rWrtWW8.bIsInTable
- const SvxCharRotateItem& rAttr = (const SvxCharRotateItem&)rHt;
-
- rWrtWW8.InsUInt16( 0xCA78 );
- rWrtWW8.pO->Insert( (BYTE)0x06, rWrtWW8.pO->Count() ); //len 6
- rWrtWW8.pO->Insert( (BYTE)0x01, rWrtWW8.pO->Count() );
-
- rWrtWW8.InsUInt16( rAttr.IsFitToLine() ? 1 : 0 );
- static const BYTE aZeroArr[ 3 ] = { 0, 0, 0 };
- rWrtWW8.pO->Insert( aZeroArr, 3, rWrtWW8.pO->Count() );
- }
+ // #i36867 In word the text in a table is rotated via the TC or NS_sprm::LN_TTextFlow
+ // This means you can only rotate all or none of the text adding NS_sprm::LN_CEastAsianLayout
+ // here corrupts the table, hence !m_rWW8Export.bIsInTable
+
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CEastAsianLayout );
+ m_rWW8Export.pO->Insert( (BYTE)0x06, m_rWW8Export.pO->Count() ); //len 6
+ m_rWW8Export.pO->Insert( (BYTE)0x01, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( rRotate.IsFitToLine() ? 1 : 0 );
+ static const BYTE aZeroArr[ 3 ] = { 0, 0, 0 };
+ m_rWW8Export.pO->Insert( aZeroArr, 3, m_rWW8Export.pO->Count() );
}
- return rWrt;
}
-
-static Writer& OutWW8_EmphasisMark( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasisMark )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
+ if ( m_rWW8Export.bWrtWW8 )
{
BYTE nVal;
- switch ( ((const SvxEmphasisMarkItem&)rHt).GetValue() )
+ switch ( rEmphasisMark.GetValue() )
{
- case EMPHASISMARK_NONE: nVal = 0; break;
- case EMPHASISMARK_SIDE_DOTS: nVal = 2; break;
- case EMPHASISMARK_CIRCLE_ABOVE: nVal = 3; break;
- case EMPHASISMARK_DOTS_BELOW: nVal = 4; break;
-// case 1:
- default: nVal = 1; break;
+ case EMPHASISMARK_NONE: nVal = 0; break;
+ case EMPHASISMARK_SIDE_DOTS: nVal = 2; break;
+ case EMPHASISMARK_CIRCLE_ABOVE: nVal = 3; break;
+ case EMPHASISMARK_DOTS_BELOW: nVal = 4; break;
+ // case 1:
+ default: nVal = 1; break;
}
- rWrtWW8.InsUInt16( 0x2A34 );
- rWrtWW8.pO->Insert( nVal, rWrtWW8.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CKcd );
+ m_rWW8Export.pO->Insert( nVal, m_rWW8Export.pO->Count() );
}
- return rWrt;
}
-
// TransCol uebersetzt SW-Farben in WW. Heraus kommt die bei WW fuer
// Text- und Hintergrundfarbe benutzte Codierung.
// Gibt es keine direkte Entsprechung, dann wird versucht, eine moeglichst
// aehnliche WW-Farbe zu finden.
// return: 5-Bit-Wert ( 0..16 )
-BYTE SwWW8Writer::TransCol( const Color& rCol )
+BYTE WW8Export::TransCol( const Color& rCol )
{
BYTE nCol = 0; // ->Auto
switch( rCol.GetColor() )
@@ -1554,7 +1554,7 @@ BYTE SwWW8Writer::TransCol( const Color& rCol )
// Return: Echte Brush ( nicht transparent )
// auch bei Transparent wird z.B. fuer Tabellen eine transparente Brush
// geliefert
-bool SwWW8Writer::TransBrush(const Color& rCol, WW8_SHD& rShd)
+bool WW8Export::TransBrush(const Color& rCol, WW8_SHD& rShd)
{
if( rCol.GetTransparency() )
rShd = WW8_SHD(); // alles Nullen : transparent
@@ -1574,77 +1574,66 @@ sal_uInt32 SuitableBGColor(sal_uInt32 nIn)
return wwUtility::RGBToBGR(nIn);
}
-static Writer& OutWW8_SwColor( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharColor( const SvxColorItem& rColor )
{
- const SvxColorItem& rAttr = (const SvxColorItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (rWrtWW8.bWrtWW8)
- rWrtWW8.InsUInt16(0x2A42);
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CIco );
else
- rWrtWW8.pO->Insert(98, rWrtWW8.pO->Count());
+ m_rWW8Export.pO->Insert( 98, m_rWW8Export.pO->Count() );
- BYTE nColour = rWrtWW8.TransCol(rAttr.GetValue());
- rWrtWW8.pO->Insert(nColour, rWrtWW8.pO->Count());
+ BYTE nColor = m_rWW8Export.TransCol( rColor.GetValue() );
+ m_rWW8Export.pO->Insert( nColor, m_rWW8Export.pO->Count() );
- if (rWrtWW8.bWrtWW8 && nColour)
+ if ( m_rWW8Export.bWrtWW8 && nColor )
{
- rWrtWW8.InsUInt16(0x6870);
- rWrtWW8.InsUInt32(wwUtility::RGBToBGR(rAttr.GetValue().GetColor()));
+ m_rWW8Export.InsUInt16( 0x6870 );
+ m_rWW8Export.InsUInt32( wwUtility::RGBToBGR( rColor.GetValue().GetColor() ) );
}
- return rWrt;
}
-static Writer& OutWW8_SwFmtCharBackground( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharBackground( const SvxBrushItem& rBrush )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
-
- if( rWW8Wrt.bWrtWW8 ) // nur WW8 kann ZeichenHintergrund
+ if( m_rWW8Export.bWrtWW8 ) // nur WW8 kann ZeichenHintergrund
{
- const SvxBrushItem& rBack = (const SvxBrushItem&)rHt;
WW8_SHD aSHD;
- rWW8Wrt.TransBrush(rBack.GetColor(), aSHD);
+ m_rWW8Export.TransBrush( rBrush.GetColor(), aSHD );
// sprmCShd
- rWW8Wrt.InsUInt16( 0x4866 );
- rWW8Wrt.InsUInt16( aSHD.GetValue() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CShd );
+ m_rWW8Export.InsUInt16( aSHD.GetValue() );
//Quite a few unknowns, some might be transparency or something
//of that nature...
- rWW8Wrt.InsUInt16(0xCA71);
- rWW8Wrt.pO->Insert(10, rWW8Wrt.pO->Count());
- rWW8Wrt.InsUInt32(0xFF000000);
- rWW8Wrt.InsUInt32(SuitableBGColor(rBack.GetColor().GetColor()));
- rWW8Wrt.InsUInt16(0x0000);
+ m_rWW8Export.InsUInt16( 0xCA71 );
+ m_rWW8Export.pO->Insert( 10, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt32( 0xFF000000 );
+ m_rWW8Export.InsUInt32( SuitableBGColor( rBrush.GetColor().GetColor() ) );
+ m_rWW8Export.InsUInt16( 0x0000);
}
- return rWrt;
}
-static Writer& OutSwFmtINetFmt( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::TextINetFormat( const SwFmtINetFmt& rINet )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- const SwFmtINetFmt& rINet = (SwFmtINetFmt&)rHt;
-
- if( rINet.GetValue().Len() )
+ if ( rINet.GetValue().Len() )
{
USHORT nId;
const String& rStr = rINet.GetINetFmt();
- if( rStr.Len() )
+ if ( rStr.Len() )
nId = rINet.GetINetFmtId();
else
nId = RES_POOLCHR_INET_NORMAL;
const SwCharFmt* pFmt = IsPoolUserFmt( nId )
- ? rWrt.pDoc->FindCharFmtByName( rStr )
- : rWrt.pDoc->GetCharFmtFromPool( nId );
+ ? m_rWW8Export.pDoc->FindCharFmtByName( rStr )
+ : m_rWW8Export.pDoc->GetCharFmtFromPool( nId );
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x4A30 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CIstd );
else
- rWrtWW8.pO->Insert( 80, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( 80, m_rWW8Export.pO->Count() );
- rWrtWW8.InsUInt16( rWrtWW8.GetId( *pFmt ) );
+ m_rWW8Export.InsUInt16( m_rWW8Export.GetId( *pFmt ) );
}
- return rWrt;
}
// --> OD 2005-06-08 #i43956# - add optional parameter <pLinkStr>
@@ -1652,7 +1641,7 @@ static Writer& OutSwFmtINetFmt( Writer& rWrt, const SfxPoolItem& rHt )
// - it contains the name of the link target, which is a bookmark.
// --> OD 2008-08-14 #158418# - add optional parameter <bIncludeEmptyPicLocation>
// It is needed to write an empty picture location for page number field separators
-static void InsertSpecialChar( SwWW8Writer& rWrt, BYTE c,
+static void InsertSpecialChar( WW8Export& rWrt, BYTE c,
String* pLinkStr = 0L,
bool bIncludeEmptyPicLocation = false )
{
@@ -1672,7 +1661,7 @@ static void InsertSpecialChar( SwWW8Writer& rWrt, BYTE c,
if ( bIncludeEmptyPicLocation &&
( c == 0x13 || c == 0x14 || c == 0x15 ) )
{
- SwWW8Writer::InsUInt16( aItems, 0x6a03 );
+ SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CPicLocation );
SwWW8Writer::InsUInt32( aItems, 0x00000000 );
}
// <--
@@ -1714,11 +1703,11 @@ static void InsertSpecialChar( SwWW8Writer& rWrt, BYTE c,
rStrm.Seek( nCurrPos );
// write attributes of hyperlink character 0x01
- SwWW8Writer::InsUInt16( aItems, 0x0802 ); //sprmCFFldVanish
+ SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CFFldVanish );
aItems.Insert( (BYTE)0x81, aItems.Count() );
- SwWW8Writer::InsUInt16( aItems, 0x6a03 );
+ SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CPicLocation );
SwWW8Writer::InsUInt32( aItems, nLinkPosInDataStrm );
- SwWW8Writer::InsUInt16( aItems, 0x0806 );
+ SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CFData );
aItems.Insert( (BYTE)0x01, aItems.Count() );
}
@@ -1729,7 +1718,7 @@ static void InsertSpecialChar( SwWW8Writer& rWrt, BYTE c,
// fSpec-Attribute true
if( rWrt.bWrtWW8 )
{
- SwWW8Writer::InsUInt16( aItems, 0x855 ); //sprmCFSpec
+ SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CFSpec );
aItems.Insert( 1, aItems.Count() );
}
else
@@ -1752,7 +1741,7 @@ String lcl_GetExpandedField(const SwField &rFld)
return sRet;
}
-WW8_WrPlcFld* SwWW8Writer::CurrentFieldPlc() const
+WW8_WrPlcFld* WW8Export::CurrentFieldPlc() const
{
WW8_WrPlcFld* pFldP = NULL;
switch (nTxtTyp)
@@ -1769,6 +1758,9 @@ WW8_WrPlcFld* SwWW8Writer::CurrentFieldPlc() const
case TXT_EDN:
pFldP = pFldEdn;
break;
+ case TXT_ATN:
+ pFldP = pFldAtn;
+ break;
case TXT_TXTBOX:
pFldP = pFldTxtBxs;
break;
@@ -1781,8 +1773,8 @@ WW8_WrPlcFld* SwWW8Writer::CurrentFieldPlc() const
return pFldP;
}
-void SwWW8Writer::OutField(const SwField* pFld, ww::eField eFldType,
- const String& rFldCmd, BYTE nMode)
+void WW8Export::OutputField( const SwField* pFld, ww::eField eFldType,
+ const String& rFldCmd, BYTE nMode )
{
bool bUnicode = IsUnicode();
WW8_WrPlcFld* pFldP = CurrentFieldPlc();
@@ -1888,16 +1880,16 @@ void SwWW8Writer::OutField(const SwField* pFld, ww::eField eFldType,
BYTE aArr[12];
BYTE *pArr = aArr;
- if( bWrtWW8 )
+ if ( bWrtWW8 )
{
- Set_UInt16(pArr, 0x6a03); //sprmCPicLocation
- Set_UInt32(pArr, 0x0);
+ Set_UInt16( pArr, NS_sprm::LN_CPicLocation );
+ Set_UInt32( pArr, 0x0 );
- Set_UInt16( pArr, 0x855 );//sprmCFSpec
+ Set_UInt16( pArr, NS_sprm::LN_CFSpec );
Set_UInt8( pArr, 1 );
- Set_UInt16( pArr, 0x875 );//sprmCFNoProof
- Set_UInt8(pArr, 1);
+ Set_UInt16( pArr, NS_sprm::LN_CFNoProof );
+ Set_UInt8( pArr, 1 );
}
else
{
@@ -1907,7 +1899,7 @@ void SwWW8Writer::OutField(const SwField* pFld, ww::eField eFldType,
Set_UInt8( pArr, 117 ); //sprmCFSpec
Set_UInt8( pArr, 1 );
}
- pChpPlc->AppendFkpEntry( pStrm->Tell(), static_cast< short >(pArr - aArr), aArr );
+ pChpPlc->AppendFkpEntry( Strm().Tell(), static_cast< short >(pArr - aArr), aArr );
}
}
}
@@ -1935,25 +1927,25 @@ void SwWW8Writer::OutField(const SwField* pFld, ww::eField eFldType,
}
}
-void SwWW8Writer::StartCommentOutput(const String& rName)
+void WW8Export::StartCommentOutput(const String& rName)
{
String sStr(FieldString(ww::eQUOTE));
sStr.APPEND_CONST_ASC("[");
sStr += rName;
sStr.APPEND_CONST_ASC("] ");
- OutField(0, ww::eQUOTE, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START);
+ OutputField(0, ww::eQUOTE, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START);
}
-void SwWW8Writer::EndCommentOutput(const String& rName)
+void WW8Export::EndCommentOutput(const String& rName)
{
String sStr(CREATE_CONST_ASC(" ["));
sStr += rName;
sStr.APPEND_CONST_ASC("] ");
- OutField(0, ww::eQUOTE, sStr, WRITEFIELD_CMD_END | WRITEFIELD_END |
+ OutputField(0, ww::eQUOTE, sStr, WRITEFIELD_CMD_END | WRITEFIELD_END |
WRITEFIELD_CLOSE);
}
-USHORT SwWW8Writer::GetId( const SwTOXType& rTOXType )
+USHORT MSWordExportBase::GetId( const SwTOXType& rTOXType )
{
void* p = (void*)&rTOXType;
USHORT nRet = aTOXArr.GetPos( p );
@@ -2049,9 +2041,9 @@ bool lcl_IsHyperlinked(const SwForm& rForm, USHORT nTOXLvl)
return bRes;
}
-void SwWW8Writer::StartTOX( const SwSection& rSect )
+void AttributeOutputBase::StartTOX( const SwSection& rSect )
{
- if (const SwTOXBase* pTOX = rSect.GetTOXBase())
+ if ( const SwTOXBase* pTOX = rSect.GetTOXBase() )
{
static const sal_Char sEntryEnd[] = "\" ";
@@ -2133,10 +2125,9 @@ void SwWW8Writer::StartTOX( const SwSection& rSect )
if( TOX_USER == pTOX->GetType() )
{
sStr += '\"';
- sStr += (sal_Char)('A' + GetId( *pTOX->GetTOXType()));
+ sStr += (sal_Char)( 'A' + GetExport( ).GetId( *pTOX->GetTOXType() ) );
sStr.AppendAscii( sEntryEnd );
}
- }
if( nsSwTOXElement::TOX_OUTLINELEVEL & pTOX->GetCreateType() )
{
@@ -2148,7 +2139,7 @@ void SwWW8Writer::StartTOX( const SwSection& rSect )
// // (ignoring headline styles 1-9)
// //BYTE nLvl = 0, nMinLvl = 0; //#outline level, removed by zhaojianwei
// int nLvl = 0, nMinLvl = 0; //<-end,add by zhaojianwei
-// const SwTxtFmtColls& rColls = *pDoc->GetTxtFmtColls();
+// const SwTxtFmtColls& rColls = *GetExport().pDoc->GetTxtFmtColls();
// const SwTxtFmtColl* pColl;
// for( n = rColls.Count(); n; )
// {
@@ -2212,8 +2203,87 @@ void SwWW8Writer::StartTOX( const SwSection& rSect )
// }
// }
// }
+
}
+
+ if( nsSwTOXElement::TOX_OUTLINELEVEL & pTOX->GetCreateType() )
+ {
+ // Take the TOC value of the max level to evaluate to as
+ // the starting point for the \o flag, but reduce it to the
+ // value of the highest outline level filled by a *standard*
+ // Heading 1 - 9 style because \o "Builds a table of
+ // contents from paragraphs formatted with built-in heading
+ // styles". And afterward fill in any outline styles left
+ // uncovered by that range to the \t flag
+ //
+ // i.e. for
+ // Heading 1
+ // Heading 2
+ // custom-style
+ // Heading 4
+ // output
+ // \o 1-2 \tcustom-style,3,Heading 3,4
+
+ // Search over all the outline styles used and figure out
+ // what is the minimum outline level (if any) filled by a
+ // non-standard style for that level, i.e. ignore headline
+ // styles 1-9 and find the lowest valid outline level
+ BYTE nPosOfLowestNonStandardLvl = MAXLEVEL;
+ const SwTxtFmtColls& rColls = *GetExport().pDoc->GetTxtFmtColls();
+ for( n = rColls.Count(); n; )
+ {
+ const SwTxtFmtColl* pColl = rColls[ --n ];
+ USHORT nPoolId = pColl->GetPoolFmtId();
+ if (
+ //Is a Non-Standard Outline Style
+ (RES_POOLCOLL_HEADLINE1 > nPoolId || RES_POOLCOLL_HEADLINE9 < nPoolId) &&
+ //Has a valid outline level
+ (pColl->IsAssignedToListLevelOfOutlineStyle()) &&
+ // Is less than the lowest known non-standard level
+ (pColl->GetAssignedOutlineStyleLevel() < nPosOfLowestNonStandardLvl)
+ )
+ {
+ nPosOfLowestNonStandardLvl = ::sal::static_int_cast<BYTE>(pColl->GetAssignedOutlineStyleLevel());
+ }
+ }
+
+ BYTE nMaxMSAutoEvaluate = nPosOfLowestNonStandardLvl < nTOXLvl ? nPosOfLowestNonStandardLvl : (BYTE)nTOXLvl;
+
+ //output \o 1-X where X is the highest normal outline style to be included in the toc
+ if ( nMaxMSAutoEvaluate )
+ {
+ if (nMaxMSAutoEvaluate > WW8ListManager::nMaxLevel)
+ nMaxMSAutoEvaluate = WW8ListManager::nMaxLevel;
+
+ sStr.APPEND_CONST_ASC( "\\o \"1-" );
+ sStr += String::CreateFromInt32( nMaxMSAutoEvaluate );
+ sStr.AppendAscii(sEntryEnd);
+ }
+
+ //collect up any other styles in the writer TOC which will
+ //not already appear in the MS TOC and place then into the
+ //\t option
+ if( nMaxMSAutoEvaluate < nTOXLvl )
+ {
+ // collect this templates into the \t otion
+ for( n = rColls.Count(); n;)
+ {
+ const SwTxtFmtColl* pColl = rColls[ --n ];
+ if (!pColl->IsAssignedToListLevelOfOutlineStyle())
+ continue;
+ BYTE nTestLvl = ::sal::static_int_cast<BYTE>(pColl->GetAssignedOutlineStyleLevel());
+ if (nTestLvl < nTOXLvl && nTestLvl >= nMaxMSAutoEvaluate)
+ {
+ if( sTOption.Len() )
+ sTOption += ',';
+ (( sTOption += pColl->GetName() ) += ',' )
+ += String::CreateFromInt32( nTestLvl + 1 );
+ }
+ }
+ }
+ }
+
if( nsSwTOXElement::TOX_TEMPLATE & pTOX->GetCreateType() )
// --> OD 2009-02-27 #i99641#
// Consider additional styles regardless of TOX-outlinelevel
@@ -2224,16 +2294,20 @@ void SwWW8Writer::StartTOX( const SwSection& rSect )
if( rStyles.Len() )
{
xub_StrLen nPos = 0;
- String sLvl( ';' );
+ String sLvl( ',' );
sLvl += String::CreateFromInt32( n + 1 );
do {
String sStyle( rStyles.GetToken( 0,
TOX_STYLE_DELIMITER, nPos ));
if( sStyle.Len() )
{
- if( sTOption.Len() )
- sTOption += ';';
- ( sTOption += sStyle ) += sLvl;
+ SwTxtFmtColl* pColl = GetExport().pDoc->FindTxtFmtCollByName(sStyle);
+ if (!pColl->IsAssignedToListLevelOfOutlineStyle() || pColl->GetAssignedOutlineStyleLevel() < nTOXLvl)
+ {
+ if( sTOption.Len() )
+ sTOption += ',';
+ ( sTOption += sStyle ) += sLvl;
+ }
}
} while( STRING_NOTFOUND != nPos );
}
@@ -2300,30 +2374,32 @@ void SwWW8Writer::StartTOX( const SwSection& rSect )
sStr.APPEND_CONST_ASC("\\h");
}
break;
+ }
}
if( sStr.Len() )
{
- bInWriteTOX = true;
- OutField(0, eCode, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START |
- WRITEFIELD_CMD_END);
+ GetExport( ).bInWriteTOX = true;
+ GetExport( ).OutputField( 0, eCode, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START |
+ WRITEFIELD_CMD_END );
}
+
+ GetExport( ).bStartTOX = false;
}
- bStartTOX = false;
}
-void SwWW8Writer::EndTOX( const SwSection& rSect )
+void AttributeOutputBase::EndTOX( const SwSection& rSect )
{
const SwTOXBase* pTOX = rSect.GetTOXBase();
- if( pTOX )
+ if ( pTOX )
{
ww::eField eCode = TOX_INDEX == pTOX->GetType() ? ww::eINDEX : ww::eTOC;
- OutField(0, eCode, aEmptyStr, WRITEFIELD_CLOSE);
+ GetExport( ).OutputField( 0, eCode, aEmptyStr, WRITEFIELD_CLOSE );
}
- bInWriteTOX = false;
+ GetExport( ).bInWriteTOX = false;
}
-bool SwWW8Writer::GetNumberFmt(const SwField& rFld, String& rStr)
+bool MSWordExportBase::GetNumberFmt(const SwField& rFld, String& rStr)
{
// Returns a date or time format string by using the US NfKeywordTable
bool bHasFmt = false;
@@ -2358,7 +2434,7 @@ bool SwWW8Writer::GetNumberFmt(const SwField& rFld, String& rStr)
return bHasFmt;
}
-void WW8_GetNumberPara( String& rStr, const SwField& rFld )
+void AttributeOutputBase::GetNumberPara( String& rStr, const SwField& rFld )
{
switch(rFld.GetFormat())
{
@@ -2388,14 +2464,14 @@ void WW8_GetNumberPara( String& rStr, const SwField& rFld )
}
}
-void SwWW8Writer::WritePostItBegin( WW8Bytes* pOut )
+void WW8Export::WritePostItBegin( WW8Bytes* pOut )
{
BYTE aArr[ 3 ];
BYTE* pArr = aArr;
// sprmCFSpec true
if( bWrtWW8 )
- Set_UInt16( pArr, 0x855 ); //sprmCFSpec
+ Set_UInt16( pArr, NS_sprm::LN_CFSpec );
else
Set_UInt8( pArr, 117 ); //sprmCFSpec
Set_UInt8( pArr, 1 );
@@ -2417,46 +2493,128 @@ String FieldString(ww::eField eIndex)
return sRet;
}
-void OutWW8_RefField(SwWW8Writer& rWW8Wrt, const SwField &rFld,
- const String &rRef)
+void WW8AttributeOutput::HiddenField( const SwField& rFld )
{
- String sStr(FieldString(ww::eREF));
- sStr.APPEND_CONST_ASC("\"");
- sStr += rRef;
- sStr.APPEND_CONST_ASC( "\" " );
- rWW8Wrt.OutField(&rFld, ww::eREF, sStr, WRITEFIELD_START |
+ String sExpand(rFld.GetPar2());
+
+ //replace LF 0x0A with VT 0x0B
+ sExpand.SearchAndReplaceAll(0x0A, 0x0B);
+ m_rWW8Export.pChpPlc->AppendFkpEntry(m_rWW8Export.Strm().Tell());
+ if (m_rWW8Export.IsUnicode())
+ {
+ SwWW8Writer::WriteString16(m_rWW8Export.Strm(), sExpand, false);
+ static BYTE aArr[] =
+ {
+ 0x3C, 0x08, 0x1
+ };
+ m_rWW8Export.pChpPlc->AppendFkpEntry(m_rWW8Export.Strm().Tell(), sizeof(aArr), aArr);
+ }
+ else
+ {
+ SwWW8Writer::WriteString8(m_rWW8Export.Strm(), sExpand, false,
+ RTL_TEXTENCODING_MS_1252);
+ static BYTE aArr[] =
+ {
+ 92, 0x1
+ };
+ m_rWW8Export.pChpPlc->AppendFkpEntry(m_rWW8Export.Strm().Tell(), sizeof(aArr), aArr);
+ }
+}
+
+void WW8AttributeOutput::SetField( const SwField& rFld, ww::eField eType, const String& rCmd )
+{
+ const SwSetExpField* pSet=(const SwSetExpField*)(&rFld);
+ const String &rVar = pSet->GetPar2();
+
+ ULONG nFrom = m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell());
+
+ GetExport().OutputField(&rFld, eType, rCmd, WRITEFIELD_START |
WRITEFIELD_CMD_START | WRITEFIELD_CMD_END);
- String sVar = lcl_GetExpandedField(rFld);
- if (sVar.Len())
+
+ /*
+ Is there a bookmark at the start position of this field, if so
+ move it to the 0x14 of the result of the field. This is what word
+ does. MoveFieldMarks moves any bookmarks at this position to
+ the beginning of the field result, and marks the bookmark as a
+ fieldbookmark which is to be ended before the field end mark
+ instead of after it like a normal bookmark.
+ */
+ m_rWW8Export.MoveFieldMarks(nFrom,m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell()));
+
+ if (rVar.Len())
{
- if (rWW8Wrt.IsUnicode())
- SwWW8Writer::WriteString16(rWW8Wrt.Strm(), sVar, false);
+ if (m_rWW8Export.IsUnicode())
+ SwWW8Writer::WriteString16(m_rWW8Export.Strm(), rVar, false);
else
{
- SwWW8Writer::WriteString8(rWW8Wrt.Strm(), sVar, false,
+ SwWW8Writer::WriteString8(m_rWW8Export.Strm(), rVar, false,
RTL_TEXTENCODING_MS_1252);
}
}
- rWW8Wrt.OutField(&rFld, ww::eREF, sStr, WRITEFIELD_CLOSE);
+ GetExport().OutputField(&rFld, eType, rCmd, WRITEFIELD_CLOSE);
+}
+
+void WW8AttributeOutput::PostitField( const SwField* pFld )
+{
+ const SwPostItField& rPFld = *(SwPostItField*)pFld;
+ m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), rPFld );
+ m_rWW8Export.WritePostItBegin( m_rWW8Export.pO );
+}
+
+bool WW8AttributeOutput::DropdownField( const SwField* pFld )
+{
+ bool bExpand = true;
+ if ( m_rWW8Export.bWrtWW8 )
+ {
+ const SwDropDownField& rFld2 = *(SwDropDownField*)pFld;
+ uno::Sequence<rtl::OUString> aItems =
+ rFld2.GetItemSequence();
+ GetExport().DoComboBox(rFld2.GetName(),
+ rFld2.GetHelp(),
+ rFld2.GetToolTip(),
+ rFld2.GetSelectedItem(), aItems);
+ bExpand = false;
+ }
+ return bExpand;
}
-void WriteExpand(SwWW8Writer& rWW8Wrt, const SwField &rFld)
+void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef)
{
- String sExpand(lcl_GetExpandedField(rFld));
- if (rWW8Wrt.IsUnicode())
- SwWW8Writer::WriteString16(rWW8Wrt.Strm(), sExpand, false);
+ String sStr( FieldString( ww::eREF ) );
+ sStr.APPEND_CONST_ASC( "\"" );
+ sStr += rRef;
+ sStr.APPEND_CONST_ASC( "\" " );
+ m_rWW8Export.OutputField( &rFld, ww::eREF, sStr, WRITEFIELD_START |
+ WRITEFIELD_CMD_START | WRITEFIELD_CMD_END );
+ String sVar = lcl_GetExpandedField( rFld );
+ if ( sVar.Len() )
+ {
+ if ( m_rWW8Export.IsUnicode() )
+ SwWW8Writer::WriteString16( m_rWW8Export.Strm(), sVar, false );
+ else
+ {
+ SwWW8Writer::WriteString8( m_rWW8Export.Strm(), sVar, false,
+ RTL_TEXTENCODING_MS_1252 );
+ }
+ }
+ m_rWW8Export.OutputField( &rFld, ww::eREF, sStr, WRITEFIELD_CLOSE );
+}
+
+void WW8AttributeOutput::WriteExpand( const SwField* pFld )
+{
+ String sExpand( lcl_GetExpandedField( *pFld ) );
+ if ( m_rWW8Export.IsUnicode() )
+ SwWW8Writer::WriteString16( m_rWW8Export.Strm(), sExpand, false );
else
{
- SwWW8Writer::WriteString8(rWW8Wrt.Strm(), sExpand, false,
- RTL_TEXTENCODING_MS_1252);
+ SwWW8Writer::WriteString8( m_rWW8Export.Strm(), sExpand, false,
+ RTL_TEXTENCODING_MS_1252 );
}
}
-static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
+void AttributeOutputBase::TextField( const SwFmtFld& rField )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- const SwFmtFld& rFld = (SwFmtFld&)rHt;
- const SwField* pFld = rFld.GetFld();
+ const SwField* pFld = rField.GetFld();
String sStr; // fuer optionale Parameter
bool bWriteExpand = false;
USHORT nSubType = pFld->GetSubType();
@@ -2467,7 +2625,7 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
if (nSubType == nsSwGetSetExpType::GSE_STRING)
{
const SwGetExpField *pGet=(const SwGetExpField*)(pFld);
- OutWW8_RefField(rWW8Wrt, *pGet, pGet->GetFormula());
+ RefField( *pGet, pGet->GetFormula() );
}
else
bWriteExpand = true;
@@ -2480,8 +2638,8 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
sStr += pFld->GetTyp()->GetName();
sStr.APPEND_CONST_ASC( "\" " );
- ::WW8_GetNumberPara( sStr, *pFld );
- rWW8Wrt.OutField(pFld, ww::eSEQ, sStr);
+ GetNumberPara( sStr, *pFld );
+ GetExport().OutputField(pFld, ww::eSEQ, sStr);
}
else if (nSubType & nsSwGetSetExpType::GSE_STRING)
{
@@ -2511,69 +2669,44 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
bShowAsWell = (nSubType & nsSwExtendedSubType::SUB_INVISIBLE) ? false : true;
}
- ULONG nFrom = rWW8Wrt.Fc2Cp(rWrt.Strm().Tell());
-
- rWW8Wrt.OutField(pFld, eFieldNo, sStr, WRITEFIELD_START |
- WRITEFIELD_CMD_START | WRITEFIELD_CMD_END);
-
- /*
- Is there a bookmark at the start position of this field, if so
- move it to the 0x14 of the result of the field. This is what word
- does. MoveFieldMarks moves any bookmarks at this position to
- the beginning of the field result, and marks the bookmark as a
- fieldbookmark which is to be ended before the field end mark
- instead of after it like a normal bookmark.
- */
- rWW8Wrt.MoveFieldMarks(nFrom,rWW8Wrt.Fc2Cp(rWrt.Strm().Tell()));
-
- if (rVar.Len())
- {
- if (rWW8Wrt.IsUnicode())
- SwWW8Writer::WriteString16(rWrt.Strm(), rVar, false);
- else
- {
- SwWW8Writer::WriteString8(rWrt.Strm(), rVar, false,
- RTL_TEXTENCODING_MS_1252);
- }
- }
- rWW8Wrt.OutField(pFld, eFieldNo, sStr, WRITEFIELD_CLOSE);
+ SetField( *pFld, eFieldNo, sStr );
if (bShowAsWell)
- OutWW8_RefField(rWW8Wrt, *pSet, pSet->GetPar1());
+ RefField( *pSet, pSet->GetPar1() );
}
else
bWriteExpand = true;
break;
case RES_PAGENUMBERFLD:
sStr = FieldString(ww::ePAGE);
- ::WW8_GetNumberPara(sStr, *pFld);
- rWW8Wrt.OutField(pFld, ww::ePAGE, sStr);
+ GetNumberPara(sStr, *pFld);
+ GetExport().OutputField(pFld, ww::ePAGE, sStr);
break;
case RES_FILENAMEFLD:
sStr = FieldString(ww::eFILENAME);
if (pFld->GetFormat() == FF_PATHNAME)
sStr.APPEND_CONST_ASC("\\p ");
- rWW8Wrt.OutField(pFld, ww::eFILENAME, sStr);
+ GetExport().OutputField(pFld, ww::eFILENAME, sStr);
break;
case RES_DBNAMEFLD:
{
sStr = FieldString(ww::eDATABASE);
- SwDBData aData = rWrt.pDoc->GetDBData();
+ SwDBData aData = GetExport().pDoc->GetDBData();
sStr += String(aData.sDataSource);
sStr += DB_DELIM;
sStr += String(aData.sCommand);
- rWW8Wrt.OutField(pFld, ww::eDATABASE, sStr);
+ GetExport().OutputField(pFld, ww::eDATABASE, sStr);
}
break;
case RES_AUTHORFLD:
{
ww::eField eFld =
(AF_SHORTCUT & nSubType ? ww::eUSERINITIALS : ww::eUSERNAME);
- rWW8Wrt.OutField(pFld, eFld, FieldString(eFld));
+ GetExport().OutputField(pFld, eFld, FieldString(eFld));
}
break;
case RES_TEMPLNAMEFLD:
- rWW8Wrt.OutField(pFld, ww::eTEMPLATE, FieldString(ww::eTEMPLATE));
+ GetExport().OutputField(pFld, ww::eTEMPLATE, FieldString(ww::eTEMPLATE));
break;
case RES_DOCINFOFLD: // Last printed, last edited,...
if( DI_SUB_FIXED & nSubType )
@@ -2601,25 +2734,25 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
case DI_CREATE:
if (DI_SUB_AUTHOR == (nSubType & DI_SUB_MASK))
eFld = ww::eAUTHOR;
- else if (rWW8Wrt.GetNumberFmt(*pFld, sStr))
+ else if (GetExport().GetNumberFmt(*pFld, sStr))
eFld = ww::eCREATEDATE;
break;
case DI_CHANGE:
if (DI_SUB_AUTHOR == (nSubType & DI_SUB_MASK))
eFld = ww::eLASTSAVEDBY;
- else if (rWW8Wrt.GetNumberFmt(*pFld, sStr))
+ else if (GetExport().GetNumberFmt(*pFld, sStr))
eFld = ww::eSAVEDATE;
break;
case DI_PRINT:
if (DI_SUB_AUTHOR != (nSubType & DI_SUB_MASK) &&
- rWW8Wrt.GetNumberFmt(*pFld, sStr))
+ GetExport().GetNumberFmt(*pFld, sStr))
eFld = ww::ePRINTDATE;
break;
case DI_EDIT:
if( DI_SUB_AUTHOR != (nSubType & DI_SUB_MASK ) &&
- rWW8Wrt.GetNumberFmt( *pFld, sStr ))
+ GetExport().GetNumberFmt( *pFld, sStr ))
eFld = ww::eSAVEDATE;
break;
case DI_CUSTOM:
@@ -2650,20 +2783,20 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
if (eFld != ww::eNONE)
{
sStr.Insert(FieldString(eFld), 0);
- rWW8Wrt.OutField(pFld, eFld, sStr);
+ GetExport().OutputField(pFld, eFld, sStr);
}
else
bWriteExpand = true;
}
break;
case RES_DATETIMEFLD:
- if (FIXEDFLD & nSubType || !rWW8Wrt.GetNumberFmt(*pFld, sStr))
+ if (FIXEDFLD & nSubType || !GetExport().GetNumberFmt(*pFld, sStr))
bWriteExpand = true;
else
{
ww::eField eFld = (DATEFLD & nSubType) ? ww::eDATE : ww::eTIME;
sStr.Insert(FieldString(eFld), 0);
- rWW8Wrt.OutField(pFld, eFld, sStr);
+ GetExport().OutputField(pFld, eFld, sStr);
}
break;
case RES_DOCSTATFLD:
@@ -2686,8 +2819,8 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
if (eFld != ww::eNONE)
{
sStr = FieldString(eFld);
- ::WW8_GetNumberPara(sStr, *pFld);
- rWW8Wrt.OutField(pFld, eFld, sStr);
+ GetNumberPara(sStr, *pFld);
+ GetExport().OutputField(pFld, eFld, sStr);
}
else
bWriteExpand = true;
@@ -2716,7 +2849,7 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
if (eFld != ww::eNONE)
{
sStr = FieldString(eFld);
- rWW8Wrt.OutField(pFld, eFld, sStr);
+ GetExport().OutputField(pFld, eFld, sStr);
}
else
bWriteExpand = true;
@@ -2724,11 +2857,9 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
break;
case RES_POSTITFLD:
//Sadly only possible for word in main document text
- if (rWW8Wrt.nTxtTyp == TXT_MAINTEXT)
+ if (GetExport().nTxtTyp == TXT_MAINTEXT)
{
- const SwPostItField& rPFld = *(SwPostItField*)pFld;
- rWW8Wrt.pAtn->Append( rWW8Wrt.Fc2Cp( rWrt.Strm().Tell() ), rPFld );
- rWW8Wrt.WritePostItBegin( rWW8Wrt.pO );
+ PostitField( pFld );
}
break;
case RES_INPUTFLD:
@@ -2737,16 +2868,16 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
dynamic_cast<const SwInputField *>(pFld);
if (pInputField->isFormField())
- rWW8Wrt.DoFormText(pInputField);
+ GetExport().DoFormText(pInputField);
else
{
sStr = FieldString(ww::eFILLIN);
- sStr.ASSIGN_CONST_ASC("\"");
+ sStr.APPEND_CONST_ASC("\"");
sStr += pFld->GetPar2();
sStr += '\"';
- rWW8Wrt.OutField(pFld, ww::eFILLIN, sStr);
+ GetExport().OutputField(pFld, ww::eFILLIN, sStr);
}
}
break;
@@ -2769,7 +2900,7 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
break;
}
sStr = FieldString(eFld);
- sStr += rWW8Wrt.GetBookmarkName(nSubType,
+ sStr += GetExport().GetBookmarkName(nSubType,
&rRFld.GetSetRefName(), 0);
break;
case REF_FOOTNOTE:
@@ -2789,7 +2920,7 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
break;
}
sStr = FieldString(eFld);
- sStr += rWW8Wrt.GetBookmarkName(nSubType, 0,
+ sStr += GetExport().GetBookmarkName(nSubType, 0,
rRFld.GetSeqNo());
break;
}
@@ -2808,7 +2939,7 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
break;
}
sStr.APPEND_CONST_ASC(" \\h "); // insert hyperlink
- rWW8Wrt.OutField(pFld, eFld, sStr);
+ GetExport().OutputField(pFld, eFld, sStr);
}
else
bWriteExpand = true;
@@ -2835,7 +2966,7 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
else
nScript = i18n::ScriptType::ASIAN;
- long nHeight = ((SvxFontHeightItem&)(((SwWW8Writer&)rWrt).GetItem(
+ long nHeight = ((SvxFontHeightItem&)(GetExport().GetItem(
GetWhichOfScript(RES_CHRATR_FONTSIZE,nScript)))).GetHeight();;
nHeight = (nHeight + 10) / 20; //Font Size in points;
@@ -2858,31 +2989,20 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
sStr.Append('(');
sStr += String(pFld->GetPar1(),nAbove,pFld->GetPar1().Len()-nAbove);
sStr.APPEND_CONST_ASC("))");
- rWW8Wrt.OutField(pFld, ww::eEQ, sStr);
+ GetExport().OutputField(pFld, ww::eEQ, sStr);
}
break;
case RES_DROPDOWN:
- if (rWW8Wrt.bWrtWW8)
- {
- const SwDropDownField& rFld2 = *(SwDropDownField*)pFld;
- uno::Sequence<rtl::OUString> aItems =
- rFld2.GetItemSequence();
- rWW8Wrt.DoComboBox(rFld2.GetName(),
- rFld2.GetHelp(),
- rFld2.GetToolTip(),
- rFld2.GetSelectedItem(), aItems);
- }
- else
- bWriteExpand = true;
+ bWriteExpand = DropdownField( pFld );
break;
case RES_CHAPTERFLD:
bWriteExpand = true;
- if (rWW8Wrt.bOutKF && rFld.GetTxtFld())
+ if (GetExport().bOutKF && rField.GetTxtFld())
{
- const SwTxtNode *pTxtNd = rWW8Wrt.GetHdFtPageRoot();
+ const SwTxtNode *pTxtNd = GetExport().GetHdFtPageRoot();
if (!pTxtNd)
{
- if (const SwNode *pNd = rWW8Wrt.pCurPam->GetNode())
+ if (const SwNode *pNd = GetExport().pCurPam->GetNode())
pTxtNd = pNd->GetTxtNode();
}
@@ -2890,7 +3010,7 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
{
SwChapterField aCopy(*(const SwChapterField*)pFld);
aCopy.ChangeExpansion(*pTxtNd, false);
- WriteExpand(rWW8Wrt, aCopy);
+ WriteExpand( &aCopy );
bWriteExpand = false;
}
}
@@ -2900,28 +3020,7 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
String sExpand(pFld->GetPar2());
if (sExpand.Len())
{
- //replace LF 0x0A with VT 0x0B
- sExpand.SearchAndReplaceAll(0x0A, 0x0B);
- rWW8Wrt.pChpPlc->AppendFkpEntry(rWW8Wrt.Strm().Tell());
- if (rWW8Wrt.IsUnicode())
- {
- SwWW8Writer::WriteString16(rWW8Wrt.Strm(), sExpand, false);
- static BYTE aArr[] =
- {
- 0x3C, 0x08, 0x1
- };
- rWW8Wrt.pChpPlc->AppendFkpEntry(rWW8Wrt.Strm().Tell(), sizeof(aArr), aArr);
- }
- else
- {
- SwWW8Writer::WriteString8(rWW8Wrt.Strm(), sExpand, false,
- RTL_TEXTENCODING_MS_1252);
- static BYTE aArr[] =
- {
- 92, 0x1
- };
- rWW8Wrt.pChpPlc->AppendFkpEntry(rWW8Wrt.Strm().Tell(), sizeof(aArr), aArr);
- }
+ HiddenField( *pFld );
}
}
break;
@@ -2931,27 +3030,23 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt )
}
if (bWriteExpand)
- WriteExpand(rWW8Wrt, *pFld);
-
- return rWrt;
+ WriteExpand( pFld );
}
-static Writer& OutWW8_SwFlyCntnt( Writer& rWrt, const SfxPoolItem& rHt )
+void AttributeOutputBase::TextFlyContent( const SwFmtFlyCnt& rFlyContent )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (rWrtWW8.pOutFmtNode && rWrtWW8.pOutFmtNode->ISA(SwCntntNode))
+ if ( GetExport().pOutFmtNode && GetExport().pOutFmtNode->ISA( SwCntntNode ) )
{
- SwTxtNode* pTxtNd = (SwTxtNode*)rWrtWW8.pOutFmtNode;
+ SwTxtNode* pTxtNd = (SwTxtNode*)GetExport().pOutFmtNode;
Point aLayPos;
- aLayPos = pTxtNd->FindLayoutRect(false, &aLayPos).Pos();
+ aLayPos = pTxtNd->FindLayoutRect( false, &aLayPos ).Pos();
- SwPosition aPos(*pTxtNd);
- sw::Frame aFrm(*((const SwFmtFlyCnt&)rHt).GetFrmFmt(), aPos);
+ SwPosition aPos( *pTxtNd );
+ sw::Frame aFrm( *rFlyContent.GetFrmFmt(), aPos );
- rWrtWW8.OutWW8FlyFrm(aFrm, aLayPos);
+ OutputFlyFrame_Impl( aFrm, aLayPos );
}
- return rWrt;
}
// TOXMarks fehlen noch
@@ -2962,74 +3057,62 @@ static Writer& OutWW8_SwFlyCntnt( Writer& rWrt, const SfxPoolItem& rHt )
// ---
// ACK. Dieser Vorschlag passt exakt zu unserer Implementierung des Import,
// daher setze ich das gleich mal um. (KHZ, 07/15/2000)
-static Writer& OutWW8_SvxHyphenZone( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::ParaHyphenZone( const SvxHyphenZoneItem& rHyphenZone )
{
-// sprmPFNoAutoHyph
- const SvxHyphenZoneItem& rAttr = (const SvxHyphenZoneItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x242A );
+ // sprmPFNoAutoHyph
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFNoAutoHyph );
else
- rWrtWW8.pO->Insert( 44, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( 44, m_rWW8Export.pO->Count() );
- rWrtWW8.pO->Insert( rAttr.IsHyphen() ? 0 : 1, rWrtWW8.pO->Count() );
- return rWrt;
+ m_rWW8Export.pO->Insert( rHyphenZone.IsHyphen() ? 0 : 1, m_rWW8Export.pO->Count() );
}
-static Writer& OutWW8_SfxBoolItem( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::ParaScriptSpace( const SfxBoolItem& rScriptSpace )
{
USHORT nId = 0;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- switch ( rHt.Which() )
+ if ( m_rWW8Export.bWrtWW8 )
+ switch ( rScriptSpace.Which() )
{
- case RES_PARATR_SCRIPTSPACE: nId = 0x2437; break;
- case RES_PARATR_HANGINGPUNCTUATION: nId = 0x2435; break;
- case RES_PARATR_FORBIDDEN_RULES: nId = 0x2433; break;
+ case RES_PARATR_SCRIPTSPACE: nId = NS_sprm::LN_PFAutoSpaceDE; break;
+ case RES_PARATR_HANGINGPUNCTUATION: nId = NS_sprm::LN_PFOverflowPunct; break;
+ case RES_PARATR_FORBIDDEN_RULES: nId = NS_sprm::LN_PFKinsoku; break;
}
- if( nId )
+ if ( nId )
{
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( nId );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( nId );
else
- rWrtWW8.pO->Insert( (BYTE)nId, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( (BYTE)nId, m_rWW8Export.pO->Count() );
- rWrtWW8.pO->Insert( ((SfxBoolItem&)rHt).GetValue() ? 1 : 0,
- rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( rScriptSpace.GetValue() ? 1 : 0,
+ m_rWW8Export.pO->Count() );
}
- return rWrt;
}
-static Writer& OutWW8_SvxParaGridItem(Writer& rWrt, const SfxPoolItem& rHt)
+void WW8AttributeOutput::ParaSnapToGrid( const SvxParaGridItem& rGrid )
{
-// sprmPFUsePgsuSettings
-
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- //97+ only
- if (!rWrtWW8.bWrtWW8)
- return rWrt;
+ // sprmPFUsePgsuSettings
+ // 97+ only
+ if ( !m_rWW8Export.bWrtWW8 )
+ return;
- rWrtWW8.InsUInt16(0x2447);
- const SvxParaGridItem& rAttr = (const SvxParaGridItem&)rHt;
- rWrtWW8.pO->Insert( rAttr.GetValue(), rWrtWW8.pO->Count() );
- return rWrt;
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFUsePgsuSettings );
+ m_rWW8Export.pO->Insert( rGrid.GetValue(), m_rWW8Export.pO->Count() );
}
-static Writer& OutWW8_SvxParaVertAlignItem(Writer& rWrt, const SfxPoolItem& rHt)
+void WW8AttributeOutput::ParaVerticalAlign( const SvxParaVertAlignItem& rAlign )
{
-// sprmPWAlignFont
-
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- //97+ only
- if( !rWrtWW8.bWrtWW8 )
- return rWrt;
+ // sprmPWAlignFont
+ // 97+ only
+ if( !m_rWW8Export.bWrtWW8 )
+ return;
- rWrtWW8.InsUInt16( 0x4439 );
- const SvxParaVertAlignItem & rAttr = (const SvxParaVertAlignItem&)rHt;
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PWAlignFont );
- INT16 nVal = rAttr.GetValue();
- switch (nVal)
+ INT16 nVal = rAlign.GetValue();
+ switch ( nVal )
{
case SvxParaVertAlignItem::BASELINE:
nVal = 2;
@@ -3048,25 +3131,23 @@ static Writer& OutWW8_SvxParaVertAlignItem(Writer& rWrt, const SfxPoolItem& rHt)
break;
default:
nVal = 4;
- ASSERT(!(&rWrt), "Unknown vert alignment");
+ ASSERT( false, "Unknown vert alignment" );
break;
}
- rWrtWW8.InsUInt16( nVal );
- return rWrt;
+ m_rWW8Export.InsUInt16( nVal );
}
// NoHyphen: ich habe keine Entsprechung in der SW-UI und WW-UI gefunden
-static Writer& OutWW8_SwHardBlank( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::TextHardBlank( const SwFmtHardBlank& rHardBlank )
{
- ((SwWW8Writer&)rWrt).WriteChar( ((SwFmtHardBlank&)rHt).GetChar() );
- return rWrt;
+ m_rWW8Export.WriteChar( rHardBlank.GetChar() );
}
// RefMark, NoLineBreakHere fehlen noch
-void SwWW8Writer::WriteFtnBegin( const SwFmtFtn& rFtn, WW8Bytes* pOutArr )
+void WW8Export::WriteFtnBegin( const SwFmtFtn& rFtn, WW8Bytes* pOutArr )
{
WW8Bytes aAttrArr;
bool bAutoNum = !rFtn.GetNumStr().Len(); // Auto-Nummer
@@ -3104,7 +3185,7 @@ void SwWW8Writer::WriteFtnBegin( const SwFmtFtn& rFtn, WW8Bytes* pOutArr )
? pInfo->GetAnchorCharFmt( *pDoc )
: pInfo->GetCharFmt( *pDoc );
if( bWrtWW8 )
- SwWW8Writer::InsUInt16( aAttrArr, 0x4a30 );
+ SwWW8Writer::InsUInt16( aAttrArr, NS_sprm::LN_CIstd );
else
aAttrArr.Insert( 80, aAttrArr.Count() );
SwWW8Writer::InsUInt16( aAttrArr, GetId( *pCFmt ) );
@@ -3148,7 +3229,7 @@ void SwWW8Writer::WriteFtnBegin( const SwFmtFtn& rFtn, WW8Bytes* pOutArr )
pTxtFtn->GetTxtNode().GetAttr( aSet, *pTxtFtn->GetStart(),
(*pTxtFtn->GetStart()) + 1 );
- ::OutWW8_SwFont( *this, aSet.Get( RES_CHRATR_FONT ));
+ m_pAttrOutput->OutputItem( aSet.Get( RES_CHRATR_FONT ) );
pO = pOld;
}
pChpPlc->AppendFkpEntry( Strm().Tell(), aOutArr.Count(),
@@ -3177,84 +3258,81 @@ static bool lcl_IsAtTxtEnd(const SwFmtFtn& rFtn)
}
-static Writer& OutWW8_SwFtn( Writer& rWrt, const SfxPoolItem& rHt )
+void AttributeOutputBase::TextFootnote( const SwFmtFtn& rFtn )
{
- const SwFmtFtn& rFtn = (const SwFmtFtn&)rHt;
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
-
USHORT nTyp;
- WW8_WrPlcFtnEdn* pFtnEnd;
- if( rFtn.IsEndNote() )
+ if ( rFtn.IsEndNote() )
{
- pFtnEnd = rWW8Wrt.pEdn;
nTyp = REF_ENDNOTE;
- if( rWW8Wrt.bEndAtTxtEnd )
- rWW8Wrt.bEndAtTxtEnd = lcl_IsAtTxtEnd( rFtn );
+ if ( GetExport().bEndAtTxtEnd )
+ GetExport().bEndAtTxtEnd = lcl_IsAtTxtEnd( rFtn );
}
else
{
- pFtnEnd = rWW8Wrt.pFtn;
nTyp = REF_FOOTNOTE;
- if( rWW8Wrt.bFtnAtTxtEnd )
- rWW8Wrt.bFtnAtTxtEnd = lcl_IsAtTxtEnd( rFtn );
+ if ( GetExport().bFtnAtTxtEnd )
+ GetExport().bFtnAtTxtEnd = lcl_IsAtTxtEnd( rFtn );
}
// if any reference to this footnote/endnote then insert an internal
// Bookmark.
String sBkmkNm;
- if( rWW8Wrt.HasRefToObject( nTyp, 0, rFtn.GetTxtFtn()->GetSeqRefNo() ))
+ if ( GetExport().HasRefToObject( nTyp, 0, rFtn.GetTxtFtn()->GetSeqRefNo() ))
{
- sBkmkNm = rWW8Wrt.GetBookmarkName( nTyp, 0,
+ sBkmkNm = GetExport().GetBookmarkName( nTyp, 0,
rFtn.GetTxtFtn()->GetSeqRefNo() );
- rWW8Wrt.AppendBookmark( sBkmkNm );
+ GetExport().AppendBookmark( sBkmkNm );
}
+ TextFootnote_Impl( rFtn );
- pFtnEnd->Append( rWW8Wrt.Fc2Cp( rWrt.Strm().Tell() ), rFtn );
- rWW8Wrt.WriteFtnBegin( rFtn, rWW8Wrt.pO );
+ if ( sBkmkNm.Len() )
+ GetExport().AppendBookmark( sBkmkNm ); // FIXME: Why is it added twice? Shouldn't this one go to WW8AttributeOuput::TextFootnote_Impl()?
+}
- if( sBkmkNm.Len() )
- rWW8Wrt.AppendBookmark( sBkmkNm );
+void WW8AttributeOutput::TextFootnote_Impl( const SwFmtFtn& rFtn )
+{
+ WW8_WrPlcFtnEdn* pFtnEnd;
+ if ( rFtn.IsEndNote() )
+ pFtnEnd = m_rWW8Export.pEdn;
+ else
+ pFtnEnd = m_rWW8Export.pFtn;
- return rWrt;
+ pFtnEnd->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), rFtn );
+ m_rWW8Export.WriteFtnBegin( rFtn, m_rWW8Export.pO );
}
-static Writer& OutWW8_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::TextCharFormat( const SwFmtCharFmt& rCharFmt )
{
- const SwFmtCharFmt& rAttr = (const SwFmtCharFmt&)rHt;
- if( rAttr.GetCharFmt() )
+ if( rCharFmt.GetCharFmt() )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x4A30 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CIstd );
else
- rWrtWW8.pO->Insert( 80, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( 80, m_rWW8Export.pO->Count() );
- rWrtWW8.InsUInt16( rWrtWW8.GetId( *rAttr.GetCharFmt() ) );
+ m_rWW8Export.InsUInt16( m_rWW8Export.GetId( *rCharFmt.GetCharFmt() ) );
}
- return rWrt;
}
/*
See ww8par6.cxx Read_DoubleLine for some more info
*/
-static Writer& OutWW8_SvxTwoLinesItem( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::CharTwoLines( const SvxTwoLinesItem& rTwoLines )
{
// #i28331# - check that bOn is set
- if((static_cast<const SvxTwoLinesItem&>(rHt)).GetValue())
+ if ( rTwoLines.GetValue() )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
//97+ only
- if( !rWrtWW8.bWrtWW8 )
- return rWrt;
+ if( !m_rWW8Export.bWrtWW8 )
+ return;
- const SvxTwoLinesItem& rAttr = (const SvxTwoLinesItem&)rHt;
- rWrtWW8.InsUInt16( 0xCA78 );
- rWrtWW8.pO->Insert( (BYTE)0x06, rWrtWW8.pO->Count() ); //len 6
- rWrtWW8.pO->Insert( (BYTE)0x02, rWrtWW8.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_CEastAsianLayout );
+ m_rWW8Export.pO->Insert( (BYTE)0x06, m_rWW8Export.pO->Count() ); //len 6
+ m_rWW8Export.pO->Insert( (BYTE)0x02, m_rWW8Export.pO->Count() );
- sal_Unicode cStart = rAttr.GetStartBracket();
- sal_Unicode cEnd = rAttr.GetStartBracket();
+ sal_Unicode cStart = rTwoLines.GetStartBracket();
+ sal_Unicode cEnd = rTwoLines.GetStartBracket();
/*
As per usual we have problems. We can have seperate left and right brackets
@@ -3281,43 +3359,39 @@ static Writer& OutWW8_SvxTwoLinesItem( Writer& rWrt, const SfxPoolItem& rHt )
nType = 2;
else
nType = 1;
- rWrtWW8.InsUInt16( nType );
+ m_rWW8Export.InsUInt16( nType );
static const BYTE aZeroArr[ 3 ] = { 0, 0, 0 };
- rWrtWW8.pO->Insert( aZeroArr, 3, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( aZeroArr, 3, m_rWW8Export.pO->Count() );
}
- return rWrt;
}
-static Writer& OutWW8_SwNumRuleItem( Writer& rWrt, const SfxPoolItem& rHt )
+void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- const SwNumRuleItem& rNumRule = (const SwNumRuleItem&)rHt;
-
const SwTxtNode* pTxtNd = 0;
USHORT nNumId;
BYTE nLvl = 0;
- if( rNumRule.GetValue().Len() )
+ if ( rNumRule.GetValue().Len() )
{
- const SwNumRule* pRule = rWrt.pDoc->FindNumRulePtr(
+ const SwNumRule* pRule = GetExport().pDoc->FindNumRulePtr(
rNumRule.GetValue() );
- if( pRule && USHRT_MAX != ( nNumId = rWW8Wrt.GetId( *pRule )) )
+ if ( pRule && USHRT_MAX != ( nNumId = GetExport().GetId( *pRule ) ) )
{
++nNumId;
- if( rWW8Wrt.pOutFmtNode )
+ if ( GetExport().pOutFmtNode )
{
- if( rWW8Wrt.pOutFmtNode->ISA( SwCntntNode ))
+ if ( GetExport().pOutFmtNode->ISA( SwCntntNode ) )
{
- pTxtNd = (SwTxtNode*)rWW8Wrt.pOutFmtNode;
+ pTxtNd = (SwTxtNode*)GetExport().pOutFmtNode;
if( pTxtNd->IsCountedInList())
{
nLvl = static_cast< BYTE >(pTxtNd->GetActualListLevel());
- if (pTxtNd->IsListRestart())
+ if ( pTxtNd->IsListRestart() )
{
- USHORT nStartWith = static_cast< USHORT >(pTxtNd->GetActualListStartValue());
- nNumId = rWW8Wrt.DupNumRuleWithLvlStart(pRule,nLvl,nStartWith);
- if (USHRT_MAX != nNumId)
+ USHORT nStartWith = static_cast< USHORT >( pTxtNd->GetActualListStartValue() );
+ nNumId = GetExport().DuplicateNumRule( pRule, nLvl, nStartWith );
+ if ( USHRT_MAX != nNumId )
++nNumId;
}
}
@@ -3330,13 +3404,11 @@ static Writer& OutWW8_SwNumRuleItem( Writer& rWrt, const SfxPoolItem& rHt )
nNumId = 0;
}
}
- else if( rWW8Wrt.pOutFmtNode->ISA( SwTxtFmtColl ))
+ else if ( GetExport().pOutFmtNode->ISA( SwTxtFmtColl ) )
{
- const SwTxtFmtColl* pC = (SwTxtFmtColl*)rWW8Wrt.pOutFmtNode;
- //if( pC && MAXLEVEL > pC->GetOutlineLevel() ) //#outline level,removed by zhaojianwei
- // nLvl = pC->GetOutlineLevel(); //<-end, ->add by zhaojianwei
- if( pC && pC->IsAssignedToListLevelOfOutlineStyle() )
- nLvl = static_cast<BYTE>(pC->GetAssignedOutlineStyleLevel()); //<-end,zhaojianwei
+ const SwTxtFmtColl* pC = (SwTxtFmtColl*)GetExport().pOutFmtNode;
+ if ( pC && pC->IsAssignedToListLevelOfOutlineStyle() )
+ nLvl = static_cast< BYTE >( pC->GetAssignedOutlineStyleLevel() ); //<-end,zhaojianwei
}
}
}
@@ -3346,94 +3418,95 @@ static Writer& OutWW8_SwNumRuleItem( Writer& rWrt, const SfxPoolItem& rHt )
else
nNumId = 0;
- if (USHRT_MAX != nNumId)
+ if ( USHRT_MAX != nNumId )
{
- if (nLvl >= WW8ListManager::nMaxLevel)
- nLvl = WW8ListManager::nMaxLevel-1;
- if( rWW8Wrt.bWrtWW8 )
- {
- // write sprmPIlvl and sprmPIlfo
- SwWW8Writer::InsUInt16( *rWW8Wrt.pO, 0x260a );
- rWW8Wrt.pO->Insert( nLvl, rWW8Wrt.pO->Count() );
- SwWW8Writer::InsUInt16( *rWW8Wrt.pO, 0x460b );
- SwWW8Writer::InsUInt16( *rWW8Wrt.pO, nNumId );
- }
- else if( pTxtNd && rWW8Wrt.Out_SwNum( pTxtNd ) ) // NumRules
- rWW8Wrt.pSepx->SetNum( pTxtNd );
+ if ( nLvl >= WW8ListManager::nMaxLevel )
+ nLvl = WW8ListManager::nMaxLevel - 1;
+
+ ParaNumRule_Impl( pTxtNd, nLvl, nNumId );
+ }
+}
+
+void WW8AttributeOutput::ParaNumRule_Impl( const SwTxtNode* pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId )
+{
+ if ( m_rWW8Export.bWrtWW8 )
+ {
+ // write sprmPIlvl and sprmPIlfo
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlvl );
+ m_rWW8Export.pO->Insert( ::sal::static_int_cast<BYTE>(nLvl), m_rWW8Export.pO->Count() );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlfo );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, ::sal::static_int_cast<UINT16>(nNumId) );
}
- return rWrt;
+ else if ( pTxtNd && m_rWW8Export.Out_SwNum( pTxtNd ) ) // NumRules
+ m_rWW8Export.pSepx->SetNum( pTxtNd );
}
/* File FRMATR.HXX */
-static Writer& OutWW8_SwFrmSize( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- const SwFmtFrmSize& rSz = (const SwFmtFrmSize&)rHt;
-
- if( rWW8Wrt.bOutFlyFrmAttrs ) // Flys
+ if( m_rWW8Export.bOutFlyFrmAttrs ) // Flys
{
- if( rWW8Wrt.bOutGrf )
- return rWrt; // Fly um Grafik -> Auto-Groesse
+ if( m_rWW8Export.bOutGrf )
+ return; // Fly um Grafik -> Auto-Groesse
//???? was ist bei Prozentangaben ???
- if( rSz.GetWidth() && rSz.GetWidthSizeType() == ATT_FIX_SIZE)
+ if ( rSize.GetWidth() && rSize.GetWidthSizeType() == ATT_FIX_SIZE)
{
//"sprmPDxaWidth"
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x841A );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDxaWidth );
else
- rWW8Wrt.pO->Insert( 28, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( (USHORT)rSz.GetWidth() );
+ m_rWW8Export.pO->Insert( 28, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( (USHORT)rSize.GetWidth() );
}
- if( rSz.GetHeight() )
+ if ( rSize.GetHeight() )
{
// sprmPWHeightAbs
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x442B );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PWHeightAbs );
else
- rWW8Wrt.pO->Insert( 45, rWW8Wrt.pO->Count() );
+ m_rWW8Export.pO->Insert( 45, m_rWW8Export.pO->Count() );
USHORT nH = 0;
- switch( rSz.GetHeightSizeType() )
+ switch ( rSize.GetHeightSizeType() )
{
- case ATT_VAR_SIZE: break;
- case ATT_FIX_SIZE: nH = (USHORT)rSz.GetHeight() & 0x7fff; break;
- default: nH = (USHORT)rSz.GetHeight() | 0x8000; break;
+ case ATT_VAR_SIZE: break;
+ case ATT_FIX_SIZE: nH = (USHORT)rSize.GetHeight() & 0x7fff; break;
+ default: nH = (USHORT)rSize.GetHeight() | 0x8000; break;
}
- rWW8Wrt.InsUInt16( nH );
+ m_rWW8Export.InsUInt16( nH );
}
}
- else if( rWW8Wrt.bOutPageDescs ) // PageDesc : Breite + Hoehe
+ else if( m_rWW8Export.bOutPageDescs ) // PageDesc : Breite + Hoehe
{
- if( rWW8Wrt.pAktPageDesc->GetLandscape() )
+ if( m_rWW8Export.pAktPageDesc->GetLandscape() )
{
/*sprmSBOrientation*/
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x301d );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SBOrientation );
else
- rWW8Wrt.pO->Insert( 162, rWW8Wrt.pO->Count() );
- rWW8Wrt.pO->Insert( 2, rWW8Wrt.pO->Count() );
+ m_rWW8Export.pO->Insert( 162, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( 2, m_rWW8Export.pO->Count() );
}
/*sprmSXaPage*/
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0xB01F );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SXaPage );
else
- rWW8Wrt.pO->Insert( 164, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16(
- msword_cast<sal_uInt16>(SvxPaperInfo::GetSloppyPaperDimension(rSz.GetWidth())));
+ m_rWW8Export.pO->Insert( 164, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16(
+ msword_cast<sal_uInt16>(SvxPaperInfo::GetSloppyPaperDimension(rSize.GetWidth())));
/*sprmSYaPage*/
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0xB020 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SYaPage );
else
- rWW8Wrt.pO->Insert( 165, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16(
- msword_cast<sal_uInt16>(SvxPaperInfo::GetSloppyPaperDimension(rSz.GetHeight())));
+ m_rWW8Export.pO->Insert( 165, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16(
+ msword_cast<sal_uInt16>(SvxPaperInfo::GetSloppyPaperDimension(rSize.GetHeight())));
}
- return rWrt;
}
// FillOrder fehlt noch
@@ -3443,7 +3516,7 @@ static Writer& OutWW8_SwFrmSize( Writer& rWrt, const SfxPoolItem& rHt )
// direkt nach Schreiben des CR gerufen werden.
// Rueckgabe: FilePos des ersetzten CRs + 1 oder 0 fuer nicht ersetzt
-ULONG SwWW8Writer::ReplaceCr( BYTE nChar )
+ULONG WW8Export::ReplaceCr( BYTE nChar )
{
// Bug #49917#
ASSERT( nChar, "gegen 0 ersetzt bringt WW97/95 zum Absturz" );
@@ -3524,12 +3597,12 @@ ULONG SwWW8Writer::ReplaceCr( BYTE nChar )
return nRetPos;
}
-void SwWW8Writer::WriteRowEnd(sal_uInt32 nDepth)
+void WW8AttributeOutput::TableRowEnd(sal_uInt32 nDepth)
{
- if (nDepth == 1)
- WriteChar( (BYTE)0x07 );
- else if (nDepth > 1)
- WriteChar( (BYTE)0x0d );
+ if ( nDepth == 1 )
+ m_rWW8Export.WriteChar( (BYTE)0x07 );
+ else if ( nDepth > 1 )
+ m_rWW8Export.WriteChar( (BYTE)0x0d );
//Technically in a word document this is a different value for a row ends
//that are not row ends directly after a cell with a graphic. But it
@@ -3537,55 +3610,50 @@ void SwWW8Writer::WriteRowEnd(sal_uInt32 nDepth)
//pMagicTable->Append(Fc2Cp(Strm().Tell()),0x1B6);
}
-static Writer& OutWW8_SwFmtPageDesc(Writer& rWrt, const SfxPoolItem& rHt)
+void AttributeOutputBase::FormatPageDescription( const SwFmtPageDesc& rPageDesc )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- if (rWW8Wrt.bStyDef && rWW8Wrt.pOutFmtNode && rWW8Wrt.pOutFmtNode->ISA(SwTxtFmtColl))
+ if ( GetExport().bStyDef && GetExport().pOutFmtNode && GetExport().pOutFmtNode->ISA( SwTxtFmtColl ) )
{
- const SwFmtPageDesc &rPgDesc = (const SwFmtPageDesc&)rHt;
- const SwTxtFmtColl* pC = (SwTxtFmtColl*)rWW8Wrt.pOutFmtNode;
- if ((SFX_ITEM_SET != pC->GetItemState(RES_BREAK, false)) && rPgDesc.GetRegisteredIn())
- OutWW8_SwFmtBreak(rWrt, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK));
+ const SwTxtFmtColl* pC = (SwTxtFmtColl*)GetExport().pOutFmtNode;
+ if ( (SFX_ITEM_SET != pC->GetItemState( RES_BREAK, false ) ) && rPageDesc.GetRegisteredIn() )
+ FormatBreak( SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ) );
}
- return rWrt;
+}
+
+void WW8AttributeOutput::PageBreakBefore( bool bBreak )
+{
+ // sprmPPageBreakBefore/sprmPFPageBreakBefore
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFPageBreakBefore );
+ else
+ m_rWW8Export.pO->Insert( 9, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.pO->Insert( bBreak ? 1 : 0, m_rWW8Export.pO->Count() );
}
// Breaks schreiben nichts in das Ausgabe-Feld rWrt.pO,
// sondern nur in den Text-Stream ( Bedingung dafuer, dass sie von Out_Break...
// gerufen werden duerfen )
-static Writer& OutWW8_SwFmtBreak( Writer& rWrt, const SfxPoolItem& rHt )
+void AttributeOutputBase::FormatBreak( const SvxFmtBreakItem& rBreak )
{
-/*UMSTELLEN*/
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- const SvxFmtBreakItem &rBreak = (const SvxFmtBreakItem&)rHt;
-
- if( rWW8Wrt.bStyDef )
+ if ( GetExport().bStyDef )
{
- switch( rBreak.GetBreak() )
+ switch ( rBreak.GetBreak() )
{
-//JP 21.06.99: column breaks does never change to pagebreaks
-// case SVX_BREAK_COLUMN_BEFORE:
-// case SVX_BREAK_COLUMN_BOTH:
- case SVX_BREAK_NONE:
- case SVX_BREAK_PAGE_BEFORE:
- case SVX_BREAK_PAGE_BOTH:
- // sprmPPageBreakBefore/sprmPFPageBreakBefore
- if (rWW8Wrt.bWrtWW8)
- rWW8Wrt.InsUInt16(0x2407);
- else
- rWW8Wrt.pO->Insert(9, rWW8Wrt.pO->Count());
- rWW8Wrt.pO->Insert(rBreak.GetValue() ? 1 : 0,
- rWW8Wrt.pO->Count());
- break;
- default:
- break;
+ // JP 21.06.99: column breaks never change to pagebreaks
+ // case SVX_BREAK_COLUMN_BEFORE:
+ // case SVX_BREAK_COLUMN_BOTH:
+ case SVX_BREAK_NONE:
+ case SVX_BREAK_PAGE_BEFORE:
+ case SVX_BREAK_PAGE_BOTH:
+ PageBreakBefore( rBreak.GetValue() );
+ break;
+ default:
+ break;
}
}
- else if (!rWW8Wrt.mpParentFrame)
+ else if ( !GetExport().mpParentFrame )
{
- static const BYTE cColBreak = 0xe;
- static const BYTE cPageBreak = 0xc;
-
BYTE nC = 0;
bool bBefore = false;
// --> OD 2007-05-29 #i76300#
@@ -3593,95 +3661,83 @@ static Writer& OutWW8_SwFmtBreak( Writer& rWrt, const SfxPoolItem& rHt )
bool bCheckForFollowPageDesc = false;
// <--
- switch( rBreak.GetBreak() )
+ switch ( rBreak.GetBreak() )
{
- case SVX_BREAK_NONE: // Ausgeschaltet
- if( !rWW8Wrt.bBreakBefore )
- {
- // sprmPPageBreakBefore/sprmPFPageBreakBefore
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x2407 );
- else
- rWW8Wrt.pO->Insert( 9, rWW8Wrt.pO->Count() );
- rWW8Wrt.pO->Insert( (BYTE)0, rWW8Wrt.pO->Count() );
- }
- return rWrt;
+ case SVX_BREAK_NONE: // Ausgeschaltet
+ if ( !GetExport().bBreakBefore )
+ PageBreakBefore( false );
+ return;
- case SVX_BREAK_COLUMN_BEFORE: // ColumnBreak
- bBefore = true;
+ case SVX_BREAK_COLUMN_BEFORE: // ColumnBreak
+ bBefore = true;
// no break;
- case SVX_BREAK_COLUMN_AFTER:
- case SVX_BREAK_COLUMN_BOTH:
- ASSERT (rWW8Wrt.pSepx, "how come this is 0");
- if (rWW8Wrt.pSepx &&
- rWW8Wrt.pSepx->CurrentNoColumns(*rWW8Wrt.pDoc) > 1)
- {
- nC = cColBreak;
- }
- break;
+ case SVX_BREAK_COLUMN_AFTER:
+ case SVX_BREAK_COLUMN_BOTH:
+ if ( GetExport().Sections().CurrentNumberOfColumns( *GetExport().pDoc ) > 1 )
+ {
+ nC = msword::ColumnBreak;
+ }
+ break;
- case SVX_BREAK_PAGE_BEFORE: // PageBreak
- // From now on(fix for #i77900#) we prefer to save a page break as
- // paragraph attribute, this has to be done after the export of the
- // paragraph ( => !rWW8Wrt.bBreakBefore )
- if( !rWW8Wrt.bBreakBefore )
- {
- // sprmPPageBreakBefore/sprmPFPageBreakBefore
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x2407 );
- else
- rWW8Wrt.pO->Insert( 9, rWW8Wrt.pO->Count() );
- rWW8Wrt.pO->Insert( (BYTE)1, rWW8Wrt.pO->Count() );
- }
- break;
- case SVX_BREAK_PAGE_AFTER:
- case SVX_BREAK_PAGE_BOTH:
- nC = cPageBreak;
- // --> OD 2007-05-29 #i76300#
- // check for follow page description, if current writing attributes
- // of a paragraph.
- if ( dynamic_cast<const SwTxtNode*>(rWW8Wrt.pOutFmtNode) &&
- rWW8Wrt.GetCurItemSet() )
- {
- bCheckForFollowPageDesc = true;
- }
- // <--
- break;
- default:
- break;
+ case SVX_BREAK_PAGE_BEFORE: // PageBreak
+ // From now on(fix for #i77900#) we prefer to save a page break as
+ // paragraph attribute, this has to be done after the export of the
+ // paragraph ( => !GetExport().bBreakBefore )
+ if ( !GetExport().bBreakBefore )
+ PageBreakBefore( true );
+ break;
+
+ case SVX_BREAK_PAGE_AFTER:
+ case SVX_BREAK_PAGE_BOTH:
+ nC = msword::PageBreak;
+ // --> OD 2007-05-29 #i76300#
+ // check for follow page description, if current writing attributes
+ // of a paragraph.
+ if ( dynamic_cast< const SwTxtNode* >( GetExport().pOutFmtNode ) &&
+ GetExport().GetCurItemSet() )
+ {
+ bCheckForFollowPageDesc = true;
+ }
+ // <--
+ break;
+
+ default:
+ break;
}
- if ( (bBefore == rWW8Wrt.bBreakBefore ) && nC ) // #49917#
+ if ( ( bBefore == GetExport().bBreakBefore ) && nC ) // #49917#
{
// --> OD 2007-05-29 #i76300#
- bool bFollowPageDescWritten( false );
+ bool bFollowPageDescWritten = false;
if ( bCheckForFollowPageDesc && !bBefore )
{
bFollowPageDescWritten =
- rWW8Wrt.Out_FollowPageDesc( rWW8Wrt.GetCurItemSet(),
- dynamic_cast<const SwTxtNode*>(rWW8Wrt.pOutFmtNode) );
+ GetExport().OutputFollowPageDesc( GetExport().GetCurItemSet(),
+ dynamic_cast<const SwTxtNode*>( GetExport().pOutFmtNode ) );
}
if ( !bFollowPageDescWritten )
{
- rWW8Wrt.ReplaceCr( nC );
+ SectionBreak( nC );
}
// <--
}
}
- return rWrt;
}
-static Writer& OutWW8_SwTextGrid( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::SectionBreak( BYTE nC, const WW8_SepInfo* /*pSectionInfo*/ )
+{
+ m_rWW8Export.ReplaceCr( nC );
+}
+
+void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (rWrtWW8.bOutPageDescs && rWrtWW8.bWrtWW8)
+ if ( m_rWW8Export.bOutPageDescs && m_rWW8Export.bWrtWW8 )
{
- const SwTextGridItem& rItem = (const SwTextGridItem&)rHt;
- UINT16 nGridType=0;
- switch (rItem.GetGridType())
+ UINT16 nGridType = 0;
+ switch ( rGrid.GetGridType() )
{
default:
- ASSERT(!(&rWrt), "Unknown grid type");
+ ASSERT(false, "Unknown grid type");
case GRID_NONE:
nGridType = 0;
break;
@@ -3689,103 +3745,86 @@ static Writer& OutWW8_SwTextGrid( Writer& rWrt, const SfxPoolItem& rHt )
nGridType = 2;
break;
case GRID_LINES_CHARS:
- {
- if(rItem.IsSnapToChars())
- {
- nGridType = 3;
- }
- else
- {
- nGridType = 1;
- }
- }
+ if ( rGrid.IsSnapToChars() )
+ nGridType = 3;
+ else
+ nGridType = 1;
break;
}
- rWrtWW8.InsUInt16(0x5032);
- rWrtWW8.InsUInt16(nGridType);
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SClm );
+ m_rWW8Export.InsUInt16( nGridType );
- UINT16 nHeight = rItem.GetBaseHeight() + rItem.GetRubyHeight();
- rWrtWW8.InsUInt16(0x9031);
- rWrtWW8.InsUInt16(nHeight);
- sal_uInt32 nPageCharSize = ItemGet<SvxFontHeightItem>(*(rWrtWW8.pStyles->GetSwFmt()),
+ UINT16 nHeight = rGrid.GetBaseHeight() + rGrid.GetRubyHeight();
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaLinePitch );
+ m_rWW8Export.InsUInt16( nHeight );
+ sal_uInt32 nPageCharSize = ItemGet<SvxFontHeightItem>(*(m_rWW8Export.pStyles->GetSwFmt()),
RES_CHRATR_CJK_FONTSIZE).GetHeight();
- INT32 nCharWidth = rItem.GetBaseWidth() - nPageCharSize;
- INT32 nFraction = 0;
- nFraction = nCharWidth%20;
- if( nCharWidth < 0 )
+ INT32 nCharWidth = rGrid.GetBaseWidth() - nPageCharSize;
+ INT32 nFraction = 0;
+ nFraction = nCharWidth % 20;
+ if ( nCharWidth < 0 )
nFraction = 20 + nFraction;
- nFraction = ((nFraction)*0xFFF)/20;
- nFraction = (nFraction & 0x00000FFF);
+ nFraction = ( nFraction * 0xFFF ) / 20;
+ nFraction = ( nFraction & 0x00000FFF );
- INT32 nMain = 0;
- nMain = nCharWidth/20;
- if( nCharWidth < 0 )
+ INT32 nMain = 0;
+ nMain = nCharWidth / 20;
+ if ( nCharWidth < 0 )
nMain -= 1;
- nMain = nMain * 0x1000;
- nMain = (nMain & 0xFFFFF000);
+ nMain = nMain * 0x1000;
+ nMain = ( nMain & 0xFFFFF000 );
- UINT32 nCharSpace = nFraction + nMain;
- rWrtWW8.InsUInt16(0x7030);
- rWrtWW8.InsUInt32(nCharSpace);
+ UINT32 nCharSpace = nFraction + nMain;
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDxtCharSpace );
+ m_rWW8Export.InsUInt32( nCharSpace );
}
- return rWrt;
}
-static Writer& OutWW8_SvxPaperBin( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatPaperBin( const SvxPaperBinItem& rPaperBin )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- const SvxPaperBinItem& rItem = (const SvxPaperBinItem&)rHt;
-
- if( rWrtWW8.bOutPageDescs )
+ if ( m_rWW8Export.bOutPageDescs )
{
USHORT nVal;
- switch( rItem.GetValue() )
+ switch ( rPaperBin.GetValue() )
{
- case 0: nVal = 15; break; // Automatically select
- case 1: nVal = 1; break; // Upper paper tray
- case 2: nVal = 4; break; // Manual paper feed
- default: nVal = 0; break;
+ case 0: nVal = 15; break; // Automatically select
+ case 1: nVal = 1; break; // Upper paper tray
+ case 2: nVal = 4; break; // Manual paper feed
+ default: nVal = 0; break;
}
- if( nVal )
+ if ( nVal )
{
- // sprmSDmBinFirst 0x5007 word
- // sprmSDmBinOther 0x5008 word
- BYTE nOff = rWrtWW8.bOutFirstPage ? 0 : 1;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x5007 + nOff );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( m_rWW8Export.bOutFirstPage? NS_sprm::LN_SDmBinFirst: NS_sprm::LN_SDmBinOther );
else
- rWrtWW8.pO->Insert( 140 + nOff, rWrtWW8.pO->Count() );
- rWrtWW8.InsUInt16( nVal );
+ m_rWW8Export.pO->Insert( m_rWW8Export.bOutFirstPage? 140: 141, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( nVal );
}
}
- return rWrt;
}
-static Writer& OutWW8_SwFmtLRSpace( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLR )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- const SvxLRSpaceItem & rLR = (const SvxLRSpaceItem&) rHt;
-
-
// Flys fehlen noch ( siehe RTF )
- if( rWW8Wrt.bOutFlyFrmAttrs ) // Flys
+ if ( m_rWW8Export.bOutFlyFrmAttrs ) // Flys
{
// sprmPDxaFromText10
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x4622 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDxaFromText10 );
else
- rWW8Wrt.pO->Insert( 49, rWW8Wrt.pO->Count() );
+ m_rWW8Export.pO->Insert( 49, m_rWW8Export.pO->Count() );
// Mittelwert nehmen, da WW nur 1 Wert kennt
- rWW8Wrt.InsUInt16( (USHORT) ( ( rLR.GetLeft() + rLR.GetRight() ) / 2 ) );
+ m_rWW8Export.InsUInt16( (USHORT) ( ( rLR.GetLeft() + rLR.GetRight() ) / 2 ) );
}
- else if( rWW8Wrt.bOutPageDescs ) // PageDescs
+ else if ( m_rWW8Export.bOutPageDescs ) // PageDescs
{
USHORT nLDist, nRDist;
- const SfxPoolItem* pItem = ((SwWW8Writer&)rWrt).HasItem( RES_BOX );
- if( pItem )
+ const SfxPoolItem* pItem = m_rWW8Export.HasItem( RES_BOX );
+ if ( pItem )
{
nRDist = ((SvxBoxItem*)pItem)->CalcLineSpace( BOX_LINE_LEFT );
nLDist = ((SvxBoxItem*)pItem)->CalcLineSpace( BOX_LINE_RIGHT );
@@ -3796,249 +3835,235 @@ static Writer& OutWW8_SwFmtLRSpace( Writer& rWrt, const SfxPoolItem& rHt )
nRDist = nRDist + (USHORT)rLR.GetRight();
// sprmSDxaLeft
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0xB021 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDxaLeft );
else
- rWW8Wrt.pO->Insert( 166, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( nLDist );
+ m_rWW8Export.pO->Insert( 166, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( nLDist );
+
// sprmSDxaRight
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0xB022 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDxaRight );
else
- rWW8Wrt.pO->Insert( 167, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( nRDist );
+ m_rWW8Export.pO->Insert( 167, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( nRDist );
}
else
{ // normale Absaetze
// sprmPDxaLeft
- if( rWW8Wrt.bWrtWW8 )
+ if( m_rWW8Export.bWrtWW8 )
{
- rWW8Wrt.InsUInt16( 0x845E ); //asian version ?
- rWW8Wrt.InsUInt16( (USHORT)rLR.GetTxtLeft() );
-
+ m_rWW8Export.InsUInt16( 0x845E ); //asian version ?
+ m_rWW8Export.InsUInt16( (USHORT)rLR.GetTxtLeft() );
}
else
{
- rWW8Wrt.pO->Insert( 17, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( (USHORT)rLR.GetTxtLeft() );
+ m_rWW8Export.pO->Insert( 17, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( (USHORT)rLR.GetTxtLeft() );
}
+
// sprmPDxaRight
- if( rWW8Wrt.bWrtWW8 )
+ if( m_rWW8Export.bWrtWW8 )
{
- rWW8Wrt.InsUInt16( 0x845D ); //asian version ?
- rWW8Wrt.InsUInt16( (USHORT)rLR.GetRight() );
+ m_rWW8Export.InsUInt16( 0x845D ); //asian version ?
+ m_rWW8Export.InsUInt16( (USHORT)rLR.GetRight() );
}
else
{
- rWW8Wrt.pO->Insert( 16, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( (USHORT)rLR.GetRight() );
+ m_rWW8Export.pO->Insert( 16, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( (USHORT)rLR.GetRight() );
}
+
// sprmPDxaLeft1
- if( rWW8Wrt.bWrtWW8 )
+ if( m_rWW8Export.bWrtWW8 )
{
- rWW8Wrt.InsUInt16( 0x8460 ); //asian version ?
- rWW8Wrt.InsUInt16( rLR.GetTxtFirstLineOfst() );
+ m_rWW8Export.InsUInt16( 0x8460 ); //asian version ?
+ m_rWW8Export.InsUInt16( rLR.GetTxtFirstLineOfst() );
}
else
{
- rWW8Wrt.pO->Insert( 19, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( rLR.GetTxtFirstLineOfst() );
+ m_rWW8Export.pO->Insert( 19, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( rLR.GetTxtFirstLineOfst() );
}
}
- return rWrt;
}
-static Writer& OutWW8_SwFmtULSpace( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatULSpace( const SvxULSpaceItem& rUL )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- const SvxULSpaceItem & rUL = (const SvxULSpaceItem&) rHt;
-
// Flys fehlen noch ( siehe RTF )
- if( rWW8Wrt.bOutFlyFrmAttrs ) // Flys
+ if ( m_rWW8Export.bOutFlyFrmAttrs ) // Flys
{
// sprmPDyaFromText
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x842E );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDyaFromText );
else
- rWW8Wrt.pO->Insert( 48, rWW8Wrt.pO->Count() );
+ m_rWW8Export.pO->Insert( 48, m_rWW8Export.pO->Count() );
// Mittelwert nehmen, da WW nur 1 Wert kennt
- rWW8Wrt.InsUInt16( (USHORT) ( ( rUL.GetUpper() + rUL.GetLower() ) / 2 ) );
+ m_rWW8Export.InsUInt16( (USHORT) ( ( rUL.GetUpper() + rUL.GetLower() ) / 2 ) );
}
- else if( rWW8Wrt.bOutPageDescs ) // Page-UL
+ else if ( m_rWW8Export.bOutPageDescs ) // Page-UL
{
- ASSERT(rWW8Wrt.GetCurItemSet(), "Impossible");
- if (!rWW8Wrt.GetCurItemSet())
- return rWrt;
+ ASSERT( m_rWW8Export.GetCurItemSet(), "Impossible" );
+ if ( !m_rWW8Export.GetCurItemSet() )
+ return;
- HdFtDistanceGlue aDistances(*rWW8Wrt.GetCurItemSet());
+ HdFtDistanceGlue aDistances( *m_rWW8Export.GetCurItemSet() );
- if (aDistances.HasHeader())
+ if ( aDistances.HasHeader() )
{
//sprmSDyaHdrTop
- if (rWW8Wrt.bWrtWW8)
- rWW8Wrt.InsUInt16(0xB017);
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaHdrTop );
else
- rWW8Wrt.pO->Insert(156, rWW8Wrt.pO->Count());
- rWW8Wrt.InsUInt16(aDistances.dyaHdrTop);
+ m_rWW8Export.pO->Insert( 156, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( aDistances.dyaHdrTop );
}
// sprmSDyaTop
- if (rWW8Wrt.bWrtWW8)
- rWW8Wrt.InsUInt16(0x9023);
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaTop );
else
- rWW8Wrt.pO->Insert(168, rWW8Wrt.pO->Count());
- rWW8Wrt.InsUInt16(aDistances.dyaTop);
+ m_rWW8Export.pO->Insert( 168, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( aDistances.dyaTop );
- if (aDistances.HasFooter())
+ if ( aDistances.HasFooter() )
{
//sprmSDyaHdrBottom
- if (rWW8Wrt.bWrtWW8)
- rWW8Wrt.InsUInt16(0xB018);
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaHdrBottom );
else
- rWW8Wrt.pO->Insert(157, rWW8Wrt.pO->Count());
- rWW8Wrt.InsUInt16(aDistances.dyaHdrBottom);
+ m_rWW8Export.pO->Insert( 157, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( aDistances.dyaHdrBottom );
}
//sprmSDyaBottom
- if (rWW8Wrt.bWrtWW8)
- rWW8Wrt.InsUInt16(0x9024);
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaBottom );
else
- rWW8Wrt.pO->Insert(169, rWW8Wrt.pO->Count());
- rWW8Wrt.InsUInt16(aDistances.dyaBottom);
+ m_rWW8Export.pO->Insert( 169, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( aDistances.dyaBottom );
}
else
{
// sprmPDyaBefore
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0xA413 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDyaBefore );
else
- rWW8Wrt.pO->Insert( 21, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( rUL.GetUpper() );
+ m_rWW8Export.pO->Insert( 21, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( rUL.GetUpper() );
// sprmPDyaAfter
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0xA414 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDyaAfter );
else
- rWW8Wrt.pO->Insert( 22, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( rUL.GetLower() );
+ m_rWW8Export.pO->Insert( 22, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( rUL.GetLower() );
}
- return rWrt;
}
// Print, Opaque, Protect fehlen noch
-static Writer& OutWW8_SwFmtSurround( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatSurround( const SwFmtSurround& rSurround )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- if( rWW8Wrt.bOutFlyFrmAttrs )
+ if ( m_rWW8Export.bOutFlyFrmAttrs )
{
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x2423 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PWr );
else
- rWW8Wrt.pO->Insert( 37, rWW8Wrt.pO->Count() );
+ m_rWW8Export.pO->Insert( 37, m_rWW8Export.pO->Count() );
- rWW8Wrt.pO->Insert( (SURROUND_NONE !=
- ((const SwFmtSurround&) rHt).GetSurround() )
- ? 2 : 1, rWW8Wrt.pO->Count() );
+ m_rWW8Export.pO->Insert(
+ ( SURROUND_NONE != rSurround.GetSurround() ) ? 2 : 1,
+ m_rWW8Export.pO->Count() );
}
- return rWrt;
}
-Writer& OutWW8_SwFmtVertOrient( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
-
//!!!! Ankertyp und entsprechende Umrechnung fehlt noch
- if( rWW8Wrt.bOutFlyFrmAttrs )
+ if ( m_rWW8Export.bOutFlyFrmAttrs )
{
- const SwFmtVertOrient& rFlyVert = (const SwFmtVertOrient&) rHt;
-
short nPos;
switch( rFlyVert.GetVertOrient() )
{
- case text::VertOrientation::NONE:
- nPos = (short)rFlyVert.GetPos();
- break;
- case text::VertOrientation::CENTER:
- case text::VertOrientation::LINE_CENTER:
- nPos = -8;
- break;
- case text::VertOrientation::BOTTOM:
- case text::VertOrientation::LINE_BOTTOM:
- nPos = -12;
- break;
- case text::VertOrientation::TOP:
- case text::VertOrientation::LINE_TOP:
- default:
- nPos = -4;
- break;
+ case text::VertOrientation::NONE:
+ nPos = (short)rFlyVert.GetPos();
+ break;
+ case text::VertOrientation::CENTER:
+ case text::VertOrientation::LINE_CENTER:
+ nPos = -8;
+ break;
+ case text::VertOrientation::BOTTOM:
+ case text::VertOrientation::LINE_BOTTOM:
+ nPos = -12;
+ break;
+ case text::VertOrientation::TOP:
+ case text::VertOrientation::LINE_TOP:
+ default:
+ nPos = -4;
+ break;
}
// sprmPDyaAbs
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x8419 );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDyaAbs );
else
- rWW8Wrt.pO->Insert( 27, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( nPos );
+ m_rWW8Export.pO->Insert( 27, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( nPos );
}
- return rWrt;
}
-Writer& OutWW8_SwFmtHoriOrient( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- if (!rWW8Wrt.mpParentFrame)
+ if ( !m_rWW8Export.mpParentFrame )
{
- ASSERT(rWW8Wrt.mpParentFrame, "HoriOrient without mpParentFrame !!");
- return rWrt;
+ ASSERT( m_rWW8Export.mpParentFrame, "HoriOrient without mpParentFrame !!" );
+ return;
}
//!!!! Ankertyp und entsprechende Umrechnung fehlt noch
- if( rWW8Wrt.bOutFlyFrmAttrs )
+ if ( m_rWW8Export.bOutFlyFrmAttrs )
{
- const SwFmtHoriOrient& rFlyHori = (const SwFmtHoriOrient&) rHt;
-
short nPos;
switch( rFlyHori.GetHoriOrient() )
{
- case text::HoriOrientation::NONE: {
- nPos = (short)rFlyHori.GetPos();
- if( !nPos )
- nPos = 1; // WW: 0 ist reserviert
- }
- break;
-
- case text::HoriOrientation::LEFT: nPos = rFlyHori.IsPosToggle() ? -12 : 0;
- break;
- case text::HoriOrientation::RIGHT: nPos = rFlyHori.IsPosToggle() ? -16 : -8;
- break;
- case text::HoriOrientation::CENTER:
- case text::HoriOrientation::FULL: // FULL nur fuer Tabellen
- default: nPos = -4; break;
+ case text::HoriOrientation::NONE:
+ nPos = (short)rFlyHori.GetPos();
+ if( !nPos )
+ nPos = 1; // WW: 0 ist reserviert
+ break;
+ case text::HoriOrientation::LEFT:
+ nPos = rFlyHori.IsPosToggle() ? -12 : 0;
+ break;
+ case text::HoriOrientation::RIGHT:
+ nPos = rFlyHori.IsPosToggle() ? -16 : -8;
+ break;
+ case text::HoriOrientation::CENTER:
+ case text::HoriOrientation::FULL: // FULL nur fuer Tabellen
+ default:
+ nPos = -4;
+ break;
}
// sprmPDxaAbs
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x8418 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDxaAbs );
else
- rWW8Wrt.pO->Insert( 26, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( nPos );
+ m_rWW8Export.pO->Insert( 26, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt16( nPos );
}
- return rWrt;
}
-static Writer& OutWW8_SwFmtAnchor( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatAnchor( const SwFmtAnchor& rAnchor )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- ASSERT(rWW8Wrt.mpParentFrame, "Anchor without mpParentFrame !!");
+ ASSERT( m_rWW8Export.mpParentFrame, "Anchor without mpParentFrame !!" );
- if( rWW8Wrt.bOutFlyFrmAttrs )
+ if ( m_rWW8Export.bOutFlyFrmAttrs )
{
- const SwFmtAnchor& rAnchor = (const SwFmtAnchor&) rHt;
BYTE nP = 0;
- switch( rAnchor.GetAnchorId() )
+ switch ( rAnchor.GetAnchorId() )
{
case FLY_PAGE:
// Vert: Page | Horz: Page
@@ -4057,48 +4082,43 @@ static Writer& OutWW8_SwFmtAnchor( Writer& rWrt, const SfxPoolItem& rHt )
}
// sprmPPc
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x261B );
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PPc );
else
- rWW8Wrt.pO->Insert( 29, rWW8Wrt.pO->Count() );
- rWW8Wrt.pO->Insert( nP, rWW8Wrt.pO->Count() );
+ m_rWW8Export.pO->Insert( 29, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( nP, m_rWW8Export.pO->Count() );
}
- return rWrt;
}
-static Writer& OutWW8_SwFmtBackground( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
-
- if( !rWW8Wrt.bOutPageDescs ) // WW kann keinen Hintergrund
- { // in Section
- const SvxBrushItem& rBack = (const SvxBrushItem&)rHt;
+ // WW cannot have background in a section
+ if ( !m_rWW8Export.bOutPageDescs )
+ {
WW8_SHD aSHD;
- rWW8Wrt.TransBrush(rBack.GetColor(), aSHD);
+ m_rWW8Export.TransBrush( rBrush.GetColor(), aSHD );
// sprmPShd
- if (rWW8Wrt.bWrtWW8)
- rWW8Wrt.InsUInt16(0x442D);
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PShd );
else
- rWW8Wrt.pO->Insert(47, rWW8Wrt.pO->Count());
- rWW8Wrt.InsUInt16( aSHD.GetValue() );
+ m_rWW8Export.pO->Insert(47, m_rWW8Export.pO->Count());
+ m_rWW8Export.InsUInt16( aSHD.GetValue() );
- //Quite a few unknowns, some might be transparency or something
- //of that nature...
- if (rWW8Wrt.bWrtWW8)
+ // Quite a few unknowns, some might be transparency or something
+ // of that nature...
+ if ( m_rWW8Export.bWrtWW8 )
{
- rWW8Wrt.InsUInt16(0xC64D);
- rWW8Wrt.pO->Insert(10, rWW8Wrt.pO->Count());
- rWW8Wrt.InsUInt32(0xFF000000);
- rWW8Wrt.InsUInt32(SuitableBGColor(
- rBack.GetColor().GetColor()));
- rWW8Wrt.InsUInt16(0x0000);
+ m_rWW8Export.InsUInt16( 0xC64D );
+ m_rWW8Export.pO->Insert( 10, m_rWW8Export.pO->Count() );
+ m_rWW8Export.InsUInt32( 0xFF000000 );
+ m_rWW8Export.InsUInt32( SuitableBGColor( rBrush.GetColor().GetColor() ) );
+ m_rWW8Export.InsUInt16( 0x0000 );
}
}
- return rWrt;
}
-WW8_BRC SwWW8Writer::TranslateBorderLine(const SvxBorderLine& rLine,
+WW8_BRC WW8Export::TranslateBorderLine(const SvxBorderLine& rLine,
USHORT nDist, bool bShadow)
{
// M.M. This function writes out border lines to the word format similar to
@@ -4181,12 +4201,14 @@ WW8_BRC SwWW8Writer::TranslateBorderLine(const SvxBorderLine& rLine,
// auch fuer die Tabellen-Umrandungen zu benutzen.
// Wenn nSprmNo == 0, dann wird der Opcode nicht ausgegeben.
// bShadow darf bei Tabellenzellen *nicht* gesetzt sein !
-void SwWW8Writer::Out_BorderLine(WW8Bytes& rO, const SvxBorderLine* pLine,
- USHORT nDist, USHORT nOffset, bool bShadow)
+void WW8Export::Out_BorderLine(WW8Bytes& rO, const SvxBorderLine* pLine,
+ USHORT nDist, sal_uInt16 nSprmNo, bool bShadow)
{
- ASSERT( (nOffset <= 3) || USHRT_MAX == nOffset ||
- ((0x702b - 0x6424) <= nOffset && nOffset <= (0x702e - 0x6424)),
- "SprmOffset ausserhalb des Bereichs" );
+ ASSERT( ( nSprmNo == 0 ) ||
+ ( nSprmNo >= 38 && nSprmNo <= 41 ) ||
+ ( nSprmNo >= NS_sprm::LN_PBrcTop && nSprmNo <= NS_sprm::LN_PBrcRight ) ||
+ ( nSprmNo >= NS_sprm::LN_SBrcTop && nSprmNo <= NS_sprm::LN_SBrcRight ),
+ "Sprm for border out is of range" );
WW8_BRC aBrc;
@@ -4195,68 +4217,70 @@ void SwWW8Writer::Out_BorderLine(WW8Bytes& rO, const SvxBorderLine* pLine,
if( bWrtWW8 )
{
-// WW97-SprmIds
-// 0x6424, sprmPBrcTop pap.brcTop;BRC;long; !!!!
-// 0x6425, sprmPBrcLeft
-// 0x6426, sprmPBrcBottom
-// 0x6427, sprmPBrcRight
- if( USHRT_MAX != nOffset ) // mit OpCode-Ausgabe ?
- SwWW8Writer::InsUInt16( rO, 0x6424 + nOffset );
+ // WW97-SprmIds
+ if ( nSprmNo != 0 )
+ SwWW8Writer::InsUInt16( rO, nSprmNo );
rO.Insert( aBrc.aBits1, 2, rO.Count() );
rO.Insert( aBrc.aBits2, 2, rO.Count() );
}
else
{
-// WW95-SprmIds
-// 38, sprmPBrcTop - pap.brcTop BRC short !!!
-// 39, sprmPBrcLeft
-// 40, sprmPBrcBottom
-// 41, sprmPBrcRight
- if( USHRT_MAX != nOffset ) // mit OpCode-Ausgabe ?
- rO.Insert( (BYTE)( 38 + nOffset ), rO.Count() );
+ // WW95-SprmIds
+ if ( nSprmNo != 0 )
+ rO.Insert( (BYTE)( nSprmNo ), rO.Count() );
rO.Insert( aBrc.aBits1, 2, rO.Count() );
}
}
-// OutWW8_SwFmtBox1() ist fuer alle Boxen ausser in Tabellen.
+// FormatBox1() ist fuer alle Boxen ausser in Tabellen.
// es wird pO des WW8Writers genommen
-void SwWW8Writer::Out_SwFmtBox(const SvxBoxItem& rBox, bool bShadow)
+void WW8Export::Out_SwFmtBox(const SvxBoxItem& rBox, bool bShadow)
{
- USHORT nOffset = 0;
- if( bOutPageDescs )
- {
- if( !bWrtWW8 )
- return ; // WW95 kennt keine Seitenumrandung
-
-// WW97-SprmIds
-// 0x702b, sprmSBrcTop pap.brcTop;BRC;long; !!!!
-// 0x702c, sprmSBrcLeft
-// 0x702d, sprmSBrcBottom
-// 0x702e, sprmSBrcRight
- nOffset = (0x702b - 0x6424);
- }
+ if ( bOutPageDescs && !bWrtWW8 )
+ return; // no page ouline in WW6
static const USHORT aBorders[] =
{
BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT
};
+ static const sal_uInt16 aPBrc[] =
+ {
+ NS_sprm::LN_PBrcTop, NS_sprm::LN_PBrcLeft, NS_sprm::LN_PBrcBottom, NS_sprm::LN_PBrcRight
+ };
+ static const sal_uInt16 aSBrc[] =
+ {
+ NS_sprm::LN_SBrcTop, NS_sprm::LN_SBrcLeft, NS_sprm::LN_SBrcBottom, NS_sprm::LN_SBrcRight
+ };
+ static const sal_uInt16 aWW6PBrc[] =
+ {
+ 38, 39, 40, 41
+ };
+
const USHORT* pBrd = aBorders;
for( USHORT i = 0; i < 4; ++i, ++pBrd )
{
const SvxBorderLine* pLn = rBox.GetLine( *pBrd );
- Out_BorderLine( *pO, pLn, rBox.GetDistance( *pBrd ), nOffset+i,
- bShadow );
+
+ sal_uInt16 nSprmNo = 0;
+ if ( !bWrtWW8 )
+ nSprmNo = aWW6PBrc[i];
+ else if ( bOutPageDescs )
+ nSprmNo = aSBrc[i];
+ else
+ nSprmNo = aPBrc[i];
+
+ Out_BorderLine( *pO, pLn, rBox.GetDistance( *pBrd ), nSprmNo, bShadow );
}
}
-// OutWW8_SwFmtBox2() ist fuer TC-Strukturen in Tabellen. Der Sprm-Opcode
+// FormatBox2() ist fuer TC-Strukturen in Tabellen. Der Sprm-Opcode
// wird nicht geschrieben, da es in der TC-Structur ohne Opcode gepackt ist.
// dxpSpace wird immer 0, da WW das in Tabellen so verlangt
// ( Tabellenumrandungen fransen sonst aus )
// Ein WW8Bytes-Ptr wird als Ausgabe-Parameter uebergeben
-void SwWW8Writer::Out_SwFmtTableBox( WW8Bytes& rO, const SvxBoxItem& rBox )
+void WW8Export::Out_SwFmtTableBox( WW8Bytes& rO, const SvxBoxItem& rBox )
{
// moeglich und vielleicht besser waere 0xffff
static const USHORT aBorders[] =
@@ -4267,32 +4291,30 @@ void SwWW8Writer::Out_SwFmtTableBox( WW8Bytes& rO, const SvxBoxItem& rBox )
for( int i = 0; i < 4; ++i, ++pBrd )
{
const SvxBorderLine* pLn = rBox.GetLine( *pBrd );
- Out_BorderLine(rO, pLn, 0, USHRT_MAX, false);
+ Out_BorderLine(rO, pLn, 0, 0, false);
}
}
-static Writer& OutWW8_SwFmtBox( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatBox( const SvxBoxItem& rBox )
{
- // Fly um Grafik-> keine Umrandung hier, da
- // der GrafikHeader bereits die Umrandung hat
- SwWW8Writer& rWW8Wrt = ((SwWW8Writer&)rWrt);
- if( !rWW8Wrt.bOutGrf )
+ // Fly um Grafik-> keine Umrandung hier, da
+ // der GrafikHeader bereits die Umrandung hat
+ if ( !m_rWW8Export.bOutGrf )
{
bool bShadow = false;
- const SfxPoolItem* pItem = ((SwWW8Writer&)rWrt).HasItem( RES_SHADOW );
- if( pItem )
+ const SfxPoolItem* pItem = m_rWW8Export.HasItem( RES_SHADOW );
+ if ( pItem )
{
const SvxShadowItem* p = (const SvxShadowItem*)pItem;
bShadow = ( p->GetLocation() != SVX_SHADOW_NONE )
&& ( p->GetWidth() != 0 );
}
- rWW8Wrt.Out_SwFmtBox( (SvxBoxItem&)rHt, bShadow );
+ m_rWW8Export.Out_SwFmtBox( rBox, bShadow );
}
- return rWrt;
}
-SwTwips SwWW8Writer::CurrentPageWidth(SwTwips &rLeft, SwTwips &rRight) const
+SwTwips WW8Export::CurrentPageWidth(SwTwips &rLeft, SwTwips &rRight) const
{
const SwFrmFmt* pFmt = pAktPageDesc ? &pAktPageDesc->GetMaster()
: &const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetMaster();
@@ -4304,28 +4326,109 @@ SwTwips SwWW8Writer::CurrentPageWidth(SwTwips &rLeft, SwTwips &rRight) const
return nPageSize;
}
-static Writer& OutWW8_SwFmtCol( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatColumns_Impl( USHORT nCols, const SwFmtCol & rCol, bool bEven, SwTwips nPageSize )
+{
+ // CColumns
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SCcolumns );
+ else
+ m_rWW8Export.pO->Insert( 144, m_rWW8Export.pO->Count( ) );
+ m_rWW8Export.InsUInt16( nCols - 1 );
+
+ // DxaColumns
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDxaColumns );
+ else
+ m_rWW8Export.pO->Insert( 145, m_rWW8Export.pO->Count( ) );
+ m_rWW8Export.InsUInt16( rCol.GetGutterWidth( true ) );
+
+ // LBetween
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SLBetween );
+ else
+ m_rWW8Export.pO->Insert( 158, m_rWW8Export.pO->Count( ) );
+ m_rWW8Export.pO->Insert( COLADJ_NONE == rCol.GetLineAdj( )? 0 : 1,
+ m_rWW8Export.pO->Count( ) );
+
+ const SwColumns & rColumns = rCol.GetColumns( );
+
+ // FEvenlySpaced
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SFEvenlySpaced );
+ else
+ m_rWW8Export.pO->Insert( 138, m_rWW8Export.pO->Count( ) );
+ m_rWW8Export.pO->Insert( bEven ? 1 : 0, m_rWW8Export.pO->Count( ) );
+
+#if 0
+ // FIXME what's the use of this code
+ if ( bEven )
+ {
+ USHORT nSpace = rColumns[0]->GetRight() + rColumns[1]->GetLeft();
+ for ( n = 2; n < nCols; n++ )
+ {
+ short nDiff = nSpace - ( rColumns[n - 1]->GetRight()
+ + rColumns[n]->GetLeft() );
+ if (nDiff > 10 || nDiff < -10)
+ {
+ // Toleranz: 10 tw
+ bEven = false;
+ break;
+ }
+ }
+ }
+#endif
+
+ if ( !bEven )
+ {
+ for ( USHORT n = 0; n < nCols; ++n )
+ {
+ //sprmSDxaColWidth
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDxaColWidth );
+ else
+ m_rWW8Export.pO->Insert( 136, m_rWW8Export.pO->Count( ) );
+ m_rWW8Export.pO->Insert( ( BYTE ) n, m_rWW8Export.pO->Count( ) );
+ m_rWW8Export.InsUInt16( rCol.
+ CalcPrtColWidth( n,
+ ( USHORT ) nPageSize ) );
+
+ if ( n + 1 != nCols )
+ {
+ //sprmSDxaColSpacing
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SDxaColSpacing );
+ else
+ m_rWW8Export.pO->Insert( 137,
+ m_rWW8Export.pO->Count( ) );
+ m_rWW8Export.pO->Insert( ( BYTE ) n,
+ m_rWW8Export.pO->Count( ) );
+ m_rWW8Export.InsUInt16( rColumns[n]->GetRight( ) +
+ rColumns[n + 1]->GetLeft( ) );
+ }
+ }
+ }
+}
+
+void AttributeOutputBase::FormatColumns( const SwFmtCol& rCol )
{
- const SwFmtCol& rCol = (const SwFmtCol&)rHt;
const SwColumns& rColumns = rCol.GetColumns();
- SwWW8Writer& rWW8Wrt = ((SwWW8Writer&)rWrt);
USHORT nCols = rColumns.Count();
- if (1 < nCols && !rWW8Wrt.bOutFlyFrmAttrs)
+ if ( 1 < nCols && !GetExport( ).bOutFlyFrmAttrs )
{
// dann besorge mal die Seitenbreite ohne Raender !!
- const SwFrmFmt* pFmt = rWW8Wrt.pAktPageDesc ? &rWW8Wrt.pAktPageDesc->GetMaster() : &const_cast<const SwDoc *>(rWW8Wrt.pDoc)->GetPageDesc(0).GetMaster();
+ const SwFrmFmt* pFmt = GetExport( ).pAktPageDesc ? &GetExport( ).pAktPageDesc->GetMaster() : &const_cast<const SwDoc *>(GetExport( ).pDoc)->GetPageDesc(0).GetMaster();
const SvxFrameDirectionItem &frameDirection = pFmt->GetFrmDir();
SwTwips nPageSize;
- if (frameDirection.GetValue() == FRMDIR_VERT_TOP_RIGHT || frameDirection.GetValue() == FRMDIR_VERT_TOP_LEFT)
+ if ( frameDirection.GetValue() == FRMDIR_VERT_TOP_RIGHT || frameDirection.GetValue() == FRMDIR_VERT_TOP_LEFT )
{
const SvxULSpaceItem &rUL = pFmt->GetULSpace();
nPageSize = pFmt->GetFrmSize().GetHeight();
nPageSize -= rUL.GetUpper() + rUL.GetLower();
const SwFmtHeader *header = dynamic_cast<const SwFmtHeader *>(pFmt->GetAttrSet().GetItem(RES_HEADER));
- if (header)
+ if ( header )
{
const SwFrmFmt *headerFmt = header->GetHeaderFmt();
if (headerFmt)
@@ -4334,10 +4437,10 @@ static Writer& OutWW8_SwFmtCol( Writer& rWrt, const SfxPoolItem& rHt )
}
}
const SwFmtFooter *footer = dynamic_cast<const SwFmtFooter *>(pFmt->GetAttrSet().GetItem(RES_FOOTER));
- if (footer)
+ if ( footer )
{
const SwFrmFmt *footerFmt = footer->GetFooterFmt();
- if (footerFmt)
+ if ( footerFmt )
{
nPageSize -= footerFmt->GetFrmSize().GetHeight();
}
@@ -4350,144 +4453,70 @@ static Writer& OutWW8_SwFmtCol( Writer& rWrt, const SfxPoolItem& rHt )
nPageSize -= rLR.GetLeft() + rLR.GetRight();
}
- // CColumns
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x500b );
- else
- rWW8Wrt.pO->Insert( 144, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( nCols - 1 );
-
- // DxaColumns
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x900c );
- else
- rWW8Wrt.pO->Insert( 145, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16(rCol.GetGutterWidth(true));
-
- // LBetween
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x3019 );
- else
- rWW8Wrt.pO->Insert( 158, rWW8Wrt.pO->Count() );
- rWW8Wrt.pO->Insert( COLADJ_NONE == rCol.GetLineAdj() ? 0 : 1,
- rWW8Wrt.pO->Count() );
-
// Nachsehen, ob alle Spalten gleich sind
bool bEven = true;
USHORT n;
USHORT nColWidth = rCol.CalcPrtColWidth( 0, (USHORT)nPageSize );
- for (n = 1; n < nCols; n++)
+ for ( n = 1; n < nCols; n++ )
{
short nDiff = nColWidth -
rCol.CalcPrtColWidth( n, (USHORT)nPageSize );
- if( nDiff > 10 || nDiff < -10 ) // Toleranz: 10 tw
+ if ( nDiff > 10 || nDiff < -10 ) // Toleranz: 10 tw
{
bEven = false;
break;
}
}
- if (bEven)
- {
- USHORT nSpace = rColumns[0]->GetRight() + rColumns[1]->GetLeft();
- for( n = 2; n < nCols; n++ )
- {
- short nDiff = nSpace - ( rColumns[n - 1]->GetRight()
- + rColumns[n]->GetLeft() );
- if (nDiff > 10 || nDiff < -10)
- {
- // Toleranz: 10 tw
- bEven = false;
- break;
- }
- }
- }
-
- // FEvenlySpaced
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0x3005 );
- else
- rWW8Wrt.pO->Insert( 138, rWW8Wrt.pO->Count() );
- rWW8Wrt.pO->Insert( bEven ? 1 : 0, rWW8Wrt.pO->Count() );
- if( !bEven )
- {
- for (n = 0; n < nCols; ++n)
- {
- //sprmSDxaColWidth
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0xF203 );
- else
- rWW8Wrt.pO->Insert( 136, rWW8Wrt.pO->Count() );
- rWW8Wrt.pO->Insert( (BYTE)n, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16(rCol.CalcPrtColWidth(n, (USHORT)nPageSize));
-
- if( n+1 != nCols )
- {
- //sprmSDxaColSpacing
- if( rWW8Wrt.bWrtWW8 )
- rWW8Wrt.InsUInt16( 0xF204 );
- else
- rWW8Wrt.pO->Insert( 137, rWW8Wrt.pO->Count() );
- rWW8Wrt.pO->Insert( (BYTE)n, rWW8Wrt.pO->Count() );
- rWW8Wrt.InsUInt16( rColumns[ n ]->GetRight() +
- rColumns[ n + 1 ]->GetLeft() );
- }
- }
- }
+ FormatColumns_Impl( nCols, rCol, bEven, nPageSize );
}
- return rWrt;
}
-// "Absaetze zusammenhalten"
-static Writer& OutWW8_SvxFmtKeep( Writer& rWrt, const SfxPoolItem& rHt )
+// "Paragraphs together"
+void WW8AttributeOutput::FormatKeep( const SvxFmtKeepItem& rKeep )
{
-// sprmFKeepFollow
- const SvxFmtKeepItem& rAttr = (const SvxFmtKeepItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x2406 );
+ // sprmFKeepFollow
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFKeepFollow );
else
- rWrtWW8.pO->Insert( 8, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( 8, m_rWW8Export.pO->Count() );
- rWrtWW8.pO->Insert( rAttr.GetValue() ? 1 : 0, rWrtWW8.pO->Count() );
- return rWrt;
+ m_rWW8Export.pO->Insert( rKeep.GetValue() ? 1 : 0, m_rWW8Export.pO->Count() );
}
-
// exclude a paragraph from Line Numbering
-static Writer& OutWW8_SwFmtLineNumber( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatLineNumbering( const SwFmtLineNumber& rNumbering )
{
-// sprmPFNoLineNumb
- const SwFmtLineNumber& rAttr = (const SwFmtLineNumber&)rHt;
-
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x240C );
+ // sprmPFNoLineNumb
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFNoLineNumb );
else
- rWrtWW8.pO->Insert( 14, rWrtWW8.pO->Count() );
-
- rWrtWW8.pO->Insert( rAttr.IsCount() ? 0 : 1, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( 14, m_rWW8Export.pO->Count() );
- return rWrt;
+ m_rWW8Export.pO->Insert( rNumbering.IsCount() ? 0 : 1, m_rWW8Export.pO->Count() );
}
/* File PARATR.HXX */
-static Writer& OutWW8_SvxLineSpacing( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::ParaLineSpacing_Impl( short nSpace, short nMulti )
{
-// sprmPDyaLine
- const SvxLineSpacingItem& rAttr = (const SvxLineSpacingItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x6412 );
+ // sprmPDyaLine
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PDyaLine );
else
- rWrtWW8.pO->Insert( 20, rWrtWW8.pO->Count() );
+ m_rWW8Export.pO->Insert( 20, m_rWW8Export.pO->Count() );
+
+ m_rWW8Export.InsUInt16( nSpace );
+ m_rWW8Export.InsUInt16( nMulti );
+}
+void AttributeOutputBase::ParaLineSpacing( const SvxLineSpacingItem& rSpacing )
+{
short nSpace = 240, nMulti = 0;
- switch (rAttr.GetLineSpaceRule())
+ switch ( rSpacing.GetLineSpaceRule() )
{
default:
break;
@@ -4495,68 +4524,63 @@ static Writer& OutWW8_SvxLineSpacing( Writer& rWrt, const SfxPoolItem& rHt )
case SVX_LINE_SPACE_FIX:
case SVX_LINE_SPACE_MIN:
{
- switch (rAttr.GetInterLineSpaceRule())
+ switch ( rSpacing.GetInterLineSpaceRule() )
{
case SVX_INTER_LINE_SPACE_FIX: // unser Durchschuss
{
// gibt es aber nicht in WW - also wie kommt man an
// die MaxLineHeight heran?
- nSpace = (short)rAttr.GetInterLineSpace();
+ nSpace = (short)rSpacing.GetInterLineSpace();
sal_uInt16 nScript =
i18n::ScriptType::LATIN;
const SwAttrSet *pSet = 0;
- if (rWrtWW8.pOutFmtNode && rWrtWW8.pOutFmtNode->ISA(SwFmt))
+ if ( GetExport().pOutFmtNode && GetExport().pOutFmtNode->ISA( SwFmt ) )
{
- const SwFmt *pFmt = (const SwFmt*)(rWrtWW8.pOutFmtNode);
+ const SwFmt *pFmt = (const SwFmt*)( GetExport().pOutFmtNode );
pSet = &pFmt->GetAttrSet();
}
- else if (rWrtWW8.pOutFmtNode &&
- rWrtWW8.pOutFmtNode->ISA(SwTxtNode))
+ else if ( GetExport().pOutFmtNode && GetExport().pOutFmtNode->ISA( SwTxtNode ) )
{
- const SwTxtNode* pNd =
- (const SwTxtNode*)rWrtWW8.pOutFmtNode;
+ const SwTxtNode* pNd = (const SwTxtNode*)GetExport().pOutFmtNode;
pSet = &pNd->GetSwAttrSet();
- if (pBreakIt->xBreak.is())
+ if ( pBreakIt->xBreak.is() )
{
nScript = pBreakIt->xBreak->
getScriptType(pNd->GetTxt(), 0);
}
}
- ASSERT(pSet, "No attrset for lineheight :-(");
- if (pSet)
+ ASSERT( pSet, "No attrset for lineheight :-(" );
+ if ( pSet )
{
- nSpace = nSpace + (short)(AttrSetToLineHeight(*rWrtWW8.pDoc,
- *pSet, *Application::GetDefaultDevice(), nScript));
+ nSpace = nSpace + (short)( AttrSetToLineHeight( *GetExport().pDoc,
+ *pSet, *Application::GetDefaultDevice(), nScript ) );
}
}
break;
case SVX_INTER_LINE_SPACE_PROP:
- nSpace = (short)(( 240L * rAttr.GetPropLineSpace() ) / 100L );
+ nSpace = (short)( ( 240L * rSpacing.GetPropLineSpace() ) / 100L );
nMulti = 1;
break;
default: // z.B. Minimum oder FIX?
- if( SVX_LINE_SPACE_FIX == rAttr.GetLineSpaceRule() )
- nSpace = -(short)rAttr.GetLineHeight();
+ if ( SVX_LINE_SPACE_FIX == rSpacing.GetLineSpaceRule() )
+ nSpace = -(short)rSpacing.GetLineHeight();
else
- nSpace = (short)rAttr.GetLineHeight();
+ nSpace = (short)rSpacing.GetLineHeight();
break;
}
}
break;
}
- rWrtWW8.InsUInt16(nSpace);
- rWrtWW8.InsUInt16(nMulti);
- return rWrt;
+ ParaLineSpacing_Impl( nSpace, nMulti );
}
-static Writer& OutWW8_SvxAdjust(Writer& rWrt, const SfxPoolItem& rHt)
+void WW8AttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust )
{
-// sprmPJc
- const SvxAdjustItem& rAttr = (const SvxAdjustItem&)rHt;
+ // sprmPJc
BYTE nAdj = 255;
BYTE nAdjBiDi = 255;
- switch(rAttr.GetAdjust())
+ switch ( rAdjust.GetAdjust() )
{
case SVX_ADJUST_LEFT:
nAdj = 0;
@@ -4574,101 +4598,99 @@ static Writer& OutWW8_SvxAdjust(Writer& rWrt, const SfxPoolItem& rHt)
nAdj = nAdjBiDi = 1;
break;
default:
- return rWrt; // not a supported Attribut
+ return; // not a supported Attribut
}
- if (255 != nAdj) // supported Attribut?
+ if ( 255 != nAdj ) // supported Attribut?
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (rWrtWW8.bWrtWW8)
+ if ( m_rWW8Export.bWrtWW8 )
{
- rWrtWW8.InsUInt16(0x2403);
- rWrtWW8.pO->Insert(nAdj, rWrtWW8.pO->Count());
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PJc );
+ m_rWW8Export.pO->Insert( nAdj, m_rWW8Export.pO->Count() );
/*
Sadly for left to right paragraphs both these values are the same,
for right to left paragraphs the bidi one is the reverse of the
normal one.
*/
- rWrtWW8.InsUInt16(0x2461); //bidi version ?
- bool bBiDiSwap=false;
- if (rWrtWW8.pOutFmtNode)
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PJcExtra ); //bidi version ?
+ bool bBiDiSwap = false;
+ if ( m_rWW8Export.pOutFmtNode )
{
short nDirection = FRMDIR_HORI_LEFT_TOP;
- if (rWrtWW8.pOutFmtNode->ISA(SwTxtNode))
+ if ( m_rWW8Export.pOutFmtNode->ISA( SwTxtNode ) )
{
- SwPosition aPos(*(const SwCntntNode*)rWrtWW8.pOutFmtNode);
- nDirection = rWrtWW8.pDoc->GetTextDirection(aPos);
+ SwPosition aPos(*(const SwCntntNode*)m_rWW8Export.pOutFmtNode);
+ nDirection = m_rWW8Export.pDoc->GetTextDirection(aPos);
}
- else if (rWrtWW8.pOutFmtNode->ISA(SwTxtFmtColl))
+ else if ( m_rWW8Export.pOutFmtNode->ISA( SwTxtFmtColl ) )
{
const SwTxtFmtColl* pC =
- (const SwTxtFmtColl*)rWrtWW8.pOutFmtNode;
+ (const SwTxtFmtColl*)m_rWW8Export.pOutFmtNode;
const SvxFrameDirectionItem &rItem =
ItemGet<SvxFrameDirectionItem>(*pC, RES_FRAMEDIR);
nDirection = rItem.GetValue();
}
- if ((nDirection == FRMDIR_HORI_RIGHT_TOP)
- || (nDirection == FRMDIR_ENVIRONMENT && Application::GetSettings().GetLayoutRTL()))
- bBiDiSwap=true;
+ if ( ( nDirection == FRMDIR_HORI_RIGHT_TOP ) ||
+ ( nDirection == FRMDIR_ENVIRONMENT && Application::GetSettings().GetLayoutRTL() ) )
+ {
+ bBiDiSwap = true;
+ }
}
- if (bBiDiSwap)
- rWrtWW8.pO->Insert(nAdjBiDi, rWrtWW8.pO->Count());
+ if ( bBiDiSwap )
+ m_rWW8Export.pO->Insert( nAdjBiDi, m_rWW8Export.pO->Count() );
else
- rWrtWW8.pO->Insert(nAdj, rWrtWW8.pO->Count());
+ m_rWW8Export.pO->Insert( nAdj, m_rWW8Export.pO->Count() );
}
else
{
- rWrtWW8.pO->Insert(5, rWrtWW8.pO->Count());
- rWrtWW8.pO->Insert(nAdj, rWrtWW8.pO->Count());
+ m_rWW8Export.pO->Insert( 5, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( nAdj, m_rWW8Export.pO->Count() );
}
}
- return rWrt;
}
-static Writer& OutWW8_SvxFrameDirection( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDirection )
{
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if (!rWrtWW8.bWrtWW8) //8+ only
- return rWrt;
+ if ( !m_rWW8Export.bWrtWW8 ) //8+ only
+ return;
- const SvxFrameDirectionItem& rItem = (const SvxFrameDirectionItem&)rHt;
UINT16 nTextFlow=0;
bool bBiDi = false;
- short nDir = rItem.GetValue();
+ short nDir = rDirection.GetValue();
- if (nDir == FRMDIR_ENVIRONMENT)
+ if ( nDir == FRMDIR_ENVIRONMENT )
{
- if (rWrtWW8.bOutPageDescs)
- nDir = rWrtWW8.GetCurrentPageDirection();
- else if (rWrtWW8.pOutFmtNode)
+ if ( m_rWW8Export.bOutPageDescs )
+ nDir = m_rWW8Export.GetCurrentPageDirection();
+ else if ( m_rWW8Export.pOutFmtNode )
{
- if (rWrtWW8.bOutFlyFrmAttrs) //frame
+ if ( m_rWW8Export.bOutFlyFrmAttrs ) //frame
{
- nDir = rWrtWW8.TrueFrameDirection(
- *(const SwFrmFmt*)rWrtWW8.pOutFmtNode);
+ nDir = m_rWW8Export.TrueFrameDirection(
+ *(const SwFrmFmt*)m_rWW8Export.pOutFmtNode );
}
- else if (rWrtWW8.pOutFmtNode->ISA(SwCntntNode)) //pagagraph
+ else if ( m_rWW8Export.pOutFmtNode->ISA( SwCntntNode ) ) //pagagraph
{
const SwCntntNode* pNd =
- (const SwCntntNode*)rWrtWW8.pOutFmtNode;
- SwPosition aPos(*pNd);
- nDir = rWrt.pDoc->GetTextDirection(aPos);
+ (const SwCntntNode*)m_rWW8Export.pOutFmtNode;
+ SwPosition aPos( *pNd );
+ nDir = m_rWW8Export.pDoc->GetTextDirection( aPos );
}
- else if (rWrtWW8.pOutFmtNode->ISA(SwTxtFmtColl))
+ else if ( m_rWW8Export.pOutFmtNode->ISA( SwTxtFmtColl ) )
nDir = FRMDIR_HORI_LEFT_TOP; //what else can we do :-(
}
- if (nDir == FRMDIR_ENVIRONMENT)
+ if ( nDir == FRMDIR_ENVIRONMENT )
nDir = FRMDIR_HORI_LEFT_TOP; //Set something
}
- switch (nDir)
+ switch ( nDir )
{
default:
//Can't get an unknown type here
- ASSERT(!(&rWrt), "Unknown frame direction");
+ ASSERT(false, "Unknown frame direction");
case FRMDIR_HORI_LEFT_TOP:
nTextFlow = 0;
break;
@@ -4682,49 +4704,42 @@ static Writer& OutWW8_SvxFrameDirection( Writer& rWrt, const SfxPoolItem& rHt )
break;
}
- if (rWrtWW8.bOutPageDescs)
+ if ( m_rWW8Export.bOutPageDescs )
{
- rWrtWW8.InsUInt16(0x5033);
- rWrtWW8.InsUInt16(nTextFlow);
- rWrtWW8.InsUInt16(0x3228);
- rWrtWW8.pO->Insert(bBiDi, rWrtWW8.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_STextFlow );
+ m_rWW8Export.InsUInt16( nTextFlow );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_SFBiDi );
+ m_rWW8Export.pO->Insert( bBiDi, m_rWW8Export.pO->Count() );
}
- else if (!rWrtWW8.bOutFlyFrmAttrs) //paragraph/style
+ else if ( !m_rWW8Export.bOutFlyFrmAttrs ) //paragraph/style
{
- rWrtWW8.InsUInt16(0x2441);
- rWrtWW8.pO->Insert(bBiDi, rWrtWW8.pO->Count() );
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFBiDi );
+ m_rWW8Export.pO->Insert( bBiDi, m_rWW8Export.pO->Count() );
}
- return rWrt;
}
-// "Absaetze trennen"
-static Writer& OutWW8_SvxFmtSplit( Writer& rWrt, const SfxPoolItem& rHt )
+// "Separate paragraphs"
+void WW8AttributeOutput::ParaSplit( const SvxFmtSplitItem& rSplit )
{
-// sprmPFKeep
- const SvxFmtSplitItem& rAttr = (const SvxFmtSplitItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x2405 );
+ // sprmPFKeep
+ if ( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFKeep );
else
- rWrtWW8.pO->Insert( 7, rWrtWW8.pO->Count() );
- rWrtWW8.pO->Insert( rAttr.GetValue() ? 0 : 1, rWrtWW8.pO->Count() );
- return rWrt;
+ m_rWW8Export.pO->Insert( 7, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( rSplit.GetValue() ? 0 : 1, m_rWW8Export.pO->Count() );
}
// Es wird nur das Item "SvxWidowItem" und nicht die Orphans uebersetzt,
// da es fuer beides im WW nur ein Attribut "Absatzkontrolle" gibt und
// im SW wahrscheinlich vom Anwender immer Beide oder keiner gesetzt werden.
-static Writer& OutWW8_SvxWidows( Writer& rWrt, const SfxPoolItem& rHt )
+void WW8AttributeOutput::ParaWidows( const SvxWidowsItem& rWidows )
{
// sprmPFWidowControl
- const SvxWidowsItem& rAttr = (const SvxWidowsItem&)rHt;
- SwWW8Writer& rWrtWW8 = (SwWW8Writer&)rWrt;
- if( rWrtWW8.bWrtWW8 )
- rWrtWW8.InsUInt16( 0x2431 );
+ if( m_rWW8Export.bWrtWW8 )
+ m_rWW8Export.InsUInt16( NS_sprm::LN_PFWidowControl );
else
- rWrtWW8.pO->Insert( 51, rWrtWW8.pO->Count() );
- rWrtWW8.pO->Insert( rAttr.GetValue() ? 1 : 0, rWrtWW8.pO->Count() );
- return rWrt;
+ m_rWW8Export.pO->Insert( 51, m_rWW8Export.pO->Count() );
+ m_rWW8Export.pO->Insert( rWidows.GetValue() ? 1 : 0, m_rWW8Export.pO->Count() );
}
@@ -4741,7 +4756,7 @@ public:
void Add(const SvxTabStop &rTS, long nAdjustment);
void Del(const SvxTabStop &rTS, long nAdjustment);
- void PutAll(SwWW8Writer& rWW8Wrt);
+ void PutAll(WW8Export& rWW8Wrt);
};
SwWW8WrTabu::SwWW8WrTabu(sal_uInt16 nDelMax, sal_uInt16 nAddMax)
@@ -4819,8 +4834,8 @@ void SwWW8WrTabu::Del(const SvxTabStop &rTS, long nAdjustment)
++nDel;
}
-// PutAll( SwWW8Writer& rWW8Wrt ) schreibt das Attribut nach rWrt.pO
-void SwWW8WrTabu::PutAll(SwWW8Writer& rWrt)
+// PutAll( WW8Export& rWW8Wrt ) schreibt das Attribut nach rWrt.pO
+void SwWW8WrTabu::PutAll(WW8Export& rWrt)
{
if (!nAdd && !nDel) //It its a no-op
return;
@@ -4836,7 +4851,7 @@ void SwWW8WrTabu::PutAll(SwWW8Writer& rWrt)
nSiz = 255;
if (rWrt.bWrtWW8)
- rWrt.InsUInt16(0xC60D);
+ rWrt.InsUInt16(NS_sprm::LN_PChgTabsPapx);
else
rWrt.pO->Insert(15, rWrt.pO->Count());
// cch eintragen
@@ -4851,8 +4866,8 @@ void SwWW8WrTabu::PutAll(SwWW8Writer& rWrt)
}
-static void OutWW8_SwTabStopAdd(Writer& rWrt, const SvxTabStopItem& rTStops,
- long nLParaMgn)
+static void ParaTabStopAdd( WW8Export& rWrt, const SvxTabStopItem& rTStops,
+ long nLParaMgn )
{
SwWW8WrTabu aTab( 0, rTStops.Count());
@@ -4863,7 +4878,7 @@ static void OutWW8_SwTabStopAdd(Writer& rWrt, const SvxTabStopItem& rTStops,
if (SVX_TAB_ADJUST_DEFAULT != rTS.GetAdjustment())
aTab.Add(rTS, nLParaMgn);
}
- aTab.PutAll( (SwWW8Writer&)rWrt );
+ aTab.PutAll( rWrt );
}
bool lcl_IsEqual(long nOneLeft, const SvxTabStop &rOne,
@@ -4877,8 +4892,8 @@ bool lcl_IsEqual(long nOneLeft, const SvxTabStop &rOne,
);
}
-static void OutWW8_SwTabStopDelAdd(Writer& rWrt, const SvxTabStopItem& rTStyle,
- long nLStypeMgn, const SvxTabStopItem& rTNew, long nLParaMgn)
+static void ParaTabStopDelAdd( WW8Export& rWrt, const SvxTabStopItem& rTStyle,
+ long nLStypeMgn, const SvxTabStopItem& rTNew, long nLParaMgn )
{
SwWW8WrTabu aTab(rTStyle.Count(), rTNew.Count());
@@ -4949,197 +4964,333 @@ static void OutWW8_SwTabStopDelAdd(Writer& rWrt, const SvxTabStopItem& rTStyle,
}
} while( 1 );
- aTab.PutAll( (SwWW8Writer&)rWrt );
+ aTab.PutAll( rWrt );
}
-static Writer& OutWW8_SwTabStop(Writer& rWrt, const SfxPoolItem& rHt)
+void WW8AttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStops )
{
- SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
- const SvxTabStopItem & rTStops = (const SvxTabStopItem&)rHt;
- const SfxPoolItem* pLR = rWW8Wrt.HasItem( RES_LR_SPACE );
- long nCurrentLeft = pLR ? ((const SvxLRSpaceItem*)pLR)->GetTxtLeft() : 0;
+ bool bTabsRelativeToIndex = m_rWW8Export.pCurPam->GetDoc()->get( IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT );
+ long nCurrentLeft = 0;
+
+ if ( bTabsRelativeToIndex )
+ {
+ const SfxPoolItem* pLR = m_rWW8Export.HasItem( RES_LR_SPACE );
+
+ if ( pLR != NULL )
+ nCurrentLeft = ((const SvxLRSpaceItem*)pLR)->GetTxtLeft();
+ }
+
+ // --> FLR 2009-03-17 #i100264#
+ if ( m_rWW8Export.bStyDef &&
+ m_rWW8Export.pCurrentStyle != NULL &&
+ m_rWW8Export.pCurrentStyle->DerivedFrom() != NULL )
+ {
+ SvxTabStopItem aTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ const SwFmt *pParentStyle = m_rWW8Export.pCurrentStyle->DerivedFrom();
+ const SvxTabStopItem* pParentTabs = HasItem<SvxTabStopItem>( pParentStyle->GetAttrSet(), RES_PARATR_TABSTOP );
+ if ( pParentTabs )
+ {
+ aTabs.Insert( pParentTabs );
+ }
+
+ ParaTabStopDelAdd( m_rWW8Export, aTabs, 0, rTabStops, 0 );
+ return;
+ }
+ // <--
// StyleDef -> "einfach" eintragen || keine Style-Attrs -> dito
const SvxTabStopItem* pStyleTabs = 0;
- if (!rWW8Wrt.bStyDef && rWW8Wrt.pStyAttr)
+ if ( !m_rWW8Export.bStyDef && m_rWW8Export.pStyAttr )
{
pStyleTabs =
- HasItem<SvxTabStopItem>(*rWW8Wrt.pStyAttr, RES_PARATR_TABSTOP);
+ HasItem<SvxTabStopItem>( *m_rWW8Export.pStyAttr, RES_PARATR_TABSTOP );
}
- if (!pStyleTabs)
- OutWW8_SwTabStopAdd(rWW8Wrt, rTStops, nCurrentLeft);
+ if ( !pStyleTabs )
+ ParaTabStopAdd(m_rWW8Export, rTabStops, nCurrentLeft);
else
{
- const SvxLRSpaceItem &rStyleLR =
- ItemGet<SvxLRSpaceItem>(*rWW8Wrt.pStyAttr, RES_LR_SPACE);
- long nStyleLeft = rStyleLR.GetTxtLeft();
+ long nStyleLeft = 0;
+
+ if (bTabsRelativeToIndex)
+ {
+ const SvxLRSpaceItem &rStyleLR =
+ ItemGet<SvxLRSpaceItem>(*m_rWW8Export.pStyAttr, RES_LR_SPACE);
+ nStyleLeft = rStyleLR.GetTxtLeft();
+ }
- OutWW8_SwTabStopDelAdd(rWW8Wrt, *pStyleTabs, nStyleLeft, rTStops,
+ ParaTabStopDelAdd(m_rWW8Export, *pStyleTabs, nStyleLeft, rTabStops,
nCurrentLeft);
}
- return rWrt;
}
//-----------------------------------------------------------------------
-/*
- * lege hier die Tabellen fuer die WW-Funktions-Pointer auf
- * die Ausgabe-Funktionen an.
- * Es sind lokale Strukturen, die nur innerhalb
- * bekannt sein muessen.
- */
+void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt )
+{
+ // FIXME maybe use 'item_cast', like 'item_cast<SvxCharHiddenItem>( rHt )'?
+ switch ( rHt.Which() )
+ {
+ case RES_CHRATR_CASEMAP:
+ CharCaseMap( static_cast< const SvxCaseMapItem& >( rHt ) );
+ break;
+ case RES_CHRATR_COLOR:
+ CharColor( static_cast< const SvxColorItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CONTOUR:
+ CharContour( static_cast< const SvxContourItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CROSSEDOUT:
+ CharCrossedOut( static_cast< const SvxCrossedOutItem& >( rHt ) );
+ break;
+ case RES_CHRATR_ESCAPEMENT:
+ CharEscapement( static_cast< const SvxEscapementItem& >( rHt ) );
+ break;
+ case RES_CHRATR_FONT:
+ CharFont( static_cast< const SvxFontItem& >( rHt ) );
+ break;
+ case RES_CHRATR_FONTSIZE:
+ CharFontSize( static_cast< const SvxFontHeightItem& >( rHt ) );
+ break;
+ case RES_CHRATR_KERNING:
+ CharKerning( static_cast< const SvxKerningItem& >( rHt ) );
+ break;
+ case RES_CHRATR_LANGUAGE:
+ CharLanguage( static_cast< const SvxLanguageItem& >( rHt ) );
+ break;
+ case RES_CHRATR_POSTURE:
+ CharPosture( static_cast< const SvxPostureItem& >( rHt ) );
+ break;
+ case RES_CHRATR_SHADOWED:
+ CharShadow( static_cast< const SvxShadowedItem& >( rHt ) );
+ break;
+ case RES_CHRATR_UNDERLINE:
+ CharUnderline( static_cast< const SvxUnderlineItem& >( rHt ) );
+ break;
+ case RES_CHRATR_WEIGHT:
+ CharWeight( static_cast< const SvxWeightItem& >( rHt ) );
+ break;
+ case RES_CHRATR_AUTOKERN:
+ CharAutoKern( static_cast< const SvxAutoKernItem& >( rHt ) );
+ break;
+ case RES_CHRATR_BLINK:
+ CharAnimatedText( static_cast< const SvxBlinkItem& >( rHt ) );
+ break;
+ case RES_CHRATR_BACKGROUND:
+ CharBackground( static_cast< const SvxBrushItem& >( rHt ) );
+ break;
-SwAttrFnTab aWW8AttrFnTab = {
-/* RES_CHRATR_CASEMAP */ OutWW8_SwCaseMap,
-/* RES_CHRATR_CHARSETCOLOR */ 0,
-/* RES_CHRATR_COLOR */ OutWW8_SwColor,
-/* RES_CHRATR_CONTOUR */ OutWW8_SwContour,
-/* RES_CHRATR_CROSSEDOUT */ OutWW8_SwCrossedOut,
-/* RES_CHRATR_ESCAPEMENT */ OutWW8_SwEscapement,
-/* RES_CHRATR_FONT */ OutWW8_SwFont,
-/* RES_CHRATR_FONTSIZE */ OutWW8_SwSize,
-/* RES_CHRATR_KERNING */ OutWW8_SwKerning,
-/* RES_CHRATR_LANGUAGE */ OutWW8_SwLanguage,
-/* RES_CHRATR_POSTURE */ OutWW8_SwPosture,
-/* RES_CHRATR_PROPORTIONALFONTSIZE*/0,
-/* RES_CHRATR_SHADOWED */ OutWW8_SwShadow,
-/* RES_CHRATR_UNDERLINE */ OutWW8_SwUnderline,
-/* RES_CHRATR_WEIGHT */ OutWW8_SwWeight,
-/* RES_CHRATR_WORDLINEMODE */ 0, // Wird bei Underline mitbehandelt
-/* RES_CHRATR_AUTOKERN */ OutWW8_SvxAutoKern,
-/* RES_CHRATR_BLINK */ OutWW8_SwAnimatedText, // neu: blinkender Text
-/* RES_CHRATR_NOHYPHEN */ 0, // Neu: nicht trennen
-/* RES_CHRATR_NOLINEBREAK */ 0, // Neu: nicht umbrechen
-/* RES_CHRATR_BACKGROUND */ OutWW8_SwFmtCharBackground,
-/* RES_CHRATR_CJK_FONT */ OutWW8_SwCJKFont,
-/* RES_CHRATR_CJK_FONTSIZE */ OutWW8_SwSize,
-/* RES_CHRATR_CJK_LANGUAGE */ OutWW8_SwLanguage,
-/* RES_CHRATR_CJK_POSTURE */ OutWW8_SwPosture,
-/* RES_CHRATR_CJK_WEIGHT */ OutWW8_SwWeight,
-/* RES_CHRATR_CTL_FONT */ OutWW8_SwCTLFont,
-/* RES_CHRATR_CTL_FONTSIZE */ OutWW8_SwSize,
-/* RES_CHRATR_CTL_LANGUAGE */ OutWW8_SwLanguage,
-/* RES_CHRATR_CTL_POSTURE */ OutWW8_SwBiDiPosture,
-/* RES_CHRATR_CTL_WEIGHT */ OutWW8_SwBiDiWeight,
-/* RES_CHRATR_WRITING_DIRECTION */ OutWW8_CharRotate,
-/* RES_CHRATR_EMPHASIS_MARK*/ OutWW8_EmphasisMark,
-/* RES_TXTATR_TWO_LINES */ OutWW8_SvxTwoLinesItem,
-/* RES_CHRATR_DUMMY4 */ OutWW8_ScaleWidth,
-/* RES_CHRATR_RELIEF*/ OutWW8_Relief,
-/* RES_CHRATR_HIDDEN */ OutWW8_SvxCharHidden,
-/* RES_CHRATR_OVERLINE */ 0,
-/* RES_CHRATR_DUMMY1 */ 0,
-/* RES_CHRATR_DUMMY2 */ 0,
-
-/* RES_TXTATR_DUMMY4 */ 0,
-/* RES_TXTATR_INETFMT */ OutSwFmtINetFmt,
-/* RES_TXTATR_REFMARK */ 0, // handled by SwAttrIter
-/* RES_TXTATR_TOXMARK */ 0, // handled by SwAttrIter
-/* RES_TXTATR_CHARFMT */ OutWW8_SwTxtCharFmt,
-/* RES_TXTATR_DUMMY5*/ 0,
-/* RES_TXTATR_CJK_RUBY */ 0, // handled by SwAttrIter
-/* RES_TXTATR_UNKNOWN_CONTAINER */ 0,
-/* RES_TXTATR_DUMMY6 */ 0,
-/* RES_TXTATR_DUMMY7 */ 0,
-
-/* RES_TXTATR_FIELD */ OutWW8_SwField,
-/* RES_TXTATR_FLYCNT */ OutWW8_SwFlyCntnt,
-/* RES_TXTATR_FTN */ OutWW8_SwFtn,
-/* RES_TXTATR_SOFTHYPH */ 0, // old attr. - coded now by character
-/* RES_TXTATR_HARDBLANK */ OutWW8_SwHardBlank,
-/* RES_TXTATR_DUMMY1 */ 0, // Dummy:
-/* RES_TXTATR_DUMMY2 */ 0, // Dummy:
-
-/* RES_PARATR_LINESPACING */ OutWW8_SvxLineSpacing,
-/* RES_PARATR_ADJUST */ OutWW8_SvxAdjust,
-/* RES_PARATR_SPLIT */ OutWW8_SvxFmtSplit,
-/* RES_PARATR_ORPHANS */ 0, // OutW4W_SwOrphans, // kann WW nicht unabhaengig von Widows
-/* RES_PARATR_WIDOWS */ OutWW8_SvxWidows,
-/* RES_PARATR_TABSTOP */ OutWW8_SwTabStop,
-/* RES_PARATR_HYPHENZONE*/ OutWW8_SvxHyphenZone,
-/* RES_PARATR_DROP */ 0,
-/* RES_PARATR_REGISTER */ 0, // neu: Registerhaltigkeit
-/* RES_PARATR_NUMRULE */ OutWW8_SwNumRuleItem,
-/* RES_PARATR_SCRIPTSPACE */ OutWW8_SfxBoolItem,
-/* RES_PARATR_HANGINGPUNCTUATION */ OutWW8_SfxBoolItem,
-/* RES_PARATR_FORBIDDEN_RULES */ OutWW8_SfxBoolItem,
-/* RES_PARATR_VERTALIGN */ OutWW8_SvxParaVertAlignItem,
-/* RES_PARATR_SNAPTOGRID*/ OutWW8_SvxParaGridItem,
-/* RES_PARATR_CONNECT_TO_BORDER */ 0, // new
-/* RES_PARATR_OUTLINELEVEL */ 0, // new - outlinelevel
-
-/* RES_PARATR_LIST_ID */ 0, // new
-/* RES_PARATR_LIST_LEVEL */ 0, // new
-/* RES_PARATR_LIST_ISRESTART */ 0, // new
-/* RES_PARATR_LIST_RESTARTVALUE */ 0, // new
-/* RES_PARATR_LIST_ISCOUNTED */ 0, // new
-
-/* RES_FILL_ORDER */ 0, // OutW4W_SwFillOrder,
-/* RES_FRM_SIZE */ OutWW8_SwFrmSize,
-/* RES_PAPER_BIN */ OutWW8_SvxPaperBin,
-/* RES_LR_SPACE */ OutWW8_SwFmtLRSpace,
-/* RES_UL_SPACE */ OutWW8_SwFmtULSpace,
-/* RES_PAGEDESC */ OutWW8_SwFmtPageDesc,
-/* RES_BREAK */ OutWW8_SwFmtBreak,
-/* RES_CNTNT */ 0, /* 0, // OutW4W_??? */
-/* RES_HEADER */ 0, // wird bei der PageDesc ausgabe beachtet
-/* RES_FOOTER */ 0, // wird bei der PageDesc ausgabe beachtet
-/* RES_PRINT */ 0, // OutW4W_SwFmtPrint,
-/* RES_OPAQUE */ 0, // OutW4W_SwFmtOpaque, // kann WW nicht
-/* RES_PROTECT */ 0, // OutW4W_SwFmtProtect,
-/* RES_SURROUND */ OutWW8_SwFmtSurround,
-/* RES_VERT_ORIENT */ OutWW8_SwFmtVertOrient,
-/* RES_HORI_ORIENT */ OutWW8_SwFmtHoriOrient,
-/* RES_ANCHOR */ OutWW8_SwFmtAnchor,
-/* RES_BACKGROUND */ OutWW8_SwFmtBackground,
-/* RES_BOX */ OutWW8_SwFmtBox,
-/* RES_SHADOW */ 0, // Wird bei SwFmtBox mitbehandelt
-/* RES_FRMMACRO */ 0, /* 0, // OutW4W_??? */
-/* RES_COL */ OutWW8_SwFmtCol,
-/* RES_KEEP */ OutWW8_SvxFmtKeep,
-/* RES_URL */ 0, // URL
-/* RES_EDIT_IN_READONLY */ 0,
-/* RES_LAYOUT_SPLIT */ 0,
-/* RES_CHAIN */ 0,
-/* RES_TEXTGRID*/ OutWW8_SwTextGrid,
-/* RES_LINENUMBER */ OutWW8_SwFmtLineNumber, // Line Numbering
-/* RES_FTN_AT_TXTEND*/ 0, // Dummy:
-/* RES_END_AT_TXTEND*/ 0, // Dummy:
-/* RES_COLUMNBALANCE*/ 0, // Dummy:
-/* RES_FRAMEDIR*/ OutWW8_SvxFrameDirection,
-/* RES_FRMATR_DUMMY8 */ 0, // Dummy:
-/* RES_FRMATR_DUMMY9 */ 0, // Dummy:
-/* RES_FOLLOW_TEXT_FLOW */ 0,
-/* RES_WRAP_INFLUENCE_ON_OBJPOS */ 0,
-/* RES_FRMATR_DUMMY2 */ 0, // Dummy:
-/* RES_AUTO_STYLE */ 0, // Dummy:
-/* RES_FRMATR_DUMMY4 */ 0, // Dummy:
-/* RES_FRMATR_DUMMY5 */ 0, // Dummy:
-
-/* RES_GRFATR_MIRRORGRF */ 0, // OutW4W_SwMirrorGrf,
-/* RES_GRFATR_CROPGRF */ 0, // OutW4W_SwCropGrf
-/* RES_GRFATR_ROTATION */ 0,
-/* RES_GRFATR_LUMINANCE */ 0,
-/* RES_GRFATR_CONTRAST */ 0,
-/* RES_GRFATR_CHANNELR */ 0,
-/* RES_GRFATR_CHANNELG */ 0,
-/* RES_GRFATR_CHANNELB */ 0,
-/* RES_GRFATR_GAMMA */ 0,
-/* RES_GRFATR_INVERT */ 0,
-/* RES_GRFATR_TRANSPARENCY */ 0,
-/* RES_GRFATR_DRWAMODE */ 0,
-/* RES_GRFATR_DUMMY1 */ 0,
-/* RES_GRFATR_DUMMY2 */ 0,
-/* RES_GRFATR_DUMMY3 */ 0,
-/* RES_GRFATR_DUMMY4 */ 0,
-/* RES_GRFATR_DUMMY5 */ 0,
-
-/* RES_BOXATR_FORMAT */ 0,
-/* RES_BOXATR_FORMULA */ 0,
-/* RES_BOXATR_VALUE */ 0,
-
-/* RES_UNKNOWNATR_CONTAINER */ 0
-};
+ case RES_CHRATR_CJK_FONT:
+ CharFontCJK( static_cast< const SvxFontItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CJK_FONTSIZE:
+ CharFontSizeCJK( static_cast< const SvxFontHeightItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CJK_LANGUAGE:
+ CharLanguageCJK( static_cast< const SvxLanguageItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CJK_POSTURE:
+ CharPostureCJK( static_cast< const SvxPostureItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CJK_WEIGHT:
+ CharWeightCJK( static_cast< const SvxWeightItem& >( rHt ) );
+ break;
+
+ case RES_CHRATR_CTL_FONT:
+ CharFontCTL( static_cast< const SvxFontItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CTL_FONTSIZE:
+ CharFontSizeCTL( static_cast< const SvxFontHeightItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CTL_LANGUAGE:
+ CharLanguageCTL( static_cast< const SvxLanguageItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CTL_POSTURE:
+ CharPostureCTL( static_cast< const SvxPostureItem& >( rHt ) );
+ break;
+ case RES_CHRATR_CTL_WEIGHT:
+ CharWeightCTL( static_cast< const SvxWeightItem& >( rHt ) );
+ break;
+
+ case RES_CHRATR_ROTATE:
+ CharRotate( static_cast< const SvxCharRotateItem& >( rHt ) );
+ break;
+ case RES_CHRATR_EMPHASIS_MARK:
+ CharEmphasisMark( static_cast< const SvxEmphasisMarkItem& >( rHt ) );
+ break;
+ case RES_CHRATR_TWO_LINES:
+ CharTwoLines( static_cast< const SvxTwoLinesItem& >( rHt ) );
+ break;
+ case RES_CHRATR_SCALEW:
+ CharScaleWidth( static_cast< const SvxCharScaleWidthItem& >( rHt ) );
+ break;
+ case RES_CHRATR_RELIEF:
+ CharRelief( static_cast< const SvxCharReliefItem& >( rHt ) );
+ break;
+ case RES_CHRATR_HIDDEN:
+ CharHidden( static_cast< const SvxCharHiddenItem& >( rHt ) );
+ break;
+
+ case RES_TXTATR_INETFMT:
+ TextINetFormat( static_cast< const SwFmtINetFmt& >( rHt ) );
+ break;
+ case RES_TXTATR_CHARFMT:
+ TextCharFormat( static_cast< const SwFmtCharFmt& >( rHt ) );
+ break;
+ case RES_TXTATR_FIELD:
+ TextField( static_cast< const SwFmtFld& >( rHt ) );
+ break;
+ case RES_TXTATR_FLYCNT:
+ TextFlyContent( static_cast< const SwFmtFlyCnt& >( rHt ) );
+ break;
+ case RES_TXTATR_FTN:
+ TextFootnote( static_cast< const SwFmtFtn& >( rHt ) );
+ break;
+ case RES_TXTATR_HARDBLANK:
+ TextHardBlank( static_cast< const SwFmtHardBlank& >( rHt ) );
+ break;
+
+ case RES_PARATR_LINESPACING:
+ ParaLineSpacing( static_cast< const SvxLineSpacingItem& >( rHt ) );
+ break;
+ case RES_PARATR_ADJUST:
+ ParaAdjust( static_cast< const SvxAdjustItem& >( rHt ) );
+ break;
+ case RES_PARATR_SPLIT:
+ ParaSplit( static_cast< const SvxFmtSplitItem& >( rHt ) );
+ break;
+ case RES_PARATR_WIDOWS:
+ ParaWidows( static_cast< const SvxWidowsItem& >( rHt ) );
+ break;
+ case RES_PARATR_TABSTOP:
+ ParaTabStop( static_cast< const SvxTabStopItem& >( rHt ) );
+ break;
+ case RES_PARATR_HYPHENZONE:
+ ParaHyphenZone( static_cast< const SvxHyphenZoneItem& >( rHt ) );
+ break;
+ case RES_PARATR_NUMRULE:
+ ParaNumRule( static_cast< const SwNumRuleItem& >( rHt ) );
+ break;
+ case RES_PARATR_SCRIPTSPACE:
+ ParaScriptSpace( static_cast< const SfxBoolItem& >( rHt ) );
+ break;
+ case RES_PARATR_HANGINGPUNCTUATION:
+ ParaHangingPunctuation( static_cast< const SfxBoolItem& >( rHt ) );
+ break;
+ case RES_PARATR_FORBIDDEN_RULES:
+ ParaForbiddenRules( static_cast< const SfxBoolItem& >( rHt ) );
+ break;
+ case RES_PARATR_VERTALIGN:
+ ParaVerticalAlign( static_cast< const SvxParaVertAlignItem& >( rHt ) );
+ break;
+ case RES_PARATR_SNAPTOGRID:
+ ParaSnapToGrid( static_cast< const SvxParaGridItem& >( rHt ) );
+ break;
+
+ case RES_FRM_SIZE:
+ FormatFrameSize( static_cast< const SwFmtFrmSize& >( rHt ) );
+ break;
+ case RES_PAPER_BIN:
+ FormatPaperBin( static_cast< const SvxPaperBinItem& >( rHt ) );
+ break;
+ case RES_LR_SPACE:
+ FormatLRSpace( static_cast< const SvxLRSpaceItem& >( rHt ) );
+ break;
+ case RES_UL_SPACE:
+ FormatULSpace( static_cast< const SvxULSpaceItem& >( rHt ) );
+ break;
+ case RES_PAGEDESC:
+ FormatPageDescription( static_cast< const SwFmtPageDesc& >( rHt ) );
+ break;
+ case RES_BREAK:
+ FormatBreak( static_cast< const SvxFmtBreakItem& >( rHt ) );
+ break;
+ case RES_SURROUND:
+ FormatSurround( static_cast< const SwFmtSurround& >( rHt ) );
+ break;
+ case RES_VERT_ORIENT:
+ FormatVertOrientation( static_cast< const SwFmtVertOrient& >( rHt ) );
+ break;
+ case RES_HORI_ORIENT:
+ FormatHorizOrientation( static_cast< const SwFmtHoriOrient& >( rHt ) );
+ break;
+ case RES_ANCHOR:
+ FormatAnchor( static_cast< const SwFmtAnchor& >( rHt ) );
+ break;
+ case RES_BACKGROUND:
+ FormatBackground( static_cast< const SvxBrushItem& >( rHt ) );
+ break;
+ case RES_BOX:
+ FormatBox( static_cast< const SvxBoxItem& >( rHt ) );
+ break;
+ case RES_COL:
+ FormatColumns( static_cast< const SwFmtCol& >( rHt ) );
+ break;
+ case RES_KEEP:
+ FormatKeep( static_cast< const SvxFmtKeepItem& >( rHt ) );
+ break;
+ case RES_TEXTGRID:
+ FormatTextGrid( static_cast< const SwTextGridItem& >( rHt ) );
+ break;
+ case RES_LINENUMBER:
+ FormatLineNumbering( static_cast< const SwFmtLineNumber& >( rHt ) );
+ break;
+ case RES_FRAMEDIR:
+ FormatFrameDirection( static_cast< const SvxFrameDirectionItem& >( rHt ) );
+ break;
+
+ default:
+#if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "Unhandled SfxPoolItem with id %d.\n", rHt.Which() );
+#endif
+ break;
+ }
+}
+
+void AttributeOutputBase::OutputStyleItemSet( const SfxItemSet& rSet, BOOL bDeep, BOOL bTestForDefault )
+{
+ // based on OutputItemSet() from wrt_fn.cxx
+
+ const SfxItemPool& rPool = *rSet.GetPool();
+ const SfxItemSet* pSet = &rSet;
+ if ( !pSet->Count() )
+ {
+ if ( !bDeep )
+ return;
+
+ while ( 0 != ( pSet = pSet->GetParent() ) && !pSet->Count() )
+ ;
+
+ if ( !pSet )
+ return;
+ }
+
+ const SfxPoolItem* pItem;
+ if ( !bDeep || !pSet->GetParent() )
+ {
+ ASSERT( rSet.Count(), "Wurde doch schon behandelt oder?" );
+ SfxItemIter aIter( *pSet );
+ pItem = aIter.GetCurItem();
+ do {
+ OutputItem( *pItem );
+ } while ( !aIter.IsAtEnd() && 0 != ( pItem = aIter.NextItem() ) );
+ }
+ else
+ {
+ SfxWhichIter aIter( *pSet );
+ USHORT nWhich = aIter.FirstWhich();
+ while ( nWhich )
+ {
+ if ( SFX_ITEM_SET == pSet->GetItemState( nWhich, bDeep, &pItem ) &&
+ ( !bTestForDefault ||
+ *pItem != rPool.GetDefaultItem( nWhich ) ||
+ ( pSet->GetParent() && *pItem != pSet->GetParent()->Get( nWhich ) ) ) )
+ {
+ OutputItem( *pItem );
+ }
+ nWhich = aIter.NextWhich();
+ }
+ }
+}
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
new file mode 100644
index 000000000000..cff22353d60c
--- /dev/null
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -0,0 +1,459 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _WW8ATTRIBUTEOUTPUT_HXX_
+#define _WW8ATTRIBUTEOUTPUT_HXX_
+
+#include "attributeoutputbase.hxx"
+#include "wrtww8.hxx"
+
+class WW8AttributeOutput : public AttributeOutputBase
+{
+public:
+ /// Export the state of RTL/CJK.
+ virtual void RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript );
+
+ /// Start of the paragraph.
+ virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/ ) {}
+
+ /// End of the paragraph.
+ virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner );
+
+ /// Called before we start outputting the attributes.
+ virtual void StartParagraphProperties( const SwTxtNode& /*rNode*/ ) {}
+
+ /// Called after we end outputting the attributes.
+ virtual void EndParagraphProperties() {}
+
+ /// Empty paragraph.
+ virtual void EmptyParagraph();
+
+ /// Start of the text run.
+ ///
+ /// No-op for binary filters.
+ virtual void StartRun( const SwRedlineData* /*pRedlineData*/ ) {}
+
+ /// End of the text run.
+ ///
+ /// No-op for binary filters.
+ virtual void EndRun() {}
+
+ /// Before we start outputting the attributes.
+ virtual void StartRunProperties();
+
+ /// After we end outputting the attributes.
+ virtual void EndRunProperties( const SwRedlineData* pRedlineData );
+
+ /// Output text.
+ virtual void RunText( const String& rText, rtl_TextEncoding eCharSet );
+
+ /// Output text (without markup).
+ virtual void RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet );
+
+ /// Output ruby start.
+ virtual void StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby );
+
+ /// Output ruby end.
+ virtual void EndRuby();
+
+ /// Output URL start.
+ virtual bool StartURL( const String &rUrl, const String &rTarget );
+
+ /// Output URL end.
+ virtual bool EndURL();
+
+ virtual void FieldVanish( const String& rTxt, ww::eField eType );
+
+ /// Output redlining.
+ virtual void Redline( const SwRedlineData* pRedline );
+
+ virtual void FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rSwFmtDrop, USHORT nStyle, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner );
+
+ /// Output FKP (Formatted disK Page) - necessary for binary formats only.
+ /// FIXME having it in AttributeOutputBase is probably a hack, it
+ /// should be in WW8AttributeOutput only...
+ virtual void OutputFKP();
+
+ /// Output style.
+ virtual void ParagraphStyle( USHORT nStyle );
+
+ virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+
+ virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo );
+
+ virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner );
+
+ virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+
+ virtual void TableRowEnd( sal_uInt32 nDepth = 1 );
+
+ /// Start of the styles table.
+ virtual void StartStyles();
+
+ /// End of the styles table.
+ virtual void EndStyles( USHORT nNumberOfStyles );
+
+ /// Write default style.
+ virtual void DefaultStyle( USHORT nStyle );
+
+ /// Start of a style in the styles table.
+ virtual void StartStyle( const String& rName, bool bPapFmt,
+ USHORT nBase, USHORT nNext, USHORT nWwIdi, USHORT nId );
+
+ /// End of a style in the styles table.
+ virtual void EndStyle();
+
+ /// Start of (paragraph or run) properties of a style.
+ virtual void StartStyleProperties( bool bParProp, USHORT nStyle );
+
+ /// End of (paragraph or run) properties of a style.
+ virtual void EndStyleProperties( bool bParProp );
+
+ /// Numbering rule and Id.
+ virtual void OutlineNumbering( BYTE nLvl, const SwNumFmt &rNFmt, const SwFmt &rFmt );
+
+ /// Page break
+ /// As a paragraph property - the paragraph should be on the next page.
+ virtual void PageBreakBefore( bool bBreak );
+
+ /// Write a section break
+ /// msword::ColumnBreak or msword::PageBreak
+ virtual void SectionBreak( BYTE nC, const WW8_SepInfo* pSectionInfo = NULL );
+
+ /// Start of the section properties.
+ virtual void StartSection();
+
+ /// End of the section properties.
+ ///
+ /// No-op for binary filters.
+ virtual void EndSection() {}
+
+ /// Protection of forms.
+ virtual void SectionFormProtection( bool bProtected );
+
+ /// Numbering of the lines in the document.
+ virtual void SectionLineNumbering( ULONG nRestartNo, const SwLineNumberInfo& rLnNumInfo );
+
+ /// Has different headers/footers for the title page.
+ virtual void SectionTitlePage();
+
+ /// Description of the page borders.
+ virtual void SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* pFirstPageFmt );
+
+ /// Columns populated from right/numbers on the right side?
+ virtual void SectionBiDi( bool bBiDi );
+
+ /// The style of the page numbers.
+ ///
+ /// nPageRestartNumberr being 0 means no restart.
+ virtual void SectionPageNumbering( USHORT nNumType, USHORT nPageRestartNumber );
+
+ /// The type of breaking.
+ virtual void SectionType( BYTE nBreakCode );
+
+ /// Special header/footer flags, needed for old versions only.
+ virtual void SectionWW6HeaderFooterFlags( BYTE nHeadFootFlags );
+
+ /// Definition of a numbering instance.
+ virtual void NumberingDefinition( USHORT nId, const SwNumRule &rRule );
+
+ /// All the numbering level information.
+ virtual void NumberingLevel( BYTE nLevel,
+ USHORT nStart,
+ USHORT nNumberingType,
+ SvxAdjust eAdjust,
+ const BYTE *pNumLvlPos,
+ BYTE nFollow,
+ const wwFont *pFont,
+ const SfxItemSet *pOutSet,
+ sal_Int16 nIndentAt,
+ sal_Int16 nFirstLineIndex,
+ sal_Int16 nListTabPos,
+ const String &rNumberingString );
+
+protected:
+ /// Output frames - the implementation.
+ void OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point& rNdTopLeft );
+
+ /// Sfx item Sfx item RES_CHRATR_CASEMAP
+ virtual void CharCaseMap( const SvxCaseMapItem& );
+
+ /// Sfx item Sfx item RES_CHRATR_COLOR
+ virtual void CharColor( const SvxColorItem& );
+
+ /// Sfx item Sfx item RES_CHRATR_CONTOUR
+ virtual void CharContour( const SvxContourItem& );
+
+ /// Sfx item RES_CHRATR_CROSSEDOUT
+ virtual void CharCrossedOut( const SvxCrossedOutItem& rHt );
+
+ /// Sfx item RES_CHRATR_ESCAPEMENT
+ virtual void CharEscapement( const SvxEscapementItem& );
+
+ /// Sfx item RES_CHRATR_FONT
+ virtual void CharFont( const SvxFontItem& );
+
+ /// Sfx item RES_CHRATR_FONTSIZE
+ virtual void CharFontSize( const SvxFontHeightItem& );
+
+ /// Sfx item RES_CHRATR_KERNING
+ virtual void CharKerning( const SvxKerningItem& );
+
+ /// Sfx item RES_CHRATR_LANGUAGE
+ virtual void CharLanguage( const SvxLanguageItem& );
+
+ /// Sfx item RES_CHRATR_POSTURE
+ virtual void CharPosture( const SvxPostureItem& );
+
+ /// Sfx item RES_CHRATR_SHADOWED
+ virtual void CharShadow( const SvxShadowedItem& );
+
+ /// Sfx item RES_CHRATR_UNDERLINE
+ virtual void CharUnderline( const SvxUnderlineItem& );
+
+ /// Sfx item RES_CHRATR_WEIGHT
+ virtual void CharWeight( const SvxWeightItem& );
+
+ /// Sfx item RES_CHRATR_AUTOKERN
+ virtual void CharAutoKern( const SvxAutoKernItem& );
+
+ /// Sfx item RES_CHRATR_BLINK
+ virtual void CharAnimatedText( const SvxBlinkItem& );
+
+ /// Sfx item RES_CHRATR_BACKGROUND
+ virtual void CharBackground( const SvxBrushItem& );
+
+ /// Sfx item RES_CHRATR_CJK_FONT
+ virtual void CharFontCJK( const SvxFontItem& );
+
+ /// Sfx item RES_CHRATR_CJK_FONTSIZE
+ virtual void CharFontSizeCJK( const SvxFontHeightItem& rHt ) { CharFontSize( rHt ); }
+
+ /// Sfx item RES_CHRATR_CJK_LANGUAGE
+ virtual void CharLanguageCJK( const SvxLanguageItem& rHt ) { CharLanguage( rHt ); }
+
+ /// Sfx item RES_CHRATR_CJK_POSTURE
+ virtual void CharPostureCJK( const SvxPostureItem& rHt ) { CharPosture( rHt ); }
+
+ /// Sfx item RES_CHRATR_CJK_WEIGHT
+ virtual void CharWeightCJK( const SvxWeightItem& rHt ) { CharWeight( rHt ); }
+
+ /// Sfx item RES_CHRATR_CTL_FONT
+ virtual void CharFontCTL( const SvxFontItem& );
+
+ /// Sfx item RES_CHRATR_CTL_FONTSIZE
+ virtual void CharFontSizeCTL( const SvxFontHeightItem& rHt ) { CharFontSize( rHt ); }
+
+ /// Sfx item RES_CHRATR_CTL_LANGUAGE
+ virtual void CharLanguageCTL( const SvxLanguageItem& rHt ) { CharLanguage( rHt ); }
+
+ /// Sfx item RES_CHRATR_CTL_POSTURE
+ virtual void CharPostureCTL( const SvxPostureItem& );
+
+ /// Sfx item RES_CHRATR_CTL_WEIGHT
+ virtual void CharWeightCTL( const SvxWeightItem& );
+
+ /// Sfx item RES_CHRATR_ROTATE
+ virtual void CharRotate( const SvxCharRotateItem& );
+
+ /// Sfx item RES_CHRATR_EMPHASIS_MARK
+ virtual void CharEmphasisMark( const SvxEmphasisMarkItem& rHt );
+
+ /// Sfx item RES_CHRATR_TWO_LINES
+ virtual void CharTwoLines( const SvxTwoLinesItem& );
+
+ /// Sfx item RES_CHRATR_SCALEW
+ virtual void CharScaleWidth( const SvxCharScaleWidthItem& );
+
+ /// Sfx item RES_CHRATR_RELIEF
+ virtual void CharRelief( const SvxCharReliefItem& );
+
+ /// Sfx item RES_CHRATR_HIDDEN
+ virtual void CharHidden( const SvxCharHiddenItem& );
+
+ /// Sfx item RES_TXTATR_INETFMT
+ virtual void TextINetFormat( const SwFmtINetFmt& );
+
+ /// Sfx item RES_TXTATR_CHARFMT
+ virtual void TextCharFormat( const SwFmtCharFmt& );
+
+ /// Sfx item RES_TXTATR_FTN
+ virtual void TextFootnote_Impl( const SwFmtFtn& );
+
+ /// Sfx item RES_TXTATR_HARDBLANK
+ virtual void TextHardBlank( const SwFmtHardBlank& );
+
+ /// Sfx item RES_PARATR_LINESPACING
+ virtual void ParaLineSpacing_Impl( short nSpace, short nMulti );
+
+ /// Sfx item RES_PARATR_ADJUST
+ virtual void ParaAdjust( const SvxAdjustItem& rHt );
+
+ /// Sfx item RES_PARATR_SPLIT
+ virtual void ParaSplit( const SvxFmtSplitItem& );
+
+ /// Sfx item RES_PARATR_WIDOWS
+ virtual void ParaWidows( const SvxWidowsItem& rHt );
+
+ /// Sfx item RES_PARATR_TABSTOP
+ virtual void ParaTabStop( const SvxTabStopItem& rHt );
+
+ /// Sfx item RES_PARATR_HYPHENZONE
+ virtual void ParaHyphenZone( const SvxHyphenZoneItem& );
+
+ /// Sfx item RES_PARATR_NUMRULE
+ virtual void ParaNumRule_Impl( const SwTxtNode *pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId );
+
+ /// Sfx item RES_PARATR_SCRIPTSPACE
+ virtual void ParaScriptSpace( const SfxBoolItem& );
+
+ /// Sfx item RES_PARATR_VERTALIGN
+ virtual void ParaVerticalAlign( const SvxParaVertAlignItem& );
+
+ /// Sfx item RES_PARATR_SNAPTOGRID
+ virtual void ParaSnapToGrid( const SvxParaGridItem& );
+
+ /// Sfx item RES_FRM_SIZE
+ virtual void FormatFrameSize( const SwFmtFrmSize& );
+
+ /// Sfx item RES_PAPER_BIN
+ virtual void FormatPaperBin( const SvxPaperBinItem& );
+
+ /// Sfx item RES_LR_SPACE
+ virtual void FormatLRSpace( const SvxLRSpaceItem& );
+
+ /// Sfx item RES_UL_SPACE
+ virtual void FormatULSpace( const SvxULSpaceItem& rHt );
+
+ /// Sfx item RES_SURROUND
+ virtual void FormatSurround( const SwFmtSurround& );
+
+ /// Sfx item RES_VERT_ORIENT
+ virtual void FormatVertOrientation( const SwFmtVertOrient& );
+
+ /// Sfx item RES_HORI_ORIENT
+ virtual void FormatHorizOrientation( const SwFmtHoriOrient& );
+
+ /// Sfx item RES_ANCHOR
+ virtual void FormatAnchor( const SwFmtAnchor& );
+
+ /// Sfx item RES_BACKGROUND
+ virtual void FormatBackground( const SvxBrushItem& );
+
+ /// Sfx item RES_BOX
+ virtual void FormatBox( const SvxBoxItem& );
+
+ /// Sfx item RES_COL
+ virtual void FormatColumns_Impl( USHORT nCols, const SwFmtCol & rCol, bool bEven, SwTwips nPageSize );
+
+ /// Sfx item RES_KEEP
+ virtual void FormatKeep( const SvxFmtKeepItem& );
+
+ /// Sfx item RES_TEXTGRID
+ virtual void FormatTextGrid( const SwTextGridItem& );
+
+ /// Sfx item RES_LINENUMBER
+ virtual void FormatLineNumbering( const SwFmtLineNumber& );
+
+ /// Sfx item RES_FRAMEDIR
+ virtual void FormatFrameDirection( const SvxFrameDirectionItem& );
+
+ /// Write the expanded field
+ virtual void WriteExpand( const SwField* pFld );
+
+ virtual void RefField ( const SwField& rFld, const String& rRef );
+ virtual void HiddenField( const SwField& rFld );
+ virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd );
+ virtual void PostitField( const SwField* pFld );
+ virtual bool DropdownField( const SwField* pFld );
+
+ virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark );
+
+ /// Reference to the export, where to get the data from
+ WW8Export &m_rWW8Export;
+
+ /// For output of styles.
+ ///
+ /// We have to remember these positions between the StartStyle() and
+ /// EndStyle().
+ USHORT nPOPosStdLen1, nPOPosStdLen2;
+
+ /// For output of styles.
+ ///
+ /// We have to remember this position between StartStyleProperties() and
+ /// EndStyleProperties().
+ USHORT m_nStyleStartSize, m_nStyleLenPos;
+
+ /// For output of styles.
+ ///
+ /// Used between StartStyles() and EndStyles().
+ ULONG m_nStyAnzPos;
+
+ /// For output of run properties.
+ ///
+ /// We have to remember the number of field results, and do not export end
+ /// of the field results if we were forced to split text.
+ USHORT m_nFieldResults;
+
+public:
+ WW8AttributeOutput( WW8Export &rWW8Export ) : AttributeOutputBase(), m_rWW8Export( rWW8Export ) {}
+ virtual ~WW8AttributeOutput() {}
+
+ /// Return the right export class.
+ virtual MSWordExportBase& GetExport() { return m_rWW8Export; }
+
+protected:
+ /// Output the bold etc. attributes
+ void OutputWW8Attribute( BYTE nId, bool bVal );
+
+ /// Output the bold etc. attributes, the Complex Text Layout version
+ void OutputWW8AttributeCTL( BYTE nId, bool bVal );
+
+};
+
+#endif // _WW8ATTRIBUTEOUTPUT_HXX_
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index 90bd25b489a3..81d605457e9c 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -187,7 +187,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks,
-1 );
pCNd = aIdx.GetNode().GetCntntNode();
SwPosition aPos( aIdx, SwIndex( pCNd, pCNd->Len() ));
- pD->Copy( aPam, aPos );
+ pD->Copy( aPam, aPos, false );
rBlocks.PutDoc();
}
}
@@ -258,92 +258,21 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile )
bool WW8GlossaryFib::IsGlossaryFib()
{
- if (!nFibError)
- {
- INT16 nFibMin;
- INT16 nFibMax;
- switch(nVersion)
- {
- case 6:
- nFibMin = 0x0065; // von 101 WinWord 6.0
- // 102 "
- // und 103 WinWord 6.0 fuer Macintosh
- // 104 "
- nFibMax = 0x0069; // bis 105 WinWord 95
- break;
- case 7:
- nFibMin = 0x0069; // von 105 WinWord 95
- nFibMax = 0x0069; // bis 105 WinWord 95
- break;
- case 8:
- nFibMin = 0x006A; // von 106 WinWord 97
- nFibMax = 0x00c2; // bis 194 WinWord 2000
- break;
- default:
- nFibMin = 0; // Programm-Fehler!
- nFibMax = 0;
- nFib = nFibBack = 1;
- break;
- }
- if ( (nFibBack < nFibMin) || (nFibBack > nFibMax) )
- nFibError = ERR_SWG_READ_ERROR; // Error melden
- }
- return !nFibError;
+ // fGlsy will indicate whether this has AutoText or not
+ return fGlsy;
}
-UINT32 WW8GlossaryFib::FindGlossaryFibOffset(SvStream &rTableStrm,
- SvStream &rStrm, const WW8Fib &rFib)
+UINT32 WW8GlossaryFib::FindGlossaryFibOffset(SvStream & /* rTableStrm */,
+ SvStream & /* rStrm */,
+ const WW8Fib &rFib)
{
- WW8PLCF aPlc( &rTableStrm, rFib.fcPlcfsed, rFib.lcbPlcfsed, 12 );
- WW8_CP start,ende;
- void *pData;
- aPlc.Get(start,ende,pData);
- UINT32 nPo = SVBT32ToUInt32((BYTE *)pData+2);
- //*pOut << hex << "Offset of last SEPX is " << nPo << endl;
-
- UINT16 nLen;
- if (nPo != 0xFFFFFFFF)
- {
- rStrm.Seek(nPo);
- rStrm >> nLen;
- }
- else
- {
- nPo=0;
- nLen=0;
- }
-
-// *pOut << hex << "Ends at " << nPo+len << endl;
- nPo+=nLen;
- UINT32 nEndLastPage;
- if (nPo%512)
+ UINT32 nGlossaryFibOffset = 0;
+ if ( rFib.fDot ) // its a template
{
- nEndLastPage = (nPo)/512;
- nEndLastPage = (nEndLastPage+1)*512;
+ if ( rFib.pnNext )
+ nGlossaryFibOffset = ( rFib.pnNext * 512 );
}
- else
- nEndLastPage = nPo;
-
- //*pOut << hex << "SECOND FIB SHOULD BE FOUND at " << k << endl;
-
- WW8PLCF xcPLCF( &rTableStrm, rFib.fcPlcfbteChpx,
- rFib.lcbPlcfbteChpx, (8 > rFib.nVersion) ? 2 : 4);
-
- xcPLCF.Get(start,ende,pData);
-
- nPo = SVBT32ToUInt32((BYTE *)pData);
- //*pOut << hex << "Offset of last CHPX is " << (nPo+1) *512<< endl;
- if (((nPo+1)*512) > nEndLastPage) nEndLastPage = (nPo+1)*512;
-
- WW8PLCF xpPLCF( &rTableStrm, rFib.fcPlcfbtePapx,
- rFib.lcbPlcfbtePapx, (8 > rFib.nVersion) ? 2 : 4);
- xpPLCF.Get(start,ende,pData);
- nPo = SVBT32ToUInt32((BYTE *)pData);
- //*pOut << hex << "Offset of last PAPX is " << nPo *512 << endl;
- if (((nPo+1)*512) > nEndLastPage) nEndLastPage = (nPo+1)*512;
-
- //*pOut << hex << "SECOND FIB SHOULD BE FOUND at " << nEndLastPage << endl;
- return nEndLastPage;
+ return nGlossaryFibOffset;
}
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index d19a0869b1b1..4948ac5eddae 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2749,6 +2749,8 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
if ( bMoveToBackgrd )
aFlySet.Put(SvxOpaqueItem(RES_OPAQUE,false));
+ String aObjName = pObject->GetName();
+
SwFrmFmt* pRetFrmFmt = 0;
if (bReplaceable)
{
@@ -2834,6 +2836,10 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
// <--
if (!IsInlineEscherHack())
MapWrapIntoFlyFmt(pRecord, pRetFrmFmt);
+
+ // Set frame name with object name
+ if( aObjName.Len() )
+ pRetFrmFmt->SetName( aObjName );
return AddAutoAnchor(pRetFrmFmt);
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b02ba42344eb..f8bc1ce18537 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2220,39 +2220,60 @@ void SwWW8ImplReader::PostProcessAttrs()
case they default to CP1252. If not then its perhaps that the font encoding
is only in use for 6/7 and for 8+ if we are in 8bit mode then the encoding
is always 1252.
+
+ So a encoding converter that on an undefined character attempts to
+ convert from 1252 on the undefined character
*/
-sal_Unicode Custom8BitToUnicode(rtl_TextToUnicodeConverter hConverter,
- sal_Char cChar)
+sal_Size Custom8BitToUnicode(rtl_TextToUnicodeConverter hConverter,
+ sal_Char *pIn, sal_Size nInLen, sal_Unicode *pOut, sal_Size nOutLen)
{
const sal_uInt32 nFlags =
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE |
+ RTL_TEXTTOUNICODE_FLAGS_FLUSH;
+
+ const sal_uInt32 nFlags2 =
RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE |
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE |
RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE |
RTL_TEXTTOUNICODE_FLAGS_FLUSH;
- sal_Unicode nConvChar;
- sal_uInt32 nInfo=0;
- sal_Size nSrcBytes=0;
- sal_Size nDestChars = rtl_convertTextToUnicode(hConverter, 0,
- &cChar, 1, &nConvChar, 1, nFlags, &nInfo, &nSrcBytes );
+ sal_Size nDestChars=0;
+ sal_Size nConverted=0;
- if (nInfo & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE)
+ do
{
- rtl_TextToUnicodeConverter hCP1252Converter =
- rtl_createTextToUnicodeConverter(RTL_TEXTENCODING_MS_1252);
- nDestChars = rtl_convertTextToUnicode(hCP1252Converter, 0,
- &cChar, 1, &nConvChar, 1, nFlags, &nInfo, &nSrcBytes );
- rtl_destroyTextToUnicodeConverter(hCP1252Converter);
- }
+ sal_uInt32 nInfo = 0;
+ sal_Size nThisConverted=0;
- ASSERT(nDestChars == 1, "impossible to get more than 1 char");
+ nDestChars += rtl_convertTextToUnicode(hConverter, 0,
+ pIn+nConverted, nInLen-nConverted,
+ pOut+nDestChars, nOutLen-nDestChars,
+ nFlags, &nInfo, &nThisConverted);
- ASSERT(nInfo == 0, "A character conversion failed, gulp!");
+ ASSERT(nInfo == 0, "A character conversion failed!");
- if (nDestChars == 1)
- return nConvChar;
- else
- return cChar;
+ nConverted += nThisConverted;
+
+ if (
+ nInfo & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR ||
+ nInfo & RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
+ )
+ {
+ sal_Size nOtherConverted;
+ rtl_TextToUnicodeConverter hCP1252Converter =
+ rtl_createTextToUnicodeConverter(RTL_TEXTENCODING_MS_1252);
+ nDestChars += rtl_convertTextToUnicode(hCP1252Converter, 0,
+ pIn+nConverted, 1,
+ pOut+nDestChars, nOutLen-nDestChars,
+ nFlags2, &nInfo, &nOtherConverted);
+ rtl_destroyTextToUnicodeConverter(hCP1252Converter);
+ nConverted+=1;
+ }
+ } while (nConverted < nInLen);
+
+ return nDestChars;
}
bool SwWW8ImplReader::LangUsesHindiNumbers(USHORT nLang)
@@ -2318,12 +2339,18 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
// (re)alloc UniString data
String sPlainCharsBuf;
- sal_Unicode* pWork = sPlainCharsBuf.AllocBuffer( nLen );
+ sal_Unicode* pBuffer = sPlainCharsBuf.AllocBuffer( nLen );
+ sal_Unicode* pWork = pBuffer;
+
+ sal_Char* p8Bits = NULL;
rtl_TextToUnicodeConverter hConverter = 0;
if (!bIsUnicode || bVer67)
hConverter = rtl_createTextToUnicodeConverter(eSrcCharSet);
+ if (!bIsUnicode)
+ p8Bits = new sal_Char[nLen];
+
// read the stream data
BYTE nBCode = 0;
UINT16 nUCode;
@@ -2354,7 +2381,6 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
if ((32 > nUCode) || (0xa0 == nUCode))
{
pStrm->SeekRel( bIsUnicode ? -2 : -1 );
- sPlainCharsBuf.ReleaseBufferAccess( nL2 );
break; // Sonderzeichen < 32, == 0xa0 gefunden
}
@@ -2375,21 +2401,28 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
}
else
{
- *pWork = Custom8BitToUnicode(hConverter, static_cast< sal_Char >(nUCode & 0x00FF));
+ sal_Char cTest = static_cast< sal_Char >(nUCode & 0x00FF);
+ Custom8BitToUnicode(hConverter, &cTest, 1, pWork, 1);
}
}
}
else
- *pWork = Custom8BitToUnicode(hConverter, nBCode);
-
- if (m_bRegardHindiDigits && bBidi && LangUsesHindiNumbers(nCTLLang))
- {
- *pWork = TranslateToHindiNumbers(*pWork);
- }
+ p8Bits[nL2] = nBCode;
}
if (nL2)
{
+ xub_StrLen nEndUsed = nL2;
+
+ if (!bIsUnicode)
+ nEndUsed = Custom8BitToUnicode(hConverter, p8Bits, nL2, pBuffer, nLen);
+
+ for( xub_StrLen nI = 0; nI < nLen; ++nI, ++pBuffer )
+ if (m_bRegardHindiDigits && bBidi && LangUsesHindiNumbers(nCTLLang))
+ *pBuffer = TranslateToHindiNumbers(*pBuffer);
+
+ sPlainCharsBuf.ReleaseBufferAccess( nEndUsed );
+
AddTextToParagraph(sPlainCharsBuf);
rPos += nL2;
if (!maApos.back()) //a para end in apo doesn't count
@@ -2398,6 +2431,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
if (hConverter)
rtl_destroyTextToUnicodeConverter(hConverter);
+ delete [] p8Bits;
return nL2 >= nLen;
}
@@ -2408,8 +2442,10 @@ bool SwWW8ImplReader::AddTextToParagraph(const String& rAddString)
{
/*
#ifdef DEBUG
- ::std::clog << "<addTextToParagraph>" << dbg_out(rAddString)
- << "</addTextToParagraph>" << ::std::endl;
+//!! does not compile with debug=t -> unresolved external (dbg_out),
+//!! sommeone who knows what he wants to get should fix this
+// ::std::clog << "<addTextToParagraph>" << dbg_out(rAddString)
+// << "</addTextToParagraph>" << ::std::endl;
#endif
*/
if ((pNd->GetTxt().Len() + rAddString.Len()) < STRING_MAXLEN -1)
@@ -2686,12 +2722,8 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
break; // Auto-Fussnoten-Nummer
#if OSL_DEBUG_LEVEL > 1
default:
- {
- String sUnknown( '<' );
- sUnknown += String::CreateFromInt32( nWCharVal );
- sUnknown += '>';
- rDoc.Insert( *pPaM, sUnknown, true );
- }
+ ::std::clog << "<unknownValue val=\"" << nWCharVal << "\">" << ::std::endl;
+ break;
#endif
}
@@ -4312,6 +4344,13 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss)
DecryptRC4(aCtx, *pDataStream, aDecryptData);
pDataStream = &aDecryptData;
}
+ SfxMedium* pMedium = mpDocShell->GetMedium();
+ if ( pMedium )
+ {
+ SfxItemSet* pSet = pMedium->GetItemSet();
+ if ( pSet )
+ pSet->Put( SfxStringItem(SID_PASSWORD, sUniPassword) );
+ }
}
}
}
@@ -4326,8 +4365,6 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss)
pWwFib = new WW8Fib(*pStrm, nWantedVersion);
if (pWwFib->nFibError)
nErrRet = ERR_SWG_READ_ERROR;
- if(!nErrRet && mpDocShell->GetDoc())
- mpDocShell->GetDoc()->SetWinEncryption(true);
}
}
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 15118e9abdb0..777b2e0055c3 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -54,12 +54,11 @@
#include <utility>
#endif
-#ifndef SW_TRACER
#include "tracer.hxx"
-#endif
#include "ww8struc.hxx" // WW8_BRC
#include "ww8scan.hxx" // WW8Fib
#include "ww8glsy.hxx"
+#include "wrtww8.hxx"
#include "../inc/msfilter.hxx"
class SwDoc;
@@ -576,7 +575,7 @@ public:
const ::com::sun::star::awt::Size& rSize,
com::sun::star::uno::Reference <
com::sun::star::drawing::XShape > *pShape,BOOL bFloatingCtrl);
- bool ExportControl(Writer &rWrt, const SdrObject *pObj);
+ bool ExportControl(WW8Export &rWrt, const SdrObject *pObj);
};
class SwMSDffManager : public SvxMSDffManager
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index da3533819223..7f94e2f495e8 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -81,6 +81,8 @@
#include <frmatr.hxx>
+#include <iostream>
+
#define MAX_COL 64 // WW6-Beschreibung: 32, WW6-UI: 31 & WW8-UI: 63!
using namespace ::com::sun::star;
@@ -1399,14 +1401,34 @@ void WW8TabBandDesc::ProcessSprmTInsert(const BYTE* pParamsTInsert)
if( nWwCols && pParamsTInsert ) // set one or more cell length(s)
{
BYTE nitcInsert = pParamsTInsert[0]; // position at which to insert
+ if (nitcInsert >= MAX_COL) // cannot insert into cell outside max possible index
+ return;
BYTE nctc = pParamsTInsert[1]; // number of cells
USHORT ndxaCol = SVBT16ToShort( pParamsTInsert+2 );
short nNewWwCols;
if (nitcInsert > nWwCols)
+ {
nNewWwCols = nitcInsert+nctc;
+ //if new count would be outside max possible count, clip it, and calc a new replacement
+ //legal nctc
+ if (nNewWwCols > MAX_COL)
+ {
+ nNewWwCols = MAX_COL;
+ nctc = ::sal::static_int_cast<BYTE>(nNewWwCols-nitcInsert);
+ }
+ }
else
+ {
nNewWwCols = nWwCols+nctc;
+ //if new count would be outside max possible count, clip it, and calc a new replacement
+ //legal nctc
+ if (nNewWwCols > MAX_COL)
+ {
+ nNewWwCols = MAX_COL;
+ nctc = ::sal::static_int_cast<BYTE>(nNewWwCols-nWwCols);
+ }
+ }
WW8_TCell *pTC2s = new WW8_TCell[nNewWwCols];
setcelldefaults(pTC2s, nNewWwCols);
@@ -1542,25 +1564,42 @@ void WW8TabBandDesc::ProcessSprmTDelete(const BYTE* pParamsTDelete)
if( nWwCols && pParamsTDelete ) // set one or more cell length(s)
{
BYTE nitcFirst= pParamsTDelete[0]; // first col to be deleted
+ if (nitcFirst >= nWwCols) // first index to delete from doesn't exist
+ return;
BYTE nitcLim = pParamsTDelete[1]; // (last col to be deleted)+1
+ if (nitcLim <= nitcFirst) // second index to delete to is not greater than first index
+ return;
- BYTE nShlCnt = static_cast< BYTE >(nWwCols - nitcLim); // count of cells to be shifted
-
+ /*
+ * sprmTDelete causes any rgdxaCenter and rgtc entries whose index is
+ * greater than or equal to itcLim to be moved
+ */
+ int nShlCnt = nWwCols - nitcLim; // count of cells to be shifted
- WW8_TCell* pAktTC = pTCs + nitcFirst;
- int i = 0;
- for( ; i < nShlCnt; i++, ++pAktTC )
+ if (nShlCnt >= 0) //There exist entries whose index is greater than or equal to itcLim
{
- // adjust the left x-position
- nCenter[nitcFirst + i] = nCenter[nitcLim + i];
+ WW8_TCell* pAktTC = pTCs + nitcFirst;
+ int i = 0;
+ while( i < nShlCnt )
+ {
+ // adjust the left x-position
+ nCenter[nitcFirst + i] = nCenter[nitcLim + i];
+
+ // adjust the cell's borders
+ *pAktTC = pTCs[ nitcLim + i];
- // adjust the cell's borders
- *pAktTC = pTCs[ nitcLim + i];
+ ++i;
+ ++pAktTC;
+ }
+ // adjust the left x-position of the dummy at the very end
+ nCenter[nitcFirst + i] = nCenter[nitcLim + i];
}
- // adjust the left x-position of the dummy at the very end
- nCenter[nitcFirst + i] = nCenter[nitcLim + i];
- nWwCols -= (nitcLim - nitcFirst);
+ short nCellsDeleted = nitcLim - nitcFirst;
+ //clip delete request to available number of cells
+ if (nCellsDeleted > nWwCols)
+ nCellsDeleted = nWwCols;
+ nWwCols -= nCellsDeleted;
}
}
@@ -2343,7 +2382,8 @@ void WW8TabDesc::CalcDefaults()
}
} */
- if (nMinLeft && ((!bIsBiDi && text::HoriOrientation::LEFT == eOri) || (bIsBiDi && text::HoriOrientation::RIGHT == eOri)))
+ if ((nMinLeft && !bIsBiDi && text::HoriOrientation::LEFT == eOri) ||
+ (nMinLeft != -108 && bIsBiDi && text::HoriOrientation::RIGHT == eOri)) // Word sets the first nCenter value to -108 when no indent is used
eOri = text::HoriOrientation::LEFT_AND_WIDTH; // absolutely positioned
nDefaultSwCols = nMinCols; // da Zellen einfuegen billiger ist als Mergen
@@ -2509,9 +2549,20 @@ void WW8TabDesc::CreateSwTable()
//ability to set the margin.
SvxLRSpaceItem aL( RES_LR_SPACE );
// set right to original DxaLeft (i28656)
- aL.SetLeft( !bIsBiDi ?
- static_cast<long>(GetMinLeft()) :
- static_cast<long>(pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft) );
+
+ long nLeft = 0;
+ if (!bIsBiDi)
+ nLeft = GetMinLeft();
+ else
+ {
+ if (nPreferredWidth)
+ nLeft = pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft;
+ else
+ nLeft = -GetMinLeft();
+ }
+
+ aL.SetLeft(nLeft);
+
aItemSet.Put(aL);
}
}
@@ -3528,6 +3579,45 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp)
return bSuccess;
}
+bool lcl_PamContainsFly(SwPaM & rPam)
+{
+ bool bResult = false;
+ SwNodeRange aRg( rPam.Start()->nNode, rPam.End()->nNode );
+ SwDoc * pDoc = rPam.GetDoc();
+
+ sal_uInt16 n = 0;
+ SwSpzFrmFmts * pSpzFmts = pDoc->GetSpzFrmFmts();
+ sal_uInt16 nCount = pSpzFmts->Count();
+ while (!bResult && n < nCount)
+ {
+ SwFrmFmt* pFly = (*pSpzFmts)[n];
+ const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
+
+ switch (pAnchor->GetAnchorId())
+ {
+ case FLY_AT_CNTNT:
+ case FLY_AUTO_CNTNT:
+ {
+ const SwPosition* pAPos = pAnchor->GetCntntAnchor();
+
+ if (pAPos != NULL &&
+ aRg.aStart <= pAPos->nNode &&
+ pAPos->nNode <= aRg.aEnd)
+ {
+ bResult = true;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ ++n;
+ }
+
+ return bResult;
+}
+
void SwWW8ImplReader::TabCellEnd()
{
if (nInTable && pTableDesc)
@@ -3538,12 +3628,12 @@ void SwWW8ImplReader::TabCellEnd()
&& pWFlyPara == NULL
&& mpTableEndPaM.get() != NULL
&& (! SwPaM::Overlap(*pPaM, *mpTableEndPaM))
- && SwPaM::LessThan(*mpTableEndPaM, *pPaM))
+ && SwPaM::LessThan(*mpTableEndPaM, *pPaM)
+ && mpTableEndPaM->GetPoint()->nNode.GetNode().IsTxtNode()
+ && !lcl_PamContainsFly(*mpTableEndPaM)
+ )
{
- if (mpTableEndPaM->GetPoint()->nNode.GetNode().IsTxtNode())
- {
- rDoc.DelFullPara(*mpTableEndPaM);
- }
+ rDoc.DelFullPara(*mpTableEndPaM);
}
}
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 9f1cfade775e..b45aa575baf4 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2634,6 +2634,28 @@ bool SwWW8ImplReader::AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase)
return bExtras;
}
+static void EnsureMaxLevelForTemplates(SwTOXBase& rBase)
+{
+ //If the TOC contains Template entries at levels > the evaluation level
+ //that was initially taken from the max normal outline level of the word TOC
+ //then we cannot use that for the evaluation level because writer cuts off
+ //all styles above that level, while word just cuts off the "standard"
+ //outline styles, we have no option but to expand to the highest level
+ //Word included.
+ if ((rBase.GetLevel() != MAXLEVEL) && (nsSwTOXElement::TOX_TEMPLATE & rBase.GetCreateType()))
+ {
+ for (USHORT nI = MAXLEVEL; nI > 0; --nI)
+ {
+ String sStyles(rBase.GetStyleNames(nI-1));
+ if (rBase.GetStyleNames(nI-1).Len())
+ {
+ rBase.SetLevel(nI);
+ break;
+ }
+ }
+ }
+}
+
void lcl_toxMatchTSwitch(SwWW8ImplReader& rReader, SwTOXBase& rBase,
_ReadFieldParams& rParam)
{
@@ -2727,6 +2749,19 @@ bool wwSectionManager::WillHavePageDescHere(SwNodeIndex aIdx) const
return bRet;
}
+USHORT lcl_GetMaxValidWordTOCLevel(const SwForm &rForm)
+{
+ // GetFormMax() returns level + 1, hence the -1
+ USHORT nRet = rForm.GetFormMax()-1;
+
+ // If the max of this type of TOC is greater than the max of a word
+ // possible toc, then clip to the word max
+ if (nRet > WW8ListManager::nMaxLevel)
+ nRet = WW8ListManager::nMaxLevel;
+
+ return nRet;
+}
+
eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
{
if (pF->nLRes < 3)
@@ -2883,8 +2918,8 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
case 'o':
{
USHORT nVal;
- if( !aReadParam.GetTokenSttFromTo(0, &nVal, MAXLEVEL) )
- nVal = aOrigForm.GetFormMax()-1;
+ if( !aReadParam.GetTokenSttFromTo(0, &nVal, WW8ListManager::nMaxLevel) )
+ nVal = lcl_GetMaxValidWordTOCLevel(aOrigForm);
if( nMaxLevel < nVal )
nMaxLevel = nVal;
eCreateFrom |= nsSwTOXElement::TOX_OUTLINELEVEL;
@@ -2896,7 +2931,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
case 'l':
{
USHORT nVal;
- if( aReadParam.GetTokenSttFromTo(0, &nVal, MAXLEVEL) )
+ if( aReadParam.GetTokenSttFromTo(0, &nVal, WW8ListManager::nMaxLevel) )
{
if( nMaxLevel < nVal )
nMaxLevel = nVal;
@@ -2969,7 +3004,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
// read START and END param
USHORT nStart, nEnd;
if( !aReadParam.GetTokenSttFromTo( &nStart, &nEnd,
- MAXLEVEL ) )
+ WW8ListManager::nMaxLevel ) )
{
nStart = 1;
nEnd = aOrigForm.GetFormMax()-1;
@@ -3052,7 +3087,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
}
if (!nMaxLevel)
- nMaxLevel = MAXLEVEL;
+ nMaxLevel = WW8ListManager::nMaxLevel;
pBase->SetLevel(nMaxLevel);
const TOXTypes eType = pBase->GetTOXType()->GetType();
@@ -3110,6 +3145,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
if (eCreateFrom)
pBase->SetCreate(eCreateFrom);
+ EnsureMaxLevelForTemplates(*pBase);
}
break;
case TOX_ILLUSTRATIONS:
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 8a2763c22cf1..118b2f165e3a 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -778,6 +778,11 @@ void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
)
{
SwFmtLineNumber aLN;
+ if (const SwFmtLineNumber* pLN
+ = (const SwFmtLineNumber*)GetFmtAttr(RES_LINENUMBER))
+ {
+ aLN.SetCountLines( pLN->IsCount() );
+ }
aLN.SetStartValue(1 + rSection.maSep.lnnMin);
NewAttr(aLN);
pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_LINENUMBER);
@@ -2307,14 +2312,12 @@ WW8DupProperties::WW8DupProperties(SwDoc &rDoc, SwWW8FltControlStack *pStk)
const SwFltStackEntry* pEntry = (*pCtrlStck)[ i ];
if(pEntry->bLocked)
{
- if (pEntry->pAttr->Which() > RES_CHRATR_BEGIN &&
- pEntry->pAttr->Which() < RES_CHRATR_END)
+ if (isCHRATR(pEntry->pAttr->Which()))
{
aChrSet.Put( *pEntry->pAttr );
}
- else if (pEntry->pAttr->Which() > RES_PARATR_BEGIN &&
- pEntry->pAttr->Which() < RES_PARATR_END)
+ else if (isPARATR(pEntry->pAttr->Which()))
{
aParSet.Put( *pEntry->pAttr );
}
@@ -3877,6 +3880,12 @@ void SwWW8ImplReader::Read_NoLineNumb(USHORT , const BYTE* pData, short nLen)
return;
}
SwFmtLineNumber aLN;
+ if (const SwFmtLineNumber* pLN
+ = (const SwFmtLineNumber*)GetFmtAttr(RES_LINENUMBER))
+ {
+ aLN.SetStartValue( pLN->GetStartValue() );
+ }
+
aLN.SetCountLines( pData && (0 == *pData) );
NewAttr( aLN );
}
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 0aceb981edff..f3a4c3630e4c 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -5624,14 +5624,15 @@ WW8Fib::WW8Fib(BYTE nVer)
// <-- #i90932#
}
-bool WW8Fib::Write(SvStream& rStrm)
+bool WW8Fib::WriteHeader(SvStream& rStrm)
{
- BYTE *pDataPtr = new BYTE[ fcMin ];
- BYTE *pData = pDataPtr;
- memset( pData, 0, fcMin );
-
bool bVer8 = 8 == nVersion;
+ size_t nUnencryptedHdr = bVer8 ? 0x44 : 0x24;
+ BYTE *pDataPtr = new BYTE[ nUnencryptedHdr ];
+ BYTE *pData = pDataPtr;
+ memset( pData, 0, nUnencryptedHdr );
+
ULONG nPos = rStrm.Tell();
cbMac = rStrm.Seek( STREAM_SEEK_TO_END );
rStrm.Seek( nPos );
@@ -5652,6 +5653,7 @@ bool WW8Fib::Write(SvStream& rStrm)
if( fWhichTblStm ) nBits16 |= 0x0200;
if( fExtChar ) nBits16 |= 0x1000;
if( fFarEast ) nBits16 |= 0x4000; // #i90932#
+ if( fObfuscated ) nBits16 |= 0x8000;
Set_UInt16( pData, nBits16 );
Set_UInt16( pData, nFibBack );
@@ -5697,6 +5699,27 @@ bool WW8Fib::Write(SvStream& rStrm)
// Marke: "rglw" Beginning of the array of longs
Set_UInt32( pData, cbMac );
+ rStrm.Write( pDataPtr, nUnencryptedHdr );
+ delete[] pDataPtr;
+ return 0 == rStrm.GetError();
+}
+
+bool WW8Fib::Write(SvStream& rStrm)
+{
+ bool bVer8 = 8 == nVersion;
+
+ WriteHeader( rStrm );
+
+ size_t nUnencryptedHdr = bVer8 ? 0x44 : 0x24;
+
+ BYTE *pDataPtr = new BYTE[ fcMin - nUnencryptedHdr ];
+ BYTE *pData = pDataPtr;
+ memset( pData, 0, fcMin - nUnencryptedHdr );
+
+ ULONG nPos = rStrm.Tell();
+ cbMac = rStrm.Seek( STREAM_SEEK_TO_END );
+ rStrm.Seek( nPos );
+
// 2 Longs uebergehen, da unwichtiger Quatsch
pData += 2 * sizeof( INT32);
@@ -5905,7 +5928,7 @@ bool WW8Fib::Write(SvStream& rStrm)
Set_UInt32( pData, 0);
}
- rStrm.Write( pDataPtr, fcMin );
+ rStrm.Write( pDataPtr, fcMin - nUnencryptedHdr );
delete[] pDataPtr;
return 0 == rStrm.GetError();
}
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 68db5ea6c2c9..2bcf97819f21 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -79,13 +79,13 @@ namespace SL
DEFCONSTSTRINGARRAY(MSMacroCmds);
}
-/*
- winword strings are typically Belt and Braces strings preceeded with a
- pascal style count, and ending with a c style 0 terminator. 16bit chars
- and count for ww8+ and 8bit chars and count for ww7-. The count and 0
- can be checked for integrity to catch errors (e.g. lotus created documents)
- where in error 8bit strings are used instead of 16bits strings for style
- names.
+/**
+ winword strings are typically Belt and Braces strings preceeded with a
+ pascal style count, and ending with a c style 0 terminator. 16bit chars
+ and count for ww8+ and 8bit chars and count for ww7-. The count and 0
+ can be checked for integrity to catch errors (e.g. lotus created documents)
+ where in error 8bit strings are used instead of 16bits strings for style
+ names.
*/
template<class C> class wwString
{
@@ -98,7 +98,7 @@ typedef wwString<sal_uInt16> ww8String;
struct SprmInfo
{
- sal_uInt16 nId; //A ww8 sprm is hardcoded as 16bits
+ sal_uInt16 nId; ///< A ww8 sprm is hardcoded as 16bits
unsigned int nLen : 6;
unsigned int nVari : 2;
};
@@ -114,8 +114,10 @@ struct SprmInfoHash
typedef ww::WrappedHash<SprmInfo, SprmInfoHash> wwSprmSearcher;
typedef ww::WrappedHash<sal_uInt16> wwSprmSequence;
-//wwSprmParser knows how to take a sequence of bytes and split it up into
-//sprms and their arguments
+/**
+ wwSprmParser knows how to take a sequence of bytes and split it up into
+ sprms and their arguments
+*/
class wwSprmParser
{
private:
@@ -134,20 +136,20 @@ private:
public:
//7- ids are very different to 8+ ones
wwSprmParser(ww::WordVersion eVersion);
- //Return the SPRM id at the beginning of this byte sequence
+ /// Return the SPRM id at the beginning of this byte sequence
sal_uInt16 GetSprmId(const sal_uInt8* pSp) const;
USHORT GetSprmSize(sal_uInt16 nId, const sal_uInt8* pSprm) const;
- //Get known len of a sprms head, the bytes of the sprm id + any bytes
- //reserved to hold a variable length
+ /// Get known len of a sprms head, the bytes of the sprm id + any bytes
+ /// reserved to hold a variable length
USHORT DistanceToData(sal_uInt16 nId) const;
- //Get len of a sprms data area, ignoring the bytes of the sprm id and
- //ignoring any len bytes. Reports the remaining data after those bytes
+ /// Get len of a sprms data area, ignoring the bytes of the sprm id and
+ /// ignoring any len bytes. Reports the remaining data after those bytes
USHORT GetSprmTailLen(sal_uInt16 nId, const sal_uInt8 * pSprm) const;
- //The minimum acceptable sprm len possible for this type of parser
+ /// The minimum acceptable sprm len possible for this type of parser
int MinSprmLen() const { return (IsSevenMinus(meVersion)) ? 2 : 3; }
inline int getVersion() const { return meVersion; } //cmc, I'm dubious about the usage of this, how can it be 0
@@ -164,14 +166,14 @@ class WW8PLCFx_PCD;
String WW8ReadPString( SvStream& rStrm, rtl_TextEncoding eEnc,
bool bAtEndSeekRel1 = true);
-/*
+/**
The following method reads a 2Byte unicode string. If bAtEndSeekRel1 is set,
exactly ONE byte is skipped If nChars is set then that number of characters
(not bytes) is read, if its not set, the first character read is the length
*/
String WW8Read_xstz(SvStream& rStrm, USHORT nChars, bool bAtEndSeekRel1);
-/*
+/**
reads array of strings (see MS documentation: STring TaBle stored in File)
returns NOT the original pascal strings but an array of converted char*
@@ -183,23 +185,23 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, UINT32 nStart, INT32 nLen,
struct WW8FieldDesc
{
- long nLen; // Gesamtlaenge ( zum Text ueberlesen )
- WW8_CP nSCode; // Anfang Befehlscode
- WW8_CP nLCode; // Laenge
- WW8_CP nSRes; // Anfang Ergebnis
- WW8_CP nLRes; // Laenge ( == 0, falls kein Ergebnis )
- USHORT nId; // WW-Id fuer Felder
- BYTE nOpt; // WW-Flags ( z.B.: vom User geaendert )
- BYTE bCodeNest:1; // Befehl rekursiv verwendet
- BYTE bResNest:1; // Befehl in Resultat eingefuegt
+ long nLen; ///< Gesamtlaenge ( zum Text ueberlesen )
+ WW8_CP nSCode; ///< Anfang Befehlscode
+ WW8_CP nLCode; ///< Laenge
+ WW8_CP nSRes; ///< Anfang Ergebnis
+ WW8_CP nLRes; ///< Laenge ( == 0, falls kein Ergebnis )
+ USHORT nId; ///< WW-Id fuer Felder
+ BYTE nOpt; ///< WW-Flags ( z.B.: vom User geaendert )
+ BYTE bCodeNest:1; ///< Befehl rekursiv verwendet
+ BYTE bResNest:1; ///< Befehl in Resultat eingefuegt
};
struct WW8PLCFxSave1
{
ULONG nPLCFxPos;
- ULONG nPLCFxPos2; // fuer PLCF_Cp_Fkp: PieceIter-Pos
+ ULONG nPLCFxPos2; ///< fuer PLCF_Cp_Fkp: PieceIter-Pos
long nPLCFxMemOfs;
- WW8_CP nStartCp; // for cp based iterator like PAP and CHP
+ WW8_CP nStartCp; ///< for cp based iterator like PAP and CHP
long nCpOfs;
WW8_FC nStartFC;
WW8_CP nAttrStart;
@@ -207,17 +209,17 @@ struct WW8PLCFxSave1
bool bLineEnd;
};
-/*
+/**
u.a. fuer Felder, also genausoviele Attr wie Positionen,
falls Ctor-Param bNoEnd = false
*/
class WW8PLCFspecial // Iterator fuer PLCFs
{
private:
- INT32* pPLCF_PosArray; // Pointer auf Pos-Array und auf ganze Struktur
- BYTE* pPLCF_Contents; // Pointer auf Inhalts-Array-Teil des Pos-Array
- long nIMax; // Anzahl der Elemente
- long nIdx; // Merker, wo wir gerade sind
+ INT32* pPLCF_PosArray; ///< Pointer auf Pos-Array und auf ganze Struktur
+ BYTE* pPLCF_Contents; ///< Pointer auf Inhalts-Array-Teil des Pos-Array
+ long nIMax; ///< Anzahl der Elemente
+ long nIdx; ///< Merker, wo wir gerade sind
long nStru;
public:
WW8PLCFspecial( SvStream* pSt, long nFilePos, long nPLCF,
@@ -246,7 +248,7 @@ public:
WW8PLCFspecial& operator --( int ) { nIdx--; return *this; }
};
-/* simple Iterator for SPRMs */
+/** simple Iterator for SPRMs */
class WW8SprmIter
{
private:
@@ -463,7 +465,7 @@ public:
}
};
-/*
+/**
Iterator for Piece Table Exceptions of Fkps
works only with FCs, not with CPs ! ( Low-Level )
*/
@@ -587,7 +589,7 @@ public:
bool HasFkp() const { return (0 != pFkp); }
};
-// Iterator fuer Piece Table Exceptions of Fkps arbeitet auf CPs (High-Level)
+/// Iterator fuer Piece Table Exceptions of Fkps arbeitet auf CPs (High-Level)
class WW8PLCFx_Cp_FKP : public WW8PLCFx_Fc_FKP
{
private:
@@ -619,7 +621,7 @@ public:
virtual void Restore( const WW8PLCFxSave1& rSave );
};
-// Iterator for Piece Table Exceptions of Sepx
+/// Iterator for Piece Table Exceptions of Sepx
class WW8PLCFx_SEPX : public WW8PLCFx
{
private:
@@ -652,7 +654,7 @@ public:
BYTE*& p1, BYTE*& p2, BYTE*& p3, BYTE*& p4 ) const;
};
-// Iterator fuer Fuss-/Endnoten und Anmerkungen
+/// Iterator fuer Fuss-/Endnoten und Anmerkungen
class WW8PLCFx_SubDoc : public WW8PLCFx
{
private:
@@ -684,7 +686,7 @@ public:
long Count() const { return ( pRef ) ? pRef->GetIMax() : 0; }
};
-// Iterator fuer Fuss- und Endnoten
+/// Iterator for footnotes and endnotes
class WW8PLCFx_FLD : public WW8PLCFx
{
private:
@@ -709,7 +711,7 @@ public:
enum eBookStatus { BOOK_NORMAL = 0, BOOK_IGNORE = 0x1, BOOK_FIELD = 0x2 };
-// Iterator for Booknotes
+/// Iterator for Booknotes
class WW8PLCFx_Book : public WW8PLCFx
{
private:
@@ -978,7 +980,8 @@ public:
};
-/*
+/** FIB - the File Information Block
+
The FIB contains a "magic word" and pointers to the various other parts of
the file, as well as information about the length of the file.
The FIB starts at the beginning of the file.
@@ -986,7 +989,7 @@ public:
class WW8Fib
{
public:
- /*
+ /**
Program-Version asked for by us:
in Ctor we check if it matches the value of nFib
@@ -1040,6 +1043,7 @@ public:
UINT16 fExtChar :1; // 1000 =1, when using extended character set in file
UINT16 fFarEast :1; // 4000 =1, probably, when far-East language vaiants of Word is used to create a file #i90932#
+ UINT16 fObfuscated :1; // 8000=1. specifies whether the document is obfuscated using XOR obfuscation. otherwise this bit MUST be ignored.
UINT16 nFibBack; // 0xc
UINT16 nHash; // 0xe file encrypted hash
@@ -1434,6 +1438,7 @@ public:
/* leider falsch, man braucht auch noch einen fuer den Export */
WW8Fib( BYTE nVersion = 6 );
+ bool WriteHeader(SvStream& rStrm);
bool Write(SvStream& rStrm);
static rtl_TextEncoding GetFIBCharset(UINT16 chs);
ww::WordVersion GetFIBVersion() const;
@@ -1495,7 +1500,8 @@ namespace nsHdFtFlags
const HdFtFlags WW8_FOOTER_FIRST = 0x20;
}
-class WW8Dop // Document Properties
+/// Document Properties
+class WW8Dop
{
public:
/* Error Status */
diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx
index 622a197b0295..aa4113484f68 100644
--- a/sw/source/filter/ww8/ww8struc.hxx
+++ b/sw/source/filter/ww8/ww8struc.hxx
@@ -165,15 +165,17 @@ typedef sal_Int32 WW8_CP;
const WW8_FC WW8_FC_MAX = SAL_MAX_INT32;
const WW8_CP WW8_CP_MAX = SAL_MAX_INT32;
-// STD: STyle Definition
-// The STD contains the entire definition of a style.
-// It has two parts, a fixed-length base (cbSTDBase bytes long)
-// and a variable length remainder holding the name, and the upx and upe
-// arrays (a upx and upe for each type stored in the style, std.cupx)
-// Note that new fields can be added to the BASE of the STD without
-// invalidating the file format, because the STSHI contains the length
-// that is stored in the file. When reading STDs from an older version,
-// new fields will be zero.
+/** STD - STyle Definition
+
+ The STD contains the entire definition of a style.
+ It has two parts, a fixed-length base (cbSTDBase bytes long)
+ and a variable length remainder holding the name, and the upx and upe
+ arrays (a upx and upe for each type stored in the style, std.cupx)
+ Note that new fields can be added to the BASE of the STD without
+ invalidating the file format, because the STSHI contains the length
+ that is stored in the file. When reading STDs from an older version,
+ new fields will be zero.
+*/
struct WW8_STD
{
// Base part of STD:
@@ -203,9 +205,7 @@ struct WW8_STD
// char grupe[];
};
-/*
- Basis zum Einlesen UND zum Arbeiten (wird jeweils unter
- schiedlich beerbt)
+/** Basis zum Einlesen UND zum Arbeiten (wird jeweils unter schiedlich beerbt)
*/
struct WW8_FFN_BASE // Font Descriptor
{
@@ -223,8 +223,7 @@ struct WW8_FFN_BASE // Font Descriptor
BYTE ibszAlt; // 0x5 index into ffn.szFfn to the name of the alternate font
};
-/*
- Hiermit arbeiten wir im Parser (und Dumper)
+/** Hiermit arbeiten wir im Parser (und Dumper)
*/
struct WW8_FFN : public WW8_FFN_BASE
{
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 2536b9bf57e3..abe69df298d6 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -54,6 +54,7 @@
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/packages/WrongPasswordException.hpp>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
#include <svtools/svstdarr.hxx>
#include <sfx2/docfile.hxx>
#include <svtools/sfxecode.hxx>
@@ -70,16 +71,12 @@
#include <errhdl.hxx>
#include <fltini.hxx>
#include <doc.hxx>
-#ifndef _DOCSH_HXX //autogen wg. SwDoc
#include <docsh.hxx>
-#endif
#include <unoobj.hxx>
#include <swmodule.hxx>
#include <SwXMLSectionList.hxx>
-#ifndef _STATSTR_HRC
#include <statstr.hrc>
-#endif
// --> OD 2005-09-06 #i44177#
#include <SwStyleNameMapper.hxx>
@@ -103,6 +100,8 @@
#include <istyleaccess.hxx>
#define LOGFILE_AUTHOR "mb93740"
+#include <sfx2/DocumentMetadataAccess.hxx>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -516,6 +515,7 @@ void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SwDoc& _rDoc )
}
// <--
+
ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const String & rName )
{
// Get service factory
@@ -810,23 +810,25 @@ ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const S
xInfoSet->setPropertyValue( sPropName, makeAny( aBaseURL ) );
// TODO/LATER: separate links from usual embedded objects
+ ::rtl::OUString StreamPath;
if( SFX_CREATE_MODE_EMBEDDED == rDoc.GetDocShell()->GetCreateMode() )
{
- OUString aName;
if ( pMedDescrMedium && pMedDescrMedium->GetItemSet() )
{
const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
pMedDescrMedium->GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) );
if ( pDocHierarchItem )
- aName = pDocHierarchItem->GetValue();
+ StreamPath = pDocHierarchItem->GetValue();
}
else
- aName = ::rtl::OUString::createFromAscii( "dummyObjectName" );
+ {
+ StreamPath = ::rtl::OUString::createFromAscii( "dummyObjectName" );
+ }
- if( aName.getLength() )
+ if( StreamPath.getLength() )
{
sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath"));
- xInfoSet->setPropertyValue( sPropName, makeAny( aName ) );
+ xInfoSet->setPropertyValue( sPropName, makeAny( StreamPath ) );
}
}
@@ -869,6 +871,38 @@ ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const S
makeAny( bTextDocInOOoFileFormat ) );
}
// <--
+
+ sal_uInt32 nWarnRDF = 0;
+ // RDF metadata - must be read before styles/content
+ // N.B.: embedded documents have their own manifest.rdf!
+ try
+ {
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(xModelComp,
+ uno::UNO_QUERY_THROW);
+ const uno::Reference<rdf::XURI> xBaseURI( ::sfx2::createBaseURI(
+ aContext.getUNOContext(), xStorage, aBaseURL, StreamPath) );
+ const uno::Reference<task::XInteractionHandler> xHandler(
+ pDocSh->GetMedium()->GetInteractionHandler() );
+ xDMA->loadMetadataFromStorage(xStorage, xBaseURI, xHandler);
+ }
+ catch (lang::WrappedTargetException & e)
+ {
+ ucb::InteractiveAugmentedIOException iaioe;
+ if (e.TargetException >>= iaioe)
+ {
+ // import error that was not ignored by InteractionHandler!
+ nWarnRDF = ERR_SWG_READ_ERROR;
+ }
+ else
+ {
+ nWarnRDF = WARN_SWG_FEATURES_LOST; // uhh... something went wrong?
+ }
+ }
+ catch (uno::Exception &)
+ {
+ nWarnRDF = WARN_SWG_FEATURES_LOST; // uhh... something went wrong?
+ }
+
sal_uInt32 nWarn = 0;
sal_uInt32 nWarn2 = 0;
// read storage streams
@@ -924,13 +958,7 @@ ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const S
else if ( rDoc.IsOLEPrtNotifyPending() )
rDoc.PrtOLENotify( TRUE );
- if( !nRet )
- {
- if( nWarn )
- nRet = nWarn;
- else if( nWarn2 )
- nRet = nWarn2;
- }
+ nRet = nRet ? nRet : (nWarn ? nWarn : (nWarn2 ? nWarn2 : nWarnRDF ) );
aOpt.ResetAllFmtsOnly();
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index e944ad81aba7..09b7bdd8ed30 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -54,19 +54,18 @@
#include <pam.hxx>
#include <doc.hxx>
#include <docstat.hxx>
-#ifndef _DOCSH_HXX //autogen wg. SwDoc
#include <docsh.hxx>
-#endif
#include <unotools/ucbstreamhelper.hxx>
#include <errhdl.hxx>
#include <swerror.h>
#include <wrtxml.hxx>
-#ifndef _STATSTR_HRC
#include <statstr.hrc>
-#endif
#include <rtl/logfile.hxx>
+#include <comphelper/documentconstants.hxx>
+#include <comphelper/makesequence.hxx>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -366,6 +365,35 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg,
sal_Bool bWarn = sal_False, bErr = sal_False;
String sWarnFile, sErrFile;
+ // RDF metadata: export if ODF >= 1.2
+ // N.B.: embedded documents have their own manifest.rdf!
+ if ( bOASIS )
+ {
+ const uno::Reference<beans::XPropertySet> xPropSet(xStg,
+ uno::UNO_QUERY_THROW);
+ const ::rtl::OUString VersionProp(
+ ::rtl::OUString::createFromAscii("Version"));
+ try
+ {
+ ::rtl::OUString Version;
+ // ODF >= 1.2
+ if ((xPropSet->getPropertyValue(VersionProp) >>= Version)
+ && !Version.equals(ODFVER_010_TEXT)
+ && !Version.equals(ODFVER_011_TEXT))
+ {
+ const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(
+ xModelComp, uno::UNO_QUERY_THROW);
+ xDMA->storeMetadataToStorage(xStg);
+ }
+ }
+ catch (beans::UnknownPropertyException &)
+ { /* ignore */ }
+ catch (uno::Exception &)
+ {
+ bWarn = sal_True;
+ }
+ }
+
sal_Bool bStoreMeta = ( SFX_CREATE_MODE_EMBEDDED != pDoc->GetDocShell()->GetCreateMode() );
if ( !bStoreMeta )
{
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index b1131027cf37..1add0b897f11 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -45,9 +45,7 @@
#include <xmloff/xmltkmap.hxx>
#include <xmloff/nmspmap.hxx>
-#ifndef _XMLOFF_FAMILIES_HXX
#include <xmloff/families.hxx>
-#endif
#include <xmloff/xmluconv.hxx>
#include <xmloff/i18nmap.hxx>
#include <svx/protitem.hxx>
@@ -98,6 +96,7 @@ enum SwXMLTableElemTokens
enum SwXMLTableCellAttrTokens
{
+ XML_TOK_TABLE_XMLID,
XML_TOK_TABLE_STYLE_NAME,
XML_TOK_TABLE_NUM_COLS_SPANNED,
XML_TOK_TABLE_NUM_ROWS_SPANNED,
@@ -137,6 +136,7 @@ static __FAR_DATA SvXMLTokenMapEntry aTableElemTokenMap[] =
static __FAR_DATA SvXMLTokenMapEntry aTableCellAttrTokenMap[] =
{
+ { XML_NAMESPACE_XML, XML_ID, XML_TOK_TABLE_XMLID },
{ XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_STYLE_NAME },
{ XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED, XML_TOK_TABLE_NUM_COLS_SPANNED },
{ XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, XML_TOK_TABLE_NUM_ROWS_SPANNED },
@@ -174,6 +174,8 @@ class SwXMLTableCell_Impl
{
OUString aStyleName;
+ OUString mXmlId;
+
OUString sFormula; // cell formula; valid if length > 0
double dValue; // formula value
@@ -206,7 +208,8 @@ public:
sal_Bool bHasValue = sal_False,
sal_Bool mbCovered = sal_False,
double dVal = 0.0,
- sal_Bool mbTextValue = sal_False );
+ sal_Bool mbTextValue = sal_False,
+ OUString const& i_rXmlId = OUString());
sal_Bool IsUsed() const { return pStartNode!=0 ||
xSubTable.Is() || bProtected;}
@@ -221,6 +224,7 @@ public:
sal_Bool IsProtected() const { return bProtected; }
sal_Bool IsCovered() const { return mbCovered; }
sal_Bool HasTextValue() const { return mbTextValue; }
+ const OUString& GetXmlId() const { return mXmlId; }
const SwStartNode *GetStartNode() const { return pStartNode; }
inline void SetStartNode( const SwStartNode *pSttNd );
@@ -239,7 +243,8 @@ inline void SwXMLTableCell_Impl::Set( const OUString& rStyleName,
sal_Bool bHasVal,
sal_Bool bCov,
double dVal,
- sal_Bool bTextVal )
+ sal_Bool bTextVal,
+ OUString const& i_rXmlId )
{
aStyleName = rStyleName;
nRowSpan = nRSpan;
@@ -252,6 +257,11 @@ inline void SwXMLTableCell_Impl::Set( const OUString& rStyleName,
mbTextValue = bTextVal;
bProtected = bProtect;
+ if (!mbCovered) // ensure uniqueness
+ {
+ mXmlId = i_rXmlId;
+ }
+
// set formula, if valid
if (pFormula != NULL)
{
@@ -286,6 +296,7 @@ class SwXMLTableRow_Impl
{
OUString aStyleName;
OUString aDfltCellStyleName;
+ OUString mXmlId;
SwXMLTableCells_Impl aCells;
@@ -294,13 +305,15 @@ class SwXMLTableRow_Impl
public:
SwXMLTableRow_Impl( const OUString& rStyleName, sal_uInt32 nCells,
- const OUString *pDfltCellStyleName = 0 );
+ const OUString *pDfltCellStyleName = 0,
+ const OUString& i_rXmlId = OUString() );
~SwXMLTableRow_Impl() {}
inline SwXMLTableCell_Impl *GetCell( sal_uInt32 nCol ) const;
inline void Set( const OUString& rStyleName,
- const OUString& rDfltCellStyleName );
+ const OUString& rDfltCellStyleName,
+ const OUString& i_rXmlId );
void Expand( sal_uInt32 nCells, sal_Bool bOneCell );
@@ -309,14 +322,17 @@ public:
const OUString& GetStyleName() const { return aStyleName; }
const OUString& GetDefaultCellStyleName() const { return aDfltCellStyleName; }
+ const OUString& GetXmlId() const { return mXmlId; }
void Dispose();
};
SwXMLTableRow_Impl::SwXMLTableRow_Impl( const OUString& rStyleName,
sal_uInt32 nCells,
- const OUString *pDfltCellStyleName ) :
+ const OUString *pDfltCellStyleName,
+ const OUString& i_rXmlId ) :
aStyleName( rStyleName ),
+ mXmlId( i_rXmlId ),
bSplitable( sal_False )
{
if( pDfltCellStyleName )
@@ -365,10 +381,12 @@ void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, sal_Bool bOneCell )
}
inline void SwXMLTableRow_Impl::Set( const OUString& rStyleName,
- const OUString& rDfltCellStyleName )
+ const OUString& rDfltCellStyleName,
+ const OUString& i_rXmlId )
{
aStyleName = rStyleName;
aDfltCellStyleName = rDfltCellStyleName;
+ mXmlId = i_rXmlId;
}
void SwXMLTableRow_Impl::Dispose()
@@ -384,6 +402,7 @@ class SwXMLTableCellContext_Impl : public SvXMLImportContext
OUString aStyleName;
OUString sFormula;
OUString sSaveParaDefault;
+ OUString mXmlId;
SvXMLImportContextRef xMyTable;
@@ -456,6 +475,9 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
GetSwImport().GetTableCellAttrTokenMap();
switch( rTokenMap.Get( nPrefix, aLocalName ) )
{
+ case XML_TOK_TABLE_XMLID:
+ mXmlId = rValue;
+ break;
case XML_TOK_TABLE_STYLE_NAME:
aStyleName = rValue;
GetImport().GetTextImport()->sCellParaStyleDefault = rValue;
@@ -550,6 +572,7 @@ inline void SwXMLTableCellContext_Impl::_InsertContent()
{
GetTable()->InsertCell( aStyleName, nRowSpan, nColSpan,
GetTable()->InsertTableSection(),
+ mXmlId,
NULL, bProtect, &sFormula, bHasValue, fValue, bHasTextValue );
}
@@ -569,7 +592,7 @@ inline void SwXMLTableCellContext_Impl::InsertContentIfNotThere()
inline void SwXMLTableCellContext_Impl::InsertContent(
SwXMLTableContext *pTable )
{
- GetTable()->InsertCell( aStyleName, nRowSpan, nColSpan, 0, pTable, bProtect );
+ GetTable()->InsertCell( aStyleName, nRowSpan, nColSpan, 0, mXmlId, pTable, bProtect );
bHasTableContent = sal_True;
}
@@ -580,11 +603,12 @@ SvXMLImportContext *SwXMLTableCellContext_Impl::CreateChildContext(
{
SvXMLImportContext *pContext = 0;
+ OUString sXmlId;
sal_Bool bSubTable = sal_False;
if( XML_NAMESPACE_TABLE == nPrefix &&
IsXMLToken( rLocalName, XML_TABLE ) )
{
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for( sal_Int16 i=0; i < nAttrCount; i++ )
{
const OUString& rAttrName = xAttrList->getNameByIndex( i );
@@ -596,7 +620,15 @@ SvXMLImportContext *SwXMLTableCellContext_Impl::CreateChildContext(
if( XML_NAMESPACE_TABLE == nPrefix2 &&
IsXMLToken( aLocalName, XML_IS_SUB_TABLE ) &&
IsXMLToken( xAttrList->getValueByIndex( i ), XML_TRUE ) )
+ {
bSubTable = sal_True;
+ }
+ else if ( (XML_NAMESPACE_XML == nPrefix2) &&
+ IsXMLToken( aLocalName, XML_ID ) )
+ {
+ sXmlId = xAttrList->getValueByIndex( i );
+ }
+//FIXME: RDFa
}
}
@@ -606,7 +638,7 @@ SvXMLImportContext *SwXMLTableCellContext_Impl::CreateChildContext(
{
SwXMLTableContext *pTblContext =
new SwXMLTableContext( GetSwImport(), nPrefix, rLocalName,
- xAttrList, GetTable() );
+ xAttrList, GetTable(), sXmlId );
pContext = pTblContext;
if( GetTable()->IsValid() )
InsertContent( pTblContext );
@@ -638,7 +670,7 @@ void SwXMLTableCellContext_Impl::EndElement()
GetImport().GetTextImport()->DeleteParagraph();
if( nColRepeat > 1 && nColSpan == 1 )
{
- // The original text is is invalid after deleting the last
+ // The original text is invalid after deleting the last
// paragraph
Reference < XTextCursor > xSrcTxtCursor =
GetImport().GetTextImport()->GetText()->createTextCursor();
@@ -667,7 +699,7 @@ void SwXMLTableCellContext_Impl::EndElement()
SwPaM aSrcPaM( *pSrcPaM->GetPoint(),
*pSrcPaM->GetMark() );
SwPosition aDstPos( *pDstTxtCrsr->GetPaM()->GetPoint() );
- pDoc->Copy( aSrcPaM, aDstPos );
+ pDoc->Copy( aSrcPaM, aDstPos, false );
nColRepeat--;
}
@@ -738,6 +770,12 @@ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl(
else if( IsXMLToken( aLocalName, XML_DEFAULT_CELL_STYLE_NAME ) )
aDfltCellStyleName = rValue;
}
+ else if ( (XML_NAMESPACE_XML == nPrefix) &&
+ IsXMLToken( aLocalName, XML_ID ) )
+ {
+ (void) rValue;
+//FIXME where to put this??? columns do not actually exist in writer...
+ }
}
sal_Int32 nWidth = MINLAY;
@@ -870,6 +908,7 @@ SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( SwXMLImport& rImport,
nRowRepeat( 1 )
{
OUString aStyleName, aDfltCellStyleName;
+ OUString sXmlId;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for( sal_Int16 i=0; i < nAttrCount; i++ )
@@ -898,9 +937,15 @@ SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( SwXMLImport& rImport,
aDfltCellStyleName = rValue;
}
}
+ else if ( (XML_NAMESPACE_XML == nPrefix) &&
+ IsXMLToken( aLocalName, XML_ID ) )
+ {
+ sXmlId = rValue;
+ }
}
if( GetTable()->IsValid() )
- GetTable()->InsertRow( aStyleName, aDfltCellStyleName, bInHead );
+ GetTable()->InsertRow( aStyleName, aDfltCellStyleName, bInHead,
+ sXmlId );
}
void SwXMLTableRowContext_Impl::EndElement()
@@ -1269,6 +1314,7 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
nWidth( 0UL )
{
OUString aName;
+ OUString sXmlId;
// this method will modify the document directly -> lock SolarMutex
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1292,6 +1338,11 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
else if( IsXMLToken( aLocalName, XML_DEFAULT_CELL_STYLE_NAME ) )
aDfltCellStyleName = rValue;
}
+ else if ( (XML_NAMESPACE_XML == nPrefix) &&
+ IsXMLToken( aLocalName, XML_ID ) )
+ {
+ sXmlId = rValue;
+ }
}
SwDoc *pDoc = SwImport::GetDocFromXMLImport( GetSwImport() );
@@ -1343,6 +1394,10 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
if( xTable.is() )
{
+//FIXME
+ // xml:id for RDF metadata
+ GetImport().SetXmlId(xTable, sXmlId);
+
Reference<XUnoTunnel> xTableTunnel( xTable, UNO_QUERY);
if( xTableTunnel.is() )
{
@@ -1381,8 +1436,10 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
sal_uInt16 nPrfx,
const OUString& rLName,
const Reference< xml::sax::XAttributeList > &,
- SwXMLTableContext *pTable ) :
+ SwXMLTableContext *pTable,
+ OUString const & i_rXmlId ) :
XMLTextTableContext( rImport, nPrfx, rLName ),
+ mXmlId( i_rXmlId ),
pColumnDefaultCellStyleNames( 0 ),
pRows( new SwXMLTableRows_Impl ),
pTableNode( pTable->pTableNode ),
@@ -1529,6 +1586,7 @@ OUString SwXMLTableContext::GetColumnDefaultCellStyleName( sal_uInt32 nCol ) con
void SwXMLTableContext::InsertCell( const OUString& rStyleName,
sal_uInt32 nRowSpan, sal_uInt32 nColSpan,
const SwStartNode *pStartNode,
+ const OUString & i_rXmlId,
SwXMLTableContext *pTable,
sal_Bool bProtect,
const OUString* pFormula,
@@ -1629,7 +1687,8 @@ void SwXMLTableContext::InsertCell( const OUString& rStyleName,
const bool bCovered = i != nColSpan || j != nRowSpan;
GetCell( nRowsReq-j, nColsReq-i )
->Set( sStyleName, j, i, pStartNode,
- pTable, bProtect, pFormula, bHasValue, bCovered, fValue, bTextValue);
+ pTable, bProtect, pFormula, bHasValue, bCovered, fValue,
+ bTextValue, i_rXmlId );
}
}
@@ -1641,7 +1700,8 @@ void SwXMLTableContext::InsertCell( const OUString& rStyleName,
void SwXMLTableContext::InsertRow( const OUString& rStyleName,
const OUString& rDfltCellStyleName,
- sal_Bool bInHead )
+ sal_Bool bInHead,
+ const OUString & i_rXmlId )
{
ASSERT( nCurRow < USHRT_MAX,
"SwXMLTableContext::InsertRow: no space left" );
@@ -1656,13 +1716,14 @@ void SwXMLTableContext::InsertRow( const OUString& rStyleName,
{
// The current row has already been inserted because of a row span
// of a previous row.
- (*pRows)[(sal_uInt16)nCurRow]->Set( rStyleName, rDfltCellStyleName );
+ (*pRows)[(sal_uInt16)nCurRow]->Set(
+ rStyleName, rDfltCellStyleName, i_rXmlId );
}
else
{
// add a new row
pRows->Insert( new SwXMLTableRow_Impl( rStyleName, GetColumnCount(),
- &rDfltCellStyleName ),
+ &rDfltCellStyleName, i_rXmlId ),
pRows->Count() );
}
@@ -1692,7 +1753,9 @@ void SwXMLTableContext::InsertRepRows( sal_uInt32 nCount )
GetCell( nCurRow-1, nCurCol );
InsertCell( pSrcCell->GetStyleName(), 1U,
pSrcCell->GetColSpan(),
- InsertTableSection(), 0, pSrcCell->IsProtected(),
+ InsertTableSection(),
+ OUString(),
+ 0, pSrcCell->IsProtected(),
&pSrcCell->GetFormula(),
pSrcCell->HasValue(), pSrcCell->GetValue(),
pSrcCell->HasTextValue() );
@@ -1892,6 +1955,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox( SwTableLine *pUpper,
sal_uInt32 nBottomRow,
sal_uInt32 nRightCol )
{
+//FIXME: here would be a great place to handle XmlId for cell
SwTableBox *pBox = new SwTableBox( pBoxFmt, 0, pUpper );
sal_uInt32 nColSpan = nRightCol - nLeftCol;
@@ -1990,6 +2054,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
sal_uInt32 /*nTopRow*/, sal_uInt32 nLeftCol, sal_uInt32 /*nBottomRow*/,
sal_uInt32 nRightCol )
{
+//FIXME: here would be a great place to handle XmlId for cell
SwTableBox *pBox;
sal_uInt32 nColSpan = nRightCol - nLeftCol;
sal_Int32 nColWidth = GetColumnWidth( nLeftCol, nColSpan );
@@ -2151,6 +2216,7 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper,
sal_uInt32 nBottomRow,
sal_uInt32 nRightCol )
{
+//FIXME: here would be a great place to handle XmlId for row
SwTableLine *pLine;
if( !pUpper && 0UL==nTopRow )
{
@@ -2618,6 +2684,17 @@ void SwXMLTableContext::MakeTable()
// those don't need to be locked separately.
vos::OGuard aGuard(Application::GetSolarMutex());
+ // #i97274# handle invalid tables
+ if (!pRows || !pRows->Count() || !GetColumnCount())
+ {
+ ASSERT(false, "invalid table: no cells; deleting...");
+ pTableNode->GetDoc()->DeleteSection( pTableNode );
+ pTableNode = 0;
+ pBox1 = 0;
+ pSttNd1 = 0;
+ return;
+ }
+
SwXMLImport& rSwImport = GetSwImport();
SwFrmFmt *pFrmFmt = pTableNode->GetTable().GetFrmFmt();
@@ -2742,7 +2819,7 @@ void SwXMLTableContext::MakeTable()
if( bSetHoriOrient )
pFrmFmt->SetFmtAttr( SwFmtHoriOrient( 0, eHoriOrient ) );
- // This must be bahind the call to _MakeTable, because nWidth might be
+ // This must be after the call to _MakeTable, because nWidth might be
// changed there.
pFrmFmt->LockModify();
SwFmtFrmSize aSize( ATT_VAR_SIZE, nWidth );
@@ -2773,6 +2850,7 @@ void SwXMLTableContext::MakeTable()
pTableNode->SetNewTable(pDDETable, FALSE);
}
+ // ??? this is always false: root frame is only created in ViewShell::Init
if( pTableNode->GetDoc()->GetRootFrm() )
{
pTableNode->DelFrms();
@@ -2783,6 +2861,7 @@ void SwXMLTableContext::MakeTable()
void SwXMLTableContext::MakeTable( SwTableBox *pBox, sal_Int32 nW )
{
+//FIXME: here would be a great place to handle XmlId for subtable
pLineFmt = GetParentTable()->pLineFmt;
pBoxFmt = GetParentTable()->pBoxFmt;
nWidth = nW;
diff --git a/sw/source/filter/xml/xmltbli.hxx b/sw/source/filter/xml/xmltbli.hxx
index 6cbef964a324..b9f903ba14a9 100644
--- a/sw/source/filter/xml/xmltbli.hxx
+++ b/sw/source/filter/xml/xmltbli.hxx
@@ -31,9 +31,7 @@
#ifndef _XMLTBLI_HXX
#define _XMLTBLI_HXX
-#ifndef _XMLOFF_XMLTEXTTABLECONTEXT_HXX
#include <xmloff/XMLTextTableContext.hxx>
-#endif
// STL include
#include <hash_map>
@@ -69,6 +67,8 @@ class SwXMLTableContext : public XMLTextTableContext
{
::rtl::OUString aStyleName;
::rtl::OUString aDfltCellStyleName;
+ /// NB: this contains the xml:id only if this table is a subtable!
+ ::rtl::OUString mXmlId;
SvUShorts aColumnWidths;
SvBools aColumnRelWidths;
@@ -154,7 +154,8 @@ public:
const ::rtl::OUString& rLName,
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList > & xAttrList,
- SwXMLTableContext *pTable );
+ SwXMLTableContext *pTable,
+ const ::rtl::OUString& i_rXmlId );
virtual ~SwXMLTableContext();
@@ -180,6 +181,7 @@ public:
void InsertCell( const ::rtl::OUString& rStyleName,
sal_uInt32 nRowSpan=1U, sal_uInt32 nColSpan=1U,
const SwStartNode *pStNd=0,
+ const ::rtl::OUString & i_rXmlId = ::rtl::OUString(),
SwXMLTableContext *pTable=0,
sal_Bool bIsProtected = sal_False,
const ::rtl::OUString *pFormula=0,
@@ -188,7 +190,8 @@ public:
sal_Bool bTextValue = sal_False );
void InsertRow( const ::rtl::OUString& rStyleName,
const ::rtl::OUString& rDfltCellStyleName,
- sal_Bool bInHead );
+ sal_Bool bInHead,
+ const ::rtl::OUString & i_rXmlId = ::rtl::OUString() );
void FinishRow();
void InsertRepRows( sal_uInt32 nCount );
SwXMLTableCell_Impl *GetCell( sal_uInt32 nRow, sal_uInt32 nCol ) const;
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index 8de1d5b92201..018ca0c0b5bb 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -464,8 +464,6 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
aAny = rPropSet->getPropertyValue( sFrameStyleName );
aAny >>= sStyle;
}
- // svg:desc
- exportAlternativeText( rPropSet, rPropSetInfo );
const XMLPropertyState *aStates[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
switch( nType )
@@ -766,6 +764,8 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
// Lastly the stuff common to each of Applet/Plugin/Floating Frame
exportEvents( rPropSet );
- exportAlternativeText( rPropSet, rPropSetInfo );
+ // --> OD 2009-07-22 #i73249#
+ exportTitleAndDescription( rPropSet, rPropSetInfo );
+ // <--
exportContour( rPropSet, rPropSetInfo );
}
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx
index 8f9a6b8eb71d..7fe0d349e8a7 100644
--- a/sw/source/ui/app/apphdl.cxx
+++ b/sw/source/ui/app/apphdl.cxx
@@ -57,12 +57,8 @@
#include <svtools/stritem.hxx>
#include <svtools/ctloptions.hxx>
#include <svtools/useroptions.hxx>
-#ifndef _VCL_MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _VCL_WRKWIN_HXX //autogen
#include <vcl/wrkwin.hxx>
-#endif
#include <svx/insctrl.hxx>
#include <svx/selctrl.hxx>
#include <com/sun/star/document/UpdateDocMode.hpp>
@@ -73,46 +69,32 @@
#include <sfx2/objface.hxx>
#include <sfx2/app.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <pview.hxx>
-#ifndef _SRCVIEW_HXX
#include <srcview.hxx>
-#endif
#include <wrtsh.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#ifndef _CMDID_H
#include <cmdid.h> // Funktion-Ids
#endif
#include <initui.hxx>
#include <uitool.hxx>
#include <swmodule.hxx>
-#ifndef _WDOCSH_HXX
#include <wdocsh.hxx>
-#endif
-#ifndef _WVIEW_HXX
#include <wview.hxx>
-#endif
#include <usrpref.hxx>
#include <gloslst.hxx> // SwGlossaryList
#include <glosdoc.hxx> // SwGlossaryList
#include <doc.hxx>
#include <cfgitems.hxx>
#include <prtopt.hxx>
-#ifndef _MODCFG_HXX
#include <modcfg.hxx>
-#endif
#include <globals.h> // globale Konstanten z.B.
#ifndef _APP_HRC
#include <app.hrc>
#endif
#include <fontcfg.hxx>
-#ifndef _BARCFG_HXX
#include <barcfg.hxx>
-#endif
#include <uinums.hxx>
#include <dbconfig.hxx>
#include <mmconfigitem.hxx>
@@ -155,7 +137,7 @@ using namespace ::com::sun::star;
#define PrintSettings
#define _ExecAddress ExecOther
#define _StateAddress StateOther
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include <svx/svxslots.hxx>
#include "swslots.hxx"
#include <cfgid.h>
diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx
index 4964a1cbe753..58bacba0c75a 100644
--- a/sw/source/ui/app/appopt.cxx
+++ b/sw/source/ui/app/appopt.cxx
@@ -201,6 +201,9 @@ SfxItemSet* SwModule::CreateItemSet( USHORT nId )
aLang >>= aLocale;
pRet->Put(SvxLanguageItem(SvxLocaleToLanguage( aLocale ), SID_ATTR_CHAR_CJK_LANGUAGE));
+ aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CTL"));
+ aLang >>= aLocale;
+ pRet->Put(SvxLanguageItem(SvxLocaleToLanguage( aLocale ), SID_ATTR_CHAR_CTL_LANGUAGE));
}
if(bTextDialog)
pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 837b3e72dc44..dd5ecb185c2d 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -30,17 +30,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <hintids.hxx>
#include <rtl/logfile.hxx>
-#ifndef _MSGBOX_HXX
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
-#ifndef _WRKWIN_HXX //autogen
#include <vcl/wrkwin.hxx>
-#endif
#include <vcl/jobset.hxx>
#include <tools/urlobj.hxx>
#include <svtools/whiter.hxx>
@@ -53,9 +48,7 @@
#include <sfx2/app.hxx>
#include <sfx2/request.hxx>
#include <svtools/misccfg.hxx>
-#ifndef _PASSWD_HXX
#include <sfx2/passwd.hxx>
-#endif
#include <sfx2/bindings.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/evntconf.hxx>
@@ -70,9 +63,7 @@
#include <sot/clsids.hxx>
#include <basic/basmgr.hxx>
#include <basic/sbmod.hxx>
-//#ifndef _SB_SBJSMOD_HXX //autogen
//#include <basic/sbjsmod.hxx>
-//#endif
#include <swevent.hxx>
#include <fmtpdsc.hxx>
#include <fmtfsize.hxx>
@@ -81,41 +72,27 @@
#include <swwait.hxx>
#include <swprtopt.hxx>
#include <frmatr.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx> // fuer die aktuelle Sicht
-#endif
#include <edtwin.hxx>
#include <PostItMgr.hxx>
#include <postit.hxx>
#include <wrtsh.hxx> // Verbindung zur Core
-#ifndef _DOCSH_HXX
#include <docsh.hxx> // Dokumenterzeugung
-#endif
-#ifndef _BASESH_HXX
#include <basesh.hxx>
-#endif
#include <viewopt.hxx>
-#ifndef _WDOCSH_HXX
#include <wdocsh.hxx>
-#endif
#include <swmodule.hxx>
-#ifndef _GLOBDOC_HXX
#include <globdoc.hxx>
-#endif
#include <usrpref.hxx>
#include <shellio.hxx> // I/O
#include <docstyle.hxx>
#include <doc.hxx>
#include <docstat.hxx>
#include <pagedesc.hxx>
-#ifndef _PVIEW_HXX
#include <pview.hxx>
-#endif
#include <mdiexp.hxx>
#include <swbaslnk.hxx>
-#ifndef _SRCVIEW_HXX
#include <srcview.hxx>
-#endif
#include <ndindex.hxx>
#include <ndole.hxx>
#include <swcli.hxx>
@@ -127,18 +104,10 @@
#include <docary.hxx>
// <--
#include <swerror.h> // Fehlermeldungen
-#ifndef _HELPID_H
#include <helpid.h>
-#endif
-#ifndef _CMDID_H
-#include <cmdid.h> //
-#endif
-#ifndef _GLOBALS_HRC
+#include <cmdid.h>
#include <globals.hrc>
-#endif
-#ifndef _APP_HRC
#include <app.hrc>
-#endif
#include "warnpassword.hxx"
#include <cfgid.h>
@@ -150,12 +119,8 @@
#include <comphelper/storagehelper.hxx>
#define SwDocShell
-#ifndef _ITEMDEF_HXX
-#include <itemdef.hxx>
-#endif
-#ifndef _SWSLOTS_HXX
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
-#endif
#include <com/sun/star/document/UpdateDocMode.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -163,6 +128,9 @@
#include <unomid.h>
+#include <sfx2/Metadatable.hxx>
+
+
using rtl::OUString;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -610,17 +578,6 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium )
return FALSE;
}
- // if the imported word document is password protected - warn the user
- // about saving it without the password.
- if(pDoc->IsWinEncrypted())
- {
- if(!SwWarnPassword::WarningOnPassword( rMedium ))
- {
- SetError(ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
- return FALSE;
- }
- }
-
//#i3370# remove quick help to prevent saving of autocorrection suggestions
if(pView)
pView->GetEditWin().StopQuickHelp();
@@ -1416,4 +1373,8 @@ BOOL SwTmpPersist::SaveCompleted( SvStorage * pStor )
return FALSE;
} */
+const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const
+{
+ return pDoc ? &pDoc->GetXmlIdRegistry() : 0;
+}
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index caa315999523..182bda09d7b8 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -918,33 +918,6 @@ void SwDocShell::Execute(SfxRequest& rReq)
if(!pBool || !pBool->GetValue())
break;
}
- else
- {
- // try to store the document
- sal_uInt32 nErrorCode = ERRCODE_NONE;
- try
- {
- uno::Reference< frame::XStorable > xStorable( GetModel(), uno::UNO_QUERY_THROW );
- xStorable->store();
- }
- catch( task::ErrorCodeIOException& aErrEx )
- {
- nErrorCode = (sal_uInt32)aErrEx.ErrCode;
- }
- catch( uno::Exception& )
- {
- nErrorCode = ERRCODE_IO_GENERAL;
- }
-
- if ( nErrorCode != ERRCODE_NONE )
- {
- // if the saving has failed show the error and break the action
- if ( nErrorCode != ERRCODE_ABORT )
- ErrorHandler::HandleError( nErrorCode );
-
- break;
- }
- }
}
#ifdef DBG_UTIL
{
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index e13d2418cc58..b0884997dbd9 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -956,6 +956,10 @@ Menu MN_GRF_POPUPMENU
{
MN_ALIGN_FRAME
MN_MOUSE_FRAME_WITH_CONTOUR
+ // --> OD 2009-07-14 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
SEPARATOR ;
MenuItem
{
@@ -989,6 +993,10 @@ Menu MN_OLE_POPUPMENU
{
MN_ALIGN_FRAME
MN_MOUSE_FRAME_WITH_CONTOUR
+ // --> OD 2009-07-14 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
SEPARATOR ;
MenuItem
{
@@ -1013,6 +1021,10 @@ Menu MN_FRM_POPUPMENU
{
MN_ALIGN_FRAME
MN_MOUSE_FRAME_WITHOUT_CONTOUR
+ // --> OD 2009-07-07 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
SEPARATOR ;
MN_FRM
MN_FRM_CAPTION_ITEM
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index 8a63254f42c1..863ef3c22f76 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -437,7 +437,7 @@ sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
const AuthorCharAttr &rAttr )
{
- Color aCol( (ColorData)rAttr.nColor );
+ Color aCol( rAttr.nColor );
if( COL_TRANSPARENT == rAttr.nColor )
{
diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src
index 763e5e82d62e..96719f17bd58 100644
--- a/sw/source/ui/config/optdlg.src
+++ b/sw/source/ui/config/optdlg.src
@@ -60,19 +60,19 @@ TabPage TP_CONTENT_OPT
CheckBox CB_CROSS
{
Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 108 , 10 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
Text [ en-US ] = "Guides ~while moving";
};
CheckBox CB_HANDLE
{
Pos = MAP_APPFONT ( 12 , 27 ) ;
- Size = MAP_APPFONT ( 108 , 10 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
Text [ en-US ] = "Sim~ple handles";
};
CheckBox CB_BIGHANDLE
{
Pos = MAP_APPFONT ( 12 , 40 ) ;
- Size = MAP_APPFONT ( 108 , 10 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
Text [ en-US ] = "Large handles";
};
FixedLine FL_WINDOW
@@ -103,7 +103,7 @@ TabPage TP_CONTENT_OPT
CheckBox CB_HRULER
{
Pos = MAP_APPFONT ( 142 , 53 ) ;
- Size = MAP_APPFONT ( 61 , 10 ) ;
+ Size = MAP_APPFONT ( 62 , 10 ) ;
Text [ en-US ] = "Hori~zontal ruler" ;
};
ListBox LB_HMETRIC
@@ -115,7 +115,7 @@ TabPage TP_CONTENT_OPT
CheckBox CB_VRULER
{
Pos = MAP_APPFONT ( 142 , 66 ) ;
- Size = MAP_APPFONT ( 61 , 10 ) ;
+ Size = MAP_APPFONT ( 62 , 10 ) ;
Text [ en-US ] = "Verti~cal ruler" ;
};
CheckBox CB_VRULER_RIGHT
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 0a9414ffeac3..70db2cdf008b 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -782,7 +782,9 @@ IMPL_LINK( SwCaptionOptPage, ShowEntryHdl, SvxCheckListBox *, EMPTYARG )
break;
}
aPosBox.SelectEntryPos(pOpt->GetPos());
- aPosBox.Enable( pOpt->GetObjType() != GRAPHIC_CAP && aPosText.IsEnabled() );
+ aPosBox.Enable( pOpt->GetObjType() != GRAPHIC_CAP &&
+ pOpt->GetObjType() != OLE_CAP &&
+ aPosText.IsEnabled() );
aPosBox.SelectEntryPos(pOpt->GetPos());
USHORT nLevelPos = ( pOpt->GetLevel() < MAXLEVEL ) ? pOpt->GetLevel() + 1 : 0;
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 88d128d481a5..8396fcb999c8 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1688,7 +1688,7 @@ struct CharAttr
};
// Editieren entspricht Einfuegen-Attributen
-static CharAttr __FAR_DATA aInsertAttr[] =
+static CharAttr __FAR_DATA aRedlineAttr[] =
{
{ SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_NOT_MAPPED },
{ SID_ATTR_CHAR_WEIGHT, WEIGHT_BOLD },
@@ -1702,7 +1702,17 @@ static CharAttr __FAR_DATA aInsertAttr[] =
{ SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_TITEL },
{ SID_ATTR_BRUSH, 0 }
};
+// Items from aRedlineAttr relevant for InsertAttr: strikethrough is
+// not used
+static USHORT aInsertAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 };
+// Items from aRedlineAttr relevant for DeleteAttr: underline and
+// double underline is not used
+static USHORT aDeletedAttrMap[] = { 0, 1, 2, 5, 6, 7, 8, 9, 10 };
+
+// Items from aRedlineAttr relevant for ChangeAttr: strikethrough is
+// not used
+static USHORT aChangedAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 };
/*-----------------------------------------------------------------------
Beschreibung: Markierungsvorschau
@@ -1860,6 +1870,23 @@ void SwMarkPreview::DrawRect(const Rectangle &rRect, const Color &rFillColor, co
Window::DrawRect(rRect);
}
+namespace
+{
+ void lcl_FillRedlineAttrListBox(
+ ListBox& rLB, const AuthorCharAttr& rAttrToSelect,
+ const USHORT* pAttrMap, const USHORT nAttrMapSize)
+ {
+ for (USHORT i = 0; i != nAttrMapSize; ++i)
+ {
+ CharAttr& rAttr(aRedlineAttr[pAttrMap[i]]);
+ rLB.SetEntryData(i, &rAttr);
+ if (rAttr.nItemId == rAttrToSelect.nItemId &&
+ rAttr.nAttr == rAttrToSelect.nAttr)
+ rLB.SelectEntryPos(i);
+ }
+ }
+}
+
SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent,
const SfxItemSet& rSet )
: SfxTabPage(pParent, SW_RES(TP_REDLINE_OPT), rSet),
@@ -1908,6 +1935,13 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent,
aChangedLB.InsertEntry(sEntry);
};
+ // remove strikethrough from insert and change and underline + double
+ // underline from delete
+ aInsertLB.RemoveEntry(5);
+ aChangedLB.RemoveEntry(5);
+ aDeletedLB.RemoveEntry(4);
+ aDeletedLB.RemoveEntry(3);
+
Link aLk = LINK(this, SwRedlineOptionsTabPage, AttribHdl);
aInsertLB.SetSelectHdl( aLk );
aDeletedLB.SetSelectHdl( aLk );
@@ -1945,7 +1979,7 @@ BOOL SwRedlineOptionsTabPage::FillItemSet( SfxItemSet& )
AuthorCharAttr aOldDeletedAttr(pOpt->GetDeletedAuthorAttr());
AuthorCharAttr aOldChangedAttr(pOpt->GetFormatAuthorAttr());
- ULONG nOldMarkColor = pOpt->GetMarkAlignColor().GetColor();
+ ColorData nOldMarkColor = pOpt->GetMarkAlignColor().GetColor();
USHORT nOldMarkMode = pOpt->GetMarkAlignMode();
USHORT nPos = aInsertLB.GetSelectEntryPos();
@@ -2105,7 +2139,7 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet& )
aChangedColorLB.SetUpdateMode( TRUE );
aMarkColorLB.SetUpdateMode( TRUE );
- ULONG nColor = rInsertAttr.nColor;
+ ColorData nColor = rInsertAttr.nColor;
switch (nColor)
{
@@ -2149,41 +2183,16 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet& )
aMarkColorLB.SelectEntry(pOpt->GetMarkAlignColor());
- // Attributlistboxen initialisieren
- USHORT nNum = sizeof(aInsertAttr) / sizeof(CharAttr);
-
aInsertLB.SelectEntryPos(0);
aDeletedLB.SelectEntryPos(0);
aChangedLB.SelectEntryPos(0);
- for (i = 0; i < nNum; i++)
- {
- aInsertLB.SetEntryData(i, &aInsertAttr[i]);
- if (aInsertAttr[i].nItemId == rInsertAttr.nItemId &&
- aInsertAttr[i].nAttr == rInsertAttr.nAttr)
- aInsertLB.SelectEntryPos(i);
- }
-
- for (i = 0; i < nNum; i++)
- {
- aDeletedLB.SetEntryData(i, &aInsertAttr[i]);
- if (aInsertAttr[i].nItemId == rDeletedAttr.nItemId &&
- aInsertAttr[i].nAttr == rDeletedAttr.nAttr)
- aDeletedLB.SelectEntryPos(i);
- }
-
- for (i = 0; i < nNum; i++)
- {
- aChangedLB.SetEntryData(i, &aInsertAttr[i]);
- if (aInsertAttr[i].nItemId == rChangedAttr.nItemId &&
- aInsertAttr[i].nAttr == rChangedAttr.nAttr)
- aChangedLB.SelectEntryPos(i);
- }
- //remove strikethrough from insert and delete and underline+double underline from delete
- aInsertLB.RemoveEntry(5);
- aChangedLB.RemoveEntry(5);
- aDeletedLB.RemoveEntry(4);
- aDeletedLB.RemoveEntry(3);
+ lcl_FillRedlineAttrListBox(aInsertLB, rInsertAttr, aInsertAttrMap,
+ sizeof(aInsertAttrMap) / sizeof(USHORT));
+ lcl_FillRedlineAttrListBox(aDeletedLB, rDeletedAttr, aDeletedAttrMap,
+ sizeof(aDeletedAttrMap) / sizeof(USHORT));
+ lcl_FillRedlineAttrListBox(aChangedLB, rChangedAttr, aChangedAttrMap,
+ sizeof(aChangedAttrMap) / sizeof(USHORT));
USHORT nPos = 0;
switch (pOpt->GetMarkAlignMode())
@@ -2266,7 +2275,8 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox *, pLB )
nPos = 0;
CharAttr* pAttr = ( CharAttr* ) pLB->GetEntryData( nPos );
-
+ //switch off preview background color
+ pPrev->ResetColor();
switch (pAttr->nItemId)
{
case SID_ATTR_CHAR_WEIGHT:
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index cbc77678e84e..af339ac79181 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -35,7 +35,7 @@
#endif
#include <stdio.h>
-
+#include <unotxdoc.hxx>
#include <com/sun/star/text/NotePrintMode.hpp>
#include <sfx2/app.hxx>
#include <com/sun/star/sdb/CommandType.hpp>
@@ -43,17 +43,13 @@
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
-#ifndef _COM_SUN_STAR_UTIL_iXNUMBERFORMATTER_HPP_
#include <com/sun/star/util/XNumberFormatter.hpp>
-#endif
#include <com/sun/star/sdb/XCompletedConnection.hpp>
#include <com/sun/star/sdb/XCompletedExecution.hpp>
#include <com/sun/star/container/XChild.hpp>
-#ifndef _COM_SUN_STAR_TEXT_MAILMERGEEVENT_
#include <com/sun/star/text/MailMergeEvent.hpp>
-#endif
#include <com/sun/star/frame/XStorable.hpp>
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
#include <com/sun/star/uno/XNamingService.hpp>
@@ -65,9 +61,7 @@
#include <dbconfig.hxx>
#include <swdbtoolsclient.hxx>
#include <pagedesc.hxx>
-#ifndef _LSTBOX_HXX //autogen
#include <vcl/lstbox.hxx>
-#endif
#include <unotools/tempfile.hxx>
#include <svtools/pathoptions.hxx>
#include <svtools/urihelper.hxx>
@@ -86,39 +80,25 @@
#include <goodies/mailenum.hxx>
#include <cmdid.h>
#include <swmodule.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <edtwin.hxx>
#include <wrtsh.hxx>
#include <fldbas.hxx>
#include <initui.hxx>
#include <swundo.hxx>
#include <flddat.hxx>
-#ifndef _MODCFG_HXX
#include <modcfg.hxx>
-#endif
#include <swprtopt.hxx>
#include <shellio.hxx>
#include <dbui.hxx>
-#ifndef _DBMGR_HXX
#include <dbmgr.hxx>
-#endif
#include <doc.hxx>
#include <swwait.hxx>
#include <swunohelper.hxx>
-#ifndef _DBUI_HRC
#include <dbui.hrc>
-#endif
-#ifndef _GLOBALS_HRC
#include <globals.hrc>
-#endif
-#ifndef _STATSTR_HRC
#include <statstr.hrc>
-#endif
#include <mmconfigitem.hxx>
#include <sfx2/request.hxx>
#include <hintids.hxx>
@@ -1756,6 +1736,7 @@ ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName,
uno::Reference< XConnection> xConnection;
sal_Bool bUseMergeData = sal_False;
uno::Reference< XColumnsSupplier> xColsSupp;
+ bool bDisposeConnection = false;
if(pImpl->pMergeData &&
pImpl->pMergeData->sDataSource.equals(rDBName) && pImpl->pMergeData->sCommand.equals(rTableName))
{
@@ -1780,6 +1761,7 @@ ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName,
{
rtl::OUString sDBName(rDBName);
xConnection = RegisterConnection( sDBName );
+ bDisposeConnection = true;
}
if(bUseMergeData)
pImpl->pMergeData->xConnection = xConnection;
@@ -1810,6 +1792,10 @@ ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName,
{
::comphelper::disposeComponent( xColsSupp );
}
+ if(bDisposeConnection)
+ {
+ ::comphelper::disposeComponent( xConnection );
+ }
}
else
nRet = pNFmtr->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM );
@@ -3185,7 +3171,6 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
SwWrtShell& rSourceShell = rSourceView.GetWrtShell();
BOOL bSynchronizedDoc = rSourceShell.IsLabelDoc() && rSourceShell.GetSectionFmtCount() > 1;
- String sSourceDocURL;
//save the settings of the first
rSourceShell.SttEndDoc(TRUE);
USHORT nStartingPageNo = rSourceShell.GetVirtPageNum();
@@ -3195,22 +3180,6 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
try
{
- // save the working document into a temporary location
- sSourceDocURL = URIHelper::SmartRel2Abs(
- INetURLObject(), utl::TempFile::CreateTempName(),
- URIHelper::GetMaybeFileHdl());
- const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
- String::CreateFromAscii( FILTER_XML ),
- SwDocShell::Factory().GetFilterContainer() );
-
- SfxStringItem aFilterName( SID_FILTER_NAME, pSfxFlt->GetFilterName());
- uno::Sequence< beans::PropertyValue > aValues(1);
- beans::PropertyValue* pValues = aValues.getArray();
- pValues[0].Name = C2U("FilterName");
- pValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName());
- uno::Reference< frame::XStorable > xStore( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY);
- xStore->storeToURL( sSourceDocURL, aValues );
-
// create a target docshell to put the merged document into
SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
xTargetDocShell->DoInitNew( 0 );
@@ -3259,20 +3228,25 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
Application::Reschedule();
}
- // create a new docshell from the temporary document
- SfxBoolItem aHidden( SID_HIDDEN, TRUE );
- SfxStringItem aReferer( SID_REFERER, String::CreateFromAscii(URL_PREFIX_PRIV_SOFFICE ));
- SfxStringItem aTarget( SID_TARGETNAME, String::CreateFromAscii("_blank") );
- SfxStringItem aURL( SID_FILE_NAME, sSourceDocURL );
- const SfxPoolItem* pReturnValue =
- rSourceView.GetViewFrame()->GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON,
- &aURL, &aFilterName, &aHidden, &aReferer, &aTarget, 0L);
- if(pReturnValue)
+ // copy the source document
+ SfxObjectShellRef xWorkDocSh;
+ if(nDocNo == 1 )
+ {
+ uno::Reference< util::XCloneable > xClone( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY);
+ uno::Reference< lang::XUnoTunnel > xWorkDocShell( xClone->createClone(), uno::UNO_QUERY);
+ SwXTextDocument* pWorkModel = reinterpret_cast<SwXTextDocument*>(xWorkDocShell->getSomething(SwXTextDocument::getUnoTunnelId()));
+ xWorkDocSh = pWorkModel->GetDocShell();
+ }
+ else
{
- SfxViewFrameItem* pVItem = (SfxViewFrameItem*)pReturnValue;
- SwView* pWorkView = (SwView*) pVItem->GetFrame()->GetViewShell();
- SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
- pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird.
+ SwDoc* pNewDoc = rSourceView.GetDocShell()->GetDoc()->CreateCopy();
+ xWorkDocSh = new SwDocShell( pNewDoc, SFX_CREATE_MODE_STANDARD );
+ xWorkDocSh->DoInitNew();
+ }
+ //create a ViewFrame
+ SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, sal_True )->GetViewShell() );
+ SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
+ pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird.
// merge the data
SwDoc* pWorkDoc = rWorkShell.GetDoc();
@@ -3281,94 +3255,98 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
pWorkDoc->EmbedAllLinks();
if(UNDO_UI_DELETE_INVISIBLECNTNT == rWorkShell.GetUndoIds())
rWorkShell.Undo();
+ // #i69485# lock fields to prevent access to the result set while calculating layout
+ rWorkShell.LockExpFlds();
// create a layout
rWorkShell.CalcLayout();
+ rWorkShell.UnlockExpFlds();
SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
rWorkShell.ViewShell::UpdateFlds();
SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
- // strip invisible content and convert fields to text
- rWorkShell.RemoveInvisibleContent();
- rWorkShell.ConvertFieldsToText();
- rWorkShell.SetNumberingRestart();
+ // strip invisible content and convert fields to text
+ rWorkShell.RemoveInvisibleContent();
+ rWorkShell.ConvertFieldsToText();
+ rWorkShell.SetNumberingRestart();
- // insert the document into the target document
- rWorkShell.SttEndDoc(FALSE);
- rWorkShell.SttEndDoc(TRUE);
- rWorkShell.SelAll();
- pTargetShell->SttEndDoc(FALSE);
+ // insert the document into the target document
+ rWorkShell.SttEndDoc(FALSE);
+ rWorkShell.SttEndDoc(TRUE);
+ rWorkShell.SelAll();
+ pTargetShell->SttEndDoc(FALSE);
- //#i63806# put the styles to the target document
- //if the source uses headers or footers each new copy need to copy a new page styles
- if(bPageStylesWithHeaderFooter)
- {
- //create a new pagestyle
- //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style
-
- SwDoc* pTargetDoc = pTargetShell->GetDoc();
- String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo );
- pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName );
- SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName );
- if(pSourcePageDesc && pTargetPageDesc)
- {
- pTargetDoc->CopyPageDesc( *pSourcePageDesc, *pTargetPageDesc, sal_False );
- sModifiedStartingPageDesc = sNewPageDescName;
- lcl_CopyFollowPageDesc( *pTargetShell, *pSourcePageDesc, *pTargetPageDesc, nDocNo );
- }
- }
- if(nDocNo == 1 || bPageStylesWithHeaderFooter)
- {
- pTargetView->GetDocShell()->_LoadStyles( *pWorkView->GetDocShell(), sal_True );
- }
- if(nDocNo > 1)
- {
- pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo );
- }
- else
+ //#i63806# put the styles to the target document
+ //if the source uses headers or footers each new copy need to copy a new page styles
+ if(bPageStylesWithHeaderFooter)
+ {
+ //create a new pagestyle
+ //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style
+
+ SwDoc* pTargetDoc = pTargetShell->GetDoc();
+ String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo );
+ pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName );
+ SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName );
+ const SwPageDesc* pWorkPageDesc = rWorkShell.FindPageDescByName( sStartingPageDesc );
+
+ if(pWorkPageDesc && pTargetPageDesc)
{
- pTargetShell->SetPageStyle(sModifiedStartingPageDesc);
+ pTargetDoc->CopyPageDesc( *pWorkPageDesc, *pTargetPageDesc, sal_False );
+ sModifiedStartingPageDesc = sNewPageDescName;
+ lcl_CopyFollowPageDesc( *pTargetShell, *pWorkPageDesc, *pTargetPageDesc, nDocNo );
}
- USHORT nPageCountBefore = pTargetShell->GetPageCnt();
- DBG_ASSERT(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended");
- //#i51359# add a second paragraph in case there's only one
- {
- SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 );
- SwPosition aTestPos( aIdx );
- SwCursor aTestCrsr(aTestPos,0,false);
- if(!aTestCrsr.MovePara(fnParaNext, fnParaStart))
- {
- //append a paragraph
- pWorkDoc->AppendTxtNode( aTestPos );
- }
- }
- pTargetShell->Paste( rWorkShell.GetDoc(), sal_True );
- //convert fields in page styles (header/footer - has to be done after the first document has been pasted
- if(1 == nDocNo)
+ }
+ if(nDocNo == 1 || bPageStylesWithHeaderFooter)
+ {
+ pTargetView->GetDocShell()->_LoadStyles( *pWorkView->GetDocShell(), sal_True );
+ }
+ if(nDocNo > 1)
+ {
+ pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo );
+ }
+ else
+ {
+ pTargetShell->SetPageStyle(sModifiedStartingPageDesc);
+ }
+ USHORT nPageCountBefore = pTargetShell->GetPageCnt();
+ DBG_ASSERT(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended");
+ //#i51359# add a second paragraph in case there's only one
+ {
+ SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 );
+ SwPosition aTestPos( aIdx );
+ SwCursor aTestCrsr(aTestPos,0,false);
+ if(!aTestCrsr.MovePara(fnParaNext, fnParaStart))
{
- pTargetShell->CalcLayout();
- pTargetShell->ConvertFieldsToText();
+ //append a paragraph
+ pWorkDoc->AppendTxtNode( aTestPos );
}
- //add the document info to the config item
- SwDocMergeInfo aMergeInfo;
- aMergeInfo.nStartPageInTarget = nPageCountBefore;
- //#i72820# calculate layout to be able to find the correct page index
+ }
+ pTargetShell->Paste( rWorkShell.GetDoc(), sal_True );
+ //convert fields in page styles (header/footer - has to be done after the first document has been pasted
+ if(1 == nDocNo)
+ {
pTargetShell->CalcLayout();
- aMergeInfo.nEndPageInTarget = pTargetShell->GetPageCnt();
- aMergeInfo.nDBRow = nStartRow;
- rMMConfig.AddMergedDocument( aMergeInfo );
- ++nRet;
-
- // the print monitor needs some time to act
- for( USHORT i = 0; i < 25; i++)
- Application::Reschedule();
-
- //restore the ole DBMgr
- pWorkDoc->SetNewDBMgr( pWorkDBMgr );
- //now the temporary document should be closed
- SfxObjectShellRef xDocSh(pWorkView->GetDocShell());
- xDocSh->DoClose();
+ pTargetShell->ConvertFieldsToText();
}
+ //add the document info to the config item
+ SwDocMergeInfo aMergeInfo;
+ aMergeInfo.nStartPageInTarget = nPageCountBefore;
+ //#i72820# calculate layout to be able to find the correct page index
+ pTargetShell->CalcLayout();
+ aMergeInfo.nEndPageInTarget = pTargetShell->GetPageCnt();
+ aMergeInfo.nDBRow = nStartRow;
+ rMMConfig.AddMergedDocument( aMergeInfo );
+ ++nRet;
+
+ // the print monitor needs some time to act
+ for( USHORT i = 0; i < 25; i++)
+ Application::Reschedule();
+
+ //restore the ole DBMgr
+ pWorkDoc->SetNewDBMgr( pWorkDBMgr );
+ //now the temporary document should be closed
+ SfxObjectShellRef xDocSh(pWorkView->GetDocShell());
+ xDocSh->DoClose();
nEndRow = pImpl->pMergeData->xResultSet->getRow();
++nDocNo;
} while( !bCancel &&
@@ -3390,8 +3368,6 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
{
DBG_ERROR("exception caught in SwNewDBMgr::MergeDocuments");
}
- if(sSourceDocURL.Len())
- File::remove( sSourceDocURL );
DELETEZ(pImpl->pMergeData);
bInMerge = FALSE;
return nRet;
@@ -3425,4 +3401,3 @@ void SwConnectionDisposedListener_Impl::disposing( const EventObject& rSource )
}
}
}
-
diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx
index 0fff9f762131..0423137cc3c3 100644
--- a/sw/source/ui/dbui/mailmergehelper.cxx
+++ b/sw/source/ui/dbui/mailmergehelper.cxx
@@ -627,8 +627,16 @@ SwMergeAddressItem SwAddressIterator::Next()
aRet.bIsColumn = true;
xub_StrLen nClose = sAddress.Search('>');
DBG_ASSERT(nClose != STRING_NOTFOUND, "closing '>' not found");
- aRet.sText = sAddress.Copy(1, nClose - 1);
- sAddress.Erase(0, nClose + 1);
+ if( nClose != STRING_NOTFOUND )
+ {
+ aRet.sText = sAddress.Copy(1, nClose - 1);
+ sAddress.Erase(0, nClose + 1);
+ }
+ else
+ {
+ aRet.sText = sAddress.Copy(1, 1);
+ sAddress.Erase(0, 1);
+ }
}
else
{
diff --git a/sw/source/ui/dbui/makefile.mk b/sw/source/ui/dbui/makefile.mk
index b1aa16f694c3..40d6807c2ead 100644
--- a/sw/source/ui/dbui/makefile.mk
+++ b/sw/source/ui/dbui/makefile.mk
@@ -79,6 +79,7 @@ EXCEPTIONSFILES= \
$(SLO)$/mmaddressblockpage.obj \
$(SLO)$/mmconfigitem.obj \
$(SLO)$/mmlayoutpage.obj \
+ $(SLO)$/mmgreetingspage.obj \
$(SLO)$/mmoutputpage.obj
SLOFILES = \
diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx
index e2fcf188a3b3..03bd61021306 100644
--- a/sw/source/ui/dbui/mmgreetingspage.cxx
+++ b/sw/source/ui/dbui/mmgreetingspage.cxx
@@ -42,6 +42,7 @@
#include <vcl/msgbox.hxx>
#include <mmgreetingspage.hrc>
#include <dbui.hrc>
+#include <com/sun/star/sdb/XColumn.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <helpid.h>
@@ -117,6 +118,7 @@ IMPL_LINK(SwGreetingsHandler, IndividualHdl_Impl, CheckBox*, EMPTYARG)
m_pWizard->UpdateRoadmap();
m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_PREPAREMERGEPAGE));
}
+ UpdatePreview();
return 0;
}
/*-- 30.04.2004 10:42:57---------------------------------------------------
@@ -133,12 +135,12 @@ IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, PushButton*, pButton)
{
ListBox* pToInsert = pButton == m_pMalePB ? m_pMaleLB : m_pFemaleLB;
pToInsert->SelectEntryPos(pToInsert->InsertEntry(pDlg->GetAddress()));
- UpdatePreview();
if(m_bIsTabPage)
{
m_pWizard->UpdateRoadmap();
m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_PREPAREMERGEPAGE));
}
+ UpdatePreview();
}
delete pDlg;
return 0;
@@ -182,9 +184,54 @@ IMPL_LINK(SwMailMergeGreetingsPage, GreetingSelectHdl_Impl, ListBox*, EMPTYARG)
-----------------------------------------------------------------------*/
void SwMailMergeGreetingsPage::UpdatePreview()
{
- String sPreview = m_aFemaleLB.GetSelectEntry();
- sPreview += '\n';
- sPreview += m_aMaleLB.GetSelectEntry();
+ //find out which type of greeting should be selected:
+ bool bFemale = false;
+ bool bNoValue = !m_pFemaleColumnLB->IsEnabled();
+ if( !bNoValue )
+ {
+ ::rtl::OUString sFemaleValue = m_aFemaleFieldCB.GetText();
+ ::rtl::OUString sFemaleColumn = m_aFemaleColumnLB.GetSelectEntry();
+ Reference< sdbcx::XColumnsSupplier > xColsSupp( m_pWizard->GetConfigItem().GetResultSet(), UNO_QUERY);
+ Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0;
+ if(sFemaleValue.getLength() && sFemaleColumn.getLength() &&
+ xColAccess.is() &&
+ xColAccess->hasByName(sFemaleColumn))
+ {
+ //get the content and exchange it in the address string
+ Any aCol = xColAccess->getByName(sFemaleColumn);
+ Reference< sdb::XColumn > xColumn;
+ aCol >>= xColumn;
+ if(xColumn.is())
+ {
+ try
+ {
+ ::rtl::OUString sFemaleColumnValue = xColumn->getString();
+ bFemale = sFemaleColumnValue == sFemaleValue;
+ //bNoValue = !sFemaleColumnValue.getLength();
+ if( !bNoValue )
+ {
+ //no last name value marks the greeting also als neutral
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+ ::rtl::OUString sLastNameColumn = rConfig.GetAssignedColumn(MM_PART_LASTNAME);
+ if ( xColAccess->hasByName(sLastNameColumn) )
+ {
+ aCol = xColAccess->getByName(sLastNameColumn);
+ aCol >>= xColumn;
+ ::rtl::OUString sLastNameColumnValue = xColumn->getString();
+ bNoValue = !sLastNameColumnValue.getLength();
+ }
+ }
+ }
+ catch( sdbc::SQLException& )
+ {
+ DBG_ERROR("SQLException caught");
+ }
+ }
+ }
+ }
+
+ String sPreview = bFemale ? m_aFemaleLB.GetSelectEntry() :
+ bNoValue ? m_aNeutralCB.GetText() : m_aMaleLB.GetSelectEntry();
sPreview = SwAddressPreview::FillData(sPreview, m_pWizard->GetConfigItem());
m_aPreviewWIN.SetAddress(sPreview);
@@ -284,6 +331,12 @@ SwMailMergeGreetingsPage::SwMailMergeGreetingsPage( SwMailMergeWizard* _pParent)
Link aLBoxLink = LINK(this, SwMailMergeGreetingsPage, GreetingSelectHdl_Impl);
m_aFemaleLB.SetSelectHdl(aLBoxLink);
m_aMaleLB.SetSelectHdl(aLBoxLink);
+ m_aFemaleColumnLB.SetSelectHdl(aLBoxLink);
+ m_aFemaleFieldCB.SetSelectHdl(aLBoxLink);
+ m_aFemaleFieldCB.SetModifyHdl(aLBoxLink);
+ m_aNeutralCB.SetSelectHdl(aLBoxLink);
+ m_aNeutralCB.SetModifyHdl(aLBoxLink);
+
Link aDataLink = LINK(this, SwMailMergeGreetingsPage, InsertDataHdl_Impl);
m_aPrevSetIB.SetClickHdl(aDataLink);
m_aNextSetIB.SetClickHdl(aDataLink);
@@ -348,13 +401,9 @@ sal_Bool SwMailMergeGreetingsPage::commitPage( CommitPageReason )
{
const SwDBData& rDBData = rConfig.GetCurrentDBData();
Sequence< ::rtl::OUString> aAssignment = rConfig.GetColumnAssignment( rDBData );
- sal_Int32 nPos = m_aFemaleColumnLB.GetSelectEntryPos();
if(aAssignment.getLength() <= MM_PART_GENDER)
aAssignment.realloc(MM_PART_GENDER + 1);
- if( nPos > 0 )
- aAssignment[MM_PART_GENDER] = m_aFemaleColumnLB.GetSelectEntry();
- else
- aAssignment[MM_PART_GENDER] = ::rtl::OUString();
+ aAssignment[MM_PART_GENDER] = m_aFemaleColumnLB.GetSelectEntry();
rConfig.SetColumnAssignment( rDBData, aAssignment );
}
if(m_aFemaleFieldCB.GetText() != m_aFemaleFieldCB.GetSavedValue())
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index 44c2aeeb6220..ddb37e3c8eeb 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -614,8 +614,6 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
sCondition += String(rFemaleGenderValue);
sCondition.AppendAscii("\" OR NOT ");
sCondition += String(sNameColumnBase);
- sHideParagraphsExpression += '!';
- sHideParagraphsExpression += sNameColumnBase;
break;
case SwMailMergeConfigItem::NEUTRAL:
sCondition = sNameColumnBase;
@@ -802,7 +800,8 @@ IMPL_LINK(SwMailMergeLayoutPage, GreetingsHdl_Impl, PushButton*, pButton)
{
bool bDown = pButton == &m_aDownPB;
BOOL bMoved = m_pExampleWrtShell->MoveParagraph( bDown ? 1 : -1 );
- m_pWizard->GetConfigItem().MoveGreeting(bDown ? 1 : -1 );
+ if (bMoved || bDown)
+ m_pWizard->GetConfigItem().MoveGreeting(bDown ? 1 : -1 );
if(!bMoved && bDown)
{
//insert a new paragraph before the greeting line
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 64fd024fab57..72fc1e122a8e 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -428,6 +428,8 @@ SwMailMergeOutputPage::SwMailMergeOutputPage( SwMailMergeWizard* _pParent) :
m_aSendAllRB.SetClickHdl(LINK(this, SwMailMergeOutputPage, DocumentSelectionHdl_Impl));
m_aFromRB.SetClickHdl(LINK(this, SwMailMergeOutputPage, DocumentSelectionHdl_Impl));
+ //#i63267# printing might be disabled
+ m_aPrintRB.Enable(!Application::GetSettings().GetMiscSettings().GetDisablePrinting());
}
/*-- 02.04.2004 13:15:44---------------------------------------------------
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 9880c8f43efb..58b2ec22d97c 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -93,7 +93,6 @@
#include <glossary.hxx> //add for SwGlossaryDlg
#include <inpdlg.hxx> //add for SwFldInputDlg
#include <insfnote.hxx> //add for SwInsFootNoteDlg
-#include <insrc.hxx> //add for SwInsRowColDlg
#include <insrule.hxx> //add for SwInsertGrfRulerDlg
#include <instable.hxx> //add for SwInsTableDlg
#include <javaedit.hxx> //add for SwJavaEditDialog
@@ -1359,14 +1358,11 @@ AbstractInsFootNoteDlg* SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( int
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclSwViewDialog( int nResId,
- SwView& rView, BOOL bCol ) //add for SwInsRowColDlg, SwLineNumberingDlg
+ SwView& rView, BOOL /*bCol*/ ) //add for SwInsRowColDlg, SwLineNumberingDlg
{
Dialog* pDlg=NULL;
switch ( nResId )
{
- case DLG_INS_ROW_COL :
- pDlg = new SwInsRowColDlg( rView, bCol );
- break;
case DLG_LINE_NUMBERING :
pDlg = new SwLineNumberingDlg( &rView );
break;
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index 33b1029189c0..ea6ab45f4ec1 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -468,7 +468,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor )
pClpDocFac = new SwDocFac;
SwDoc* pTmpDoc = pClpDocFac->GetDoc();
- pTmpDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)aDocShellRef );
+ pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) );
pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen
pWrtShell->Copy( pTmpDoc );
@@ -561,10 +561,14 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor )
break;
case SOT_FORMAT_STRING:
- bOK = SetObject( pClpDocFac->GetDoc(),
+ {
+ SwDoc* pDoc = pClpDocFac->GetDoc();
+ ASSERT( pDoc, "Document not found" );
+ pDoc->SetClipBoard( true );
+ bOK = SetObject( pDoc,
SWTRANSFER_OBJECTTYPE_STRING, rFlavor );
- break;
-
+ }
+ break;
case SOT_FORMAT_RTF:
bOK = SetObject( pClpDocFac->GetDoc(),
SWTRANSFER_OBJECTTYPE_RTF, rFlavor );
@@ -879,7 +883,7 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut )
SwDoc* pTmpDoc = pClpDocFac->GetDoc();
pTmpDoc->SetClipBoard( true );
- pTmpDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)aDocShellRef );
+ pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) );
pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen
pWrtShell->Copy( pTmpDoc );
@@ -1063,7 +1067,7 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary,
SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // gehe zum 1. ContentNode
SwPaM aPam( *pCNd );
- pCDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)aDocShellRef );
+ pCDoc->SetRefForDocShell( boost::addressof(aDocShellRef) );
pCDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen
pCDoc->InsertGlossary( rGlossary, rStr, aPam, 0 );
@@ -2894,6 +2898,15 @@ static USHORT aPasteSpecialIds[] =
0
};
+
+int SwTransferable::PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& rData )
+{
+ // Plain text == unformatted
+ return SwTransferable::PasteFormat( rSh, rData, SOT_FORMAT_STRING );
+}
+
+// -----------------------------------------------------------------------
+
int SwTransferable::PasteSpecial( SwWrtShell& rSh, TransferableDataHelper& rData, ULONG& rFormatUsed )
{
int nRet = 0;
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index fa9a0f3e77bb..2bf9992a8573 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -420,7 +420,7 @@ void SwEditWin::UpdatePointer(const Point &rLPt, USHORT nModifier )
SdrObject* pObj; SdrPageView* pPV;
pSdrView->SetHitTolerancePixel( HIT_PIX );
if ( bNotInSelObj && bExecHyperlinks &&
- pSdrView->PickObj( rLPt, pObj, pPV, SDRSEARCH_PICKMACRO ))
+ pSdrView->PickObj( rLPt, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO ))
{
SdrObjMacroHitRec aTmp;
aTmp.aPos = rLPt;
@@ -1405,8 +1405,8 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
if( rKeyCode.GetFullCode() == (KEY_A | KEY_MOD1 |KEY_SHIFT)
&& rSh.HasDrawView() &&
(0 != (nLclSelectionType = rSh.GetSelectionType()) &&
- ((nLclSelectionType & nsSelectionType::SEL_FRM) ||
- ((nLclSelectionType & nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM) &&
+ ((nLclSelectionType & (nsSelectionType::SEL_FRM|nsSelectionType::SEL_GRF)) ||
+ ((nLclSelectionType & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) &&
rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1))))
{
SdrHdlList& rHdlList = (SdrHdlList&)rSh.GetDrawView()->GetHdlList();
diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx
index eff8acc720df..583758b50522 100644
--- a/sw/source/ui/docvw/edtwin2.cxx
+++ b/sw/source/ui/docvw/edtwin2.cxx
@@ -94,6 +94,11 @@
#include <PostItMgr.hxx>
#include <fmtfld.hxx>
+// --> OD 2009-08-18 #i104300#
+#include <IDocumentMarkAccess.hxx>
+#include <ndtxt.hxx>
+// <--
+
/*--------------------------------------------------------------------
Beschreibung: KeyEvents
--------------------------------------------------------------------*/
@@ -205,6 +210,38 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
sSuffix.EqualsAscii( pMarkToOLE ))
sTxt = sTxt.Copy( 0, nFound - 1);
}
+ // --> OD 2009-08-18 #i104300#
+ // special handling if target is a cross-reference bookmark
+ {
+ String sTmpSearchStr = sTxt.Copy( 1, sTxt.Len() );
+ IDocumentMarkAccess* const pMarkAccess =
+ rSh.getIDocumentMarkAccess();
+ IDocumentMarkAccess::const_iterator_t ppBkmk =
+ pMarkAccess->findBookmark( sTmpSearchStr );
+ if ( ppBkmk != pMarkAccess->getBookmarksEnd() &&
+ IDocumentMarkAccess::GetType( *(ppBkmk->get()) )
+ == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK )
+ {
+ SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode();
+ if ( pTxtNode )
+ {
+ sTxt = pTxtNode->GetExpandTxt( 0, pTxtNode->Len(), true, true );
+
+ if( sTxt.Len() )
+ {
+ sTxt.EraseAllChars( 0xad );
+ for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p )
+ {
+ if( *p < 0x20 )
+ *p = 0x20;
+ else if(*p == 0x2011)
+ *p = '-';
+ }
+ }
+ }
+ }
+ }
+ // <--
// --> OD 2007-07-26 #i80029#
BOOL bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
if ( !bExecHyperlinks )
diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx
index a7c12f54f100..a9809e07e496 100644
--- a/sw/source/ui/docvw/postit.cxx
+++ b/sw/source/ui/docvw/postit.cxx
@@ -117,6 +117,14 @@
#include <ndtxt.hxx>
#include <langhelper.hxx>
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/attribute/fillattribute.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
+
using namespace ::com::sun::star;
#define METABUTTON_WIDTH 16
@@ -915,12 +923,17 @@ void SwMarginWin::SetPosAndSize()
basegfx::B2DPoint( mAnkorRect.Left(), mAnkorRect.Bottom()+2*15),
basegfx::B2DPoint( mPageBorder ,mAnkorRect.Bottom()+2*15),
basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
- basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) , mColorAnkor,LineInfo(LINE_DASH,ANKORLINE_WIDTH*15), false);
+ basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) ,
+ mColorAnkor,
+ false,
+ false);
mpAnkor->SetHeight(mAnkorRect.Height());
mpAnkor->setVisible(true);
mpAnkor->SetAnkorState(AS_TRI);
if (HasChildPathFocus())
- mpAnkor->SetLineInfo(LineInfo(LINE_SOLID,ANKORLINE_WIDTH*15));
+ {
+ mpAnkor->setLineSolid(true);
+ }
pOverlayManager->add(*mpAnkor);
}
}
@@ -1493,7 +1506,7 @@ void SwMarginWin::SetViewState(ShadowState bState)
SwMarginWin* pWin = GetTopReplyNote();
if (IsFollow() && pWin)
pWin->Ankor()->SetAnkorState(AS_END);
- mpAnkor->SetLineInfo(LineInfo(LINE_SOLID,ANKORLINE_WIDTH*15));
+ mpAnkor->setLineSolid(true);
}
if (mpShadow)
mpShadow->SetShadowState(bState);
@@ -1502,7 +1515,7 @@ void SwMarginWin::SetViewState(ShadowState bState)
case SS_VIEW:
{
if (mpAnkor)
- mpAnkor->SetLineInfo(LineInfo(LINE_SOLID,ANKORLINE_WIDTH*15));
+ mpAnkor->setLineSolid(true);
if (mpShadow)
mpShadow->SetShadowState(bState);
break;
@@ -1521,11 +1534,11 @@ void SwMarginWin::SetViewState(ShadowState bState)
if (pTopWinSelf && (pTopWinSelf!=pTopWinActive))
{
if (pTopWinSelf!=mpMgr->GetActivePostIt())
- pTopWinSelf->Ankor()->SetLineInfo(LineInfo(LINE_DASH,ANKORLINE_WIDTH*15));
+ pTopWinSelf->Ankor()->setLineSolid(false);
pTopWinSelf->Ankor()->SetAnkorState(AS_ALL);
}
}
- mpAnkor->SetLineInfo(LineInfo(LINE_DASH,ANKORLINE_WIDTH*15));
+ mpAnkor->setLineSolid(false);
}
if (mpShadow)
mpShadow->SetShadowState(bState);
@@ -1633,19 +1646,17 @@ void SwPostIt::UpdateData()
{
if ( Engine()->IsModified() )
{
- SwPosition * pPos = mpFmtFld->GetTxtFld()->GetPosition();
- if ( pPos )
- {
- SwField* pOldField = mpFld->Copy();
- mpFld->SetPar2(Engine()->GetEditEngine().GetText());
- mpFld->SetTextObject(Engine()->CreateParaObject());
- DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(*pPos, *pOldField, *mpFld, 0, true));
- delete pOldField;
- delete pPos;
- // so we get a new layout of notes (ankor position is still the same and we would otherwise not get one)
- Mgr()->SetLayout();
- DocView()->GetDocShell()->SetModified();
- }
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwField* pOldField = mpFld->Copy();
+ mpFld->SetPar2(Engine()->GetEditEngine().GetText());
+ mpFld->SetTextObject(Engine()->CreateParaObject());
+ DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
+ delete pOldField;
+ // so we get a new layout of notes (ankor position is still the same and we would otherwise not get one)
+ Mgr()->SetLayout();
+ DocView()->GetDocShell()->SetModified();
}
Engine()->ClearModifyFlag();
Engine()->GetUndoManager().Clear();
@@ -1685,11 +1696,11 @@ sal_uInt32 SwPostIt::MoveCaret()
//returns true, if there is another note right before this note
bool SwPostIt::CalcFollow()
{
- SwPosition * pPos = mpFmtFld->GetTxtFld()->GetPosition();
- const SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
- SwTxtAttr* pTxtAttr = pTxtNd ? pTxtNd->GetTxtAttr( pPos->nContent.GetIndex()-1,RES_TXTATR_FIELD ) : 0;
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwTxtAttr* pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttr( aPosition.nContent.GetIndex()-1,RES_TXTATR_FIELD );
const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
- delete pPos;
return pFld && (pFld->Which()== RES_POSTITFLD);
}
@@ -1697,18 +1708,18 @@ bool SwPostIt::CalcFollow()
sal_uInt32 SwPostIt::CountFollowing()
{
sal_uInt32 aCount = 1; // we start with 1, so we have to subtract one at the end again
- SwPosition * pPos = mpFmtFld->GetTxtFld()->GetPosition();
- const SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
- SwTxtAttr* pTxtAttr = pTxtNd ? pTxtNd->GetTxtAttr( pPos->nContent.GetIndex()+1,RES_TXTATR_FIELD ) : 0;
+ SwTxtAttr* pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttr( aPosition.nContent.GetIndex()+1,RES_TXTATR_FIELD );
SwField* pFld = pTxtAttr ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) : 0;
while (pFld && (pFld->Which()== RES_POSTITFLD))
{
aCount++;
- pTxtAttr = pTxtNd ? pTxtNd->GetTxtAttr( pPos->nContent.GetIndex() + aCount,RES_TXTATR_FIELD ) : 0;
+ pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttr( aPosition.nContent.GetIndex() + aCount,RES_TXTATR_FIELD );
pFld = pTxtAttr ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) : 0;
}
- delete pPos;
return aCount - 1;
}
@@ -1815,16 +1826,14 @@ void SwPostIt::InitAnswer(OutlinerParaObject* pText)
// lets insert an undo step so the initial text can be easily deleted
// but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
Engine()->SetModifyHdl( Link() );
- SwPosition * pPos = mpFmtFld->GetTxtFld()->GetPosition();
- if ( pPos )
- {
- SwField* pOldField = mpFld->Copy();
- mpFld->SetPar2(Engine()->GetEditEngine().GetText());
- mpFld->SetTextObject(Engine()->CreateParaObject());
- DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(*pPos, *pOldField, *mpFld, 0, true));
- delete pOldField;
- delete pPos;
- }
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwField* pOldField = mpFld->Copy();
+ mpFld->SetPar2(Engine()->GetEditEngine().GetText());
+ mpFld->SetTextObject(Engine()->CreateParaObject());
+ DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
+ delete pOldField;
Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
Engine()->ClearModifyFlag();
Engine()->GetUndoManager().Clear();
@@ -1965,60 +1974,116 @@ bool SwRedComment::IsProtected()
}
*/
-/****** SwPostItShadow ***********************************************************/
-SwPostItShadow::SwPostItShadow(const basegfx::B2DPoint& rBasePos,const basegfx::B2DPoint& rSecondPosition,
- Color aBaseColor,ShadowState aState)
- : OverlayObjectWithBasePosition(rBasePos, aBaseColor),
- maSecondPosition(rSecondPosition),
- mShadowState(aState)
-{
-// mbAllowsAnimation = sal_True;
-}
+//////////////////////////////////////////////////////////////////////////////
+// helper SwPostItShadowPrimitive
+//
+// Used to allow view-dependent primitive definition. For that purpose, the
+// initially created primitive (this one) always has to be view-independent,
+// but the decomposition is made view-dependent. Very simple primitive which
+// just remembers the discrete data and applies it at decomposition time.
-SwPostItShadow::~SwPostItShadow()
+class SwPostItShadowPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
{
-}
+private:
+ basegfx::B2DPoint maBasePosition;
+ basegfx::B2DPoint maSecondPosition;
+ ShadowState maShadowState;
-void SwPostItShadow::Trigger(sal_uInt32 /*nTime*/)
-{
-}
+protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
-void SwPostItShadow::drawGeometry(OutputDevice& rOutputDevice)
-{
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor();
+public:
+ SwPostItShadowPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ const basegfx::B2DPoint& rSecondPosition,
+ ShadowState aShadowState)
+ : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
+ maBasePosition(rBasePosition),
+ maSecondPosition(rSecondPosition),
+ maShadowState(aShadowState)
+ {}
+
+ // data access
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
+ ShadowState getShadowState() const { return maShadowState; }
+
+ virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
- const Fraction& f( rOutputDevice.GetMapMode().GetScaleY() );
- sal_Int32 aBigHeight( 4 * f.GetNumerator() / f.GetDenominator());
- sal_Int32 aSmallHeight( 2 * f.GetNumerator() / f.GetDenominator());
+ DeclPrimitrive2DIDBlock()
+};
- const Point aStart(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- const Point aEndSmall(FRound(GetSecondPosition().getX()), FRound(GetSecondPosition().getY() + rOutputDevice.PixelToLogic(Size(0,aSmallHeight)).Height()));
- const Point aEndBig(FRound(GetSecondPosition().getX()), FRound(GetSecondPosition().getY() + rOutputDevice.PixelToLogic(Size(0,aBigHeight)).Height()));
- Rectangle aSmallRectangle(aStart, aEndSmall);
- Rectangle aBigRectangle(aStart, aEndBig);
+drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::createLocalDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ // get logic sizes in object coordinate system
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ basegfx::B2DRange aRange(getBasePosition());
- switch(mShadowState)
+ switch(maShadowState)
{
case SS_NORMAL:
{
- Gradient aGradient(GRADIENT_LINEAR,Color(230,230,230),POSTIT_SHADOW_BRIGHT);
- aGradient.SetAngle(1800);
- rOutputDevice.DrawGradient(aSmallRectangle, aGradient);
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (2.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
+ 2);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
break;
}
case SS_VIEW:
{
- Gradient aGradient(GRADIENT_LINEAR,Color(230,230,230),POSTIT_SHADOW_BRIGHT);
- aGradient.SetAngle(1800);
- rOutputDevice.DrawGradient(aBigRectangle, aGradient);
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
+ 4);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
break;
}
case SS_EDIT:
{
- Gradient aGradient(GRADIENT_LINEAR,Color(230,230,230),POSTIT_SHADOW_DARK);
- aGradient.SetAngle(1800);
- rOutputDevice.DrawGradient(aBigRectangle, aGradient);
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0),
+ 4);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
break;
}
default:
@@ -2026,19 +2091,48 @@ void SwPostItShadow::drawGeometry(OutputDevice& rOutputDevice)
break;
}
}
+
+ return xRetval;
}
-void SwPostItShadow::createBaseRange(OutputDevice& rOutputDevice)
+bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
{
- maBaseRange.reset();
+ if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const SwPostItShadowPrimitive& rCompare = static_cast< const SwPostItShadowPrimitive& >(rPrimitive);
- const Fraction& f( rOutputDevice.GetMapMode().GetScaleY() );
- sal_Int32 aBigHeight( 4 * f.GetNumerator() / f.GetDenominator());
+ return (getBasePosition() == rCompare.getBasePosition()
+ && getSecondPosition() == rCompare.getSecondPosition()
+ && getShadowState() == rCompare.getShadowState());
+ }
- Rectangle aRect(Point(FRound(getBasePosition().getX()),FRound(getBasePosition().getY())),
- Point(FRound(GetSecondPosition().getX()),FRound(GetSecondPosition().getY()+rOutputDevice.PixelToLogic(Size(0,aBigHeight)).Height())));
- maBaseRange.expand(basegfx::B2DPoint(aRect.Left(), aRect.Top()));
- maBaseRange.expand(basegfx::B2DPoint(aRect.Right(), aRect.Bottom()));
+ return false;
+}
+
+ImplPrimitrive2DIDBlock(SwPostItShadowPrimitive, PRIMITIVE2D_ID_SWPOSTITSHADOWPRIMITIVE)
+
+/****** SwPostItShadow ***********************************************************/
+SwPostItShadow::SwPostItShadow(const basegfx::B2DPoint& rBasePos,const basegfx::B2DPoint& rSecondPosition,
+ Color aBaseColor,ShadowState aState)
+ : OverlayObjectWithBasePosition(rBasePos, aBaseColor),
+ maSecondPosition(rSecondPosition),
+ mShadowState(aState)
+{
+// mbAllowsAnimation = false;
+}
+
+SwPostItShadow::~SwPostItShadow()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence SwPostItShadow::createOverlayObjectPrimitive2DSequence()
+{
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new SwPostItShadowPrimitive(
+ getBasePosition(),
+ GetSecondPosition(),
+ GetShadowState()));
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
void SwPostItShadow::SetShadowState(ShadowState aState)
@@ -2046,6 +2140,7 @@ void SwPostItShadow::SetShadowState(ShadowState aState)
if (mShadowState != aState)
{
mShadowState = aState;
+
objectChange();
}
}
@@ -2053,22 +2148,210 @@ void SwPostItShadow::SetShadowState(ShadowState aState)
void SwPostItShadow::SetPosition(const basegfx::B2DPoint& rPoint1,
const basegfx::B2DPoint& rPoint2)
{
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
+ if(!rPoint1.equal(getBasePosition()) || !rPoint2.equal(GetSecondPosition()))
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
- objectChange();
+ objectChange();
+ }
}
-void SwPostItShadow::transform(const basegfx::B2DHomMatrix& rMatrix)
+
+//////////////////////////////////////////////////////////////////////////////
+// helper class: Primitive for discrete visualisation
+
+class SwPostItAnkorPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
+{
+private:
+ basegfx::B2DPolygon maTriangle;
+ basegfx::B2DPolygon maLine;
+ basegfx::B2DPolygon maLineTop;
+ AnkorState maAnkorState;
+ basegfx::BColor maColor;
+
+ // discrete line width
+ double mfLogicLineWidth;
+
+ // bitfield
+ bool mbShadow : 1;
+ bool mbLineSolid : 1;
+
+protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
+
+public:
+ SwPostItAnkorPrimitive(
+ const basegfx::B2DPolygon& rTriangle,
+ const basegfx::B2DPolygon& rLine,
+ const basegfx::B2DPolygon& rLineTop,
+ AnkorState aAnkorState,
+ const basegfx::BColor& rColor,
+ double fLogicLineWidth,
+ bool bShadow,
+ bool bLineSolid)
+ : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
+ maTriangle(rTriangle),
+ maLine(rLine),
+ maLineTop(rLineTop),
+ maAnkorState(aAnkorState),
+ maColor(rColor),
+ mfLogicLineWidth(fLogicLineWidth),
+ mbShadow(bShadow),
+ mbLineSolid(bLineSolid)
+ {}
+
+ // data access
+ const basegfx::B2DPolygon& getTriangle() const { return maTriangle; }
+ const basegfx::B2DPolygon& getLine() const { return maLine; }
+ const basegfx::B2DPolygon& getLineTop() const { return maLineTop; }
+ AnkorState getAnkorState() const { return maAnkorState; }
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getLogicLineWidth() const { return mfLogicLineWidth; }
+ bool getShadow() const { return mbShadow; }
+ bool getLineSolid() const { return mbLineSolid; }
+
+ virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+};
+
+drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLocalDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
{
- if(!rMatrix.isIdentity())
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(AS_TRI == getAnkorState() || AS_ALL == getAnkorState() || AS_START == getAnkorState())
{
- // transform base position
- OverlayObjectWithBasePosition::transform(rMatrix);
- maSecondPosition = rMatrix * GetSecondPosition();
- objectChange();
+ // create triangle
+ const drawinglayer::primitive2d::Primitive2DReference aTriangle(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(getTriangle()),
+ getColor()));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aTriangle);
+ }
+
+ if(AS_ALL == getAnkorState() || AS_START == getAnkorState())
+ {
+ // create line start
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ getColor(),
+ getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
+
+ if(getLineSolid())
+ {
+ const drawinglayer::primitive2d::Primitive2DReference aSolidLine(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLine(),
+ aLineAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aSolidLine);
+ }
+ else
+ {
+ ::std::vector< double > aDotDashArray;
+ const double fDistance(3.0 * 15.0);
+ const double fDashLen(5.0 * 15.0);
+
+ aDotDashArray.push_back(fDashLen);
+ aDotDashArray.push_back(fDistance);
+
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
+ aDotDashArray,
+ fDistance + fDashLen);
+
+ const drawinglayer::primitive2d::Primitive2DReference aStrokedLine(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLine(),
+ aLineAttribute,
+ aStrokeAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aStrokedLine);
+ }
+ }
+
+ if(aRetval.hasElements() && getShadow())
+ {
+ // shadow is only for triangle and line start, and in upper left
+ // and lower right direction, in different colors
+ const double fColorChange(20.0 / 255.0);
+ const basegfx::B3DTuple aColorChange(fColorChange, fColorChange, fColorChange);
+ basegfx::BColor aLighterColor(getColor() + aColorChange);
+ basegfx::BColor aDarkerColor(getColor() - aColorChange);
+
+ aLighterColor.clamp();
+ aDarkerColor.clamp();
+
+ // create shadow sequence
+ drawinglayer::primitive2d::Primitive2DSequence aShadows(2);
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.set(0, 2, -getDiscreteUnit());
+ aTransform.set(1, 2, -getDiscreteUnit());
+
+ aShadows[0] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::ShadowPrimitive2D(
+ aTransform,
+ aLighterColor,
+ aRetval));
+
+ aTransform.set(0, 2, getDiscreteUnit());
+ aTransform.set(1, 2, getDiscreteUnit());
+
+ aShadows[1] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::ShadowPrimitive2D(
+ aTransform,
+ aDarkerColor,
+ aRetval));
+
+ // add shadow before geometry to make it be proccessed first
+ const drawinglayer::primitive2d::Primitive2DSequence aTemporary(aRetval);
+
+ aRetval = aShadows;
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemporary);
}
+
+ if(AS_ALL == getAnkorState() || AS_END == getAnkorState())
+ {
+ // LineTop has to be created, too, but uses no shadow, so add after
+ // the other parts are created
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ getColor(),
+ getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
+
+ const drawinglayer::primitive2d::Primitive2DReference aLineTop(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLineTop(),
+ aLineAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aLineTop);
+ }
+
+ return aRetval;
}
+bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
+{
+ if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const SwPostItAnkorPrimitive& rCompare = static_cast< const SwPostItAnkorPrimitive& >(rPrimitive);
+
+ return (getTriangle() == rCompare.getTriangle()
+ && getLine() == rCompare.getLine()
+ && getLineTop() == rCompare.getLineTop()
+ && getAnkorState() == rCompare.getAnkorState()
+ && getColor() == rCompare.getColor()
+ && getLogicLineWidth() == rCompare.getLogicLineWidth()
+ && getShadow() == rCompare.getShadow()
+ && getLineSolid() == rCompare.getLineSolid());
+ }
+
+ return false;
+}
+
+ImplPrimitrive2DIDBlock(SwPostItAnkorPrimitive, PRIMITIVE2D_ID_SWPOSTITANKORPRIMITIVE)
+
/****** SwPostItAnkor ***********************************************************/
void SwPostItAnkor::implEnsureGeometry()
@@ -2102,100 +2385,6 @@ void SwPostItAnkor::implResetGeometry()
maLineTop.clear();
}
-void SwPostItAnkor::implDrawGeometry(OutputDevice& rOutputDevice, Color aColor, double fOffX, double fOffY)
-{
- basegfx::B2DPolygon aTri(maTriangle);
- basegfx::B2DPolygon aLin(maLine);
- const Polygon aLinTop(maLineTop);
-
- if(0.0 != fOffX || 0.0 != fOffY)
- {
- // transform polygons
- basegfx::B2DHomMatrix aTranslate;
- aTranslate.set(0, 2, fOffX);
- aTranslate.set(1, 2, fOffY);
-
- aTri.transform(aTranslate);
- aLin.transform(aTranslate);
- }
-
- switch (mAnkorState)
- {
- case AS_TRI:
- {
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(aColor);
- rOutputDevice.DrawPolygon(Polygon(aTri));
- break;
- }
- case AS_ALL:
- {
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(aColor);
- //rOutputDevice.DrawTransparent(Polygon(aTri), 50);
- rOutputDevice.DrawPolygon(Polygon(aTri));
-
- // draw line
- rOutputDevice.SetLineColor(aColor);
- rOutputDevice.SetFillColor();
- rOutputDevice.DrawPolyLine(Polygon(aLin), mLineInfo);
- rOutputDevice.DrawPolyLine(aLinTop,LineInfo(LINE_SOLID,ANKORLINE_WIDTH*15));
- break;
- }
- case AS_START:
- {
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(aColor);
- rOutputDevice.DrawPolygon(Polygon(aTri));
- // draw line
- rOutputDevice.SetLineColor(aColor);
- rOutputDevice.SetFillColor();
- rOutputDevice.DrawPolyLine(Polygon(aLin), mLineInfo);
- break;
- }
- case AS_END:
- {
- // draw line
- rOutputDevice.SetLineColor(aColor);
- rOutputDevice.SetFillColor();
- rOutputDevice.DrawPolyLine(aLinTop,LineInfo(LINE_SOLID,ANKORLINE_WIDTH*15));
- break;
- }
- }
-}
-
-Color SwPostItAnkor::implBlendColor(const Color aOriginal, sal_Int16 nChange)
-{
- if(0 != nChange)
- {
- sal_Int16 nR(aOriginal.GetRed() + nChange);
- sal_Int16 nG(aOriginal.GetGreen() + nChange);
- sal_Int16 nB(aOriginal.GetBlue() + nChange);
-
- // truncate R, G and B
- if(nR > 0xff)
- nR = 0xff;
- else if(nR < 0)
- nR = 0;
-
- if(nG > 0xff)
- nG = 0xff;
- else if(nG < 0)
- nG = 0;
-
- if(nB > 0xff)
- nB = 0xff;
- else if(nB < 0)
- nB = 0;
-
- return Color((sal_uInt8)nR, (sal_uInt8)nG, (sal_uInt8)nB);
- }
- else
- {
- return aOriginal;
- }
-}
-
SwPostItAnkor::SwPostItAnkor(const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPos,
const basegfx::B2DPoint& rThirdPos,
@@ -2204,8 +2393,8 @@ SwPostItAnkor::SwPostItAnkor(const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSixthPos,
const basegfx::B2DPoint& rSeventhPos,
Color aBaseColor,
- const LineInfo &aLineInfo,
- bool bShadowedEffect)
+ bool bShadowedEffect,
+ bool bLineSolid)
: OverlayObjectWithBasePosition(rBasePos, aBaseColor),
maSecondPosition(rSecondPos),
maThirdPosition(rThirdPos),
@@ -2216,93 +2405,36 @@ SwPostItAnkor::SwPostItAnkor(const basegfx::B2DPoint& rBasePos,
maTriangle(),
maLine(),
maLineTop(),
- mLineInfo(aLineInfo),
mHeight(0),
+ mAnkorState(AS_ALL),
mbShadowedEffect(bShadowedEffect),
- mAnkorState(AS_ALL)
+ mbLineSolid(bLineSolid)
{
- if (mLineInfo.GetStyle()==LINE_DASH)
- {
- mLineInfo.SetDistance( 3 * 15);
- mLineInfo.SetDashLen( 5 * 15);
- mLineInfo.SetDashCount(100);
- }
- //mbAllowsAnimation = sal_True;
+ //mbAllowsAnimation = true;
}
SwPostItAnkor::~SwPostItAnkor()
{
}
-void SwPostItAnkor::Trigger(sal_uInt32 /*nTime*/)
-{
-}
-
-void SwPostItAnkor::drawGeometry(OutputDevice& rOutputDevice)
+drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkor::createOverlayObjectPrimitive2DSequence()
{
implEnsureGeometry();
- if(getShadowedEffect())
- {
- // calculate one pixel offset
- const basegfx::B2DVector aOnePixelOffset(rOutputDevice.GetInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0));
- const Color aLighterColor(implBlendColor(getBaseColor(), 20));
- const Color aDarkerColor(implBlendColor(getBaseColor(), -20));
-
- // draw top-left
- implDrawGeometry(rOutputDevice, aLighterColor, -aOnePixelOffset.getX(), -aOnePixelOffset.getY());
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new SwPostItAnkorPrimitive(
+ maTriangle,
+ maLine,
+ maLineTop,
+ GetAnkorState(),
+ getBaseColor().getBColor(),
+ ANKORLINE_WIDTH * 15.0,
+ getShadowedEffect(),
+ getLineSolid()));
- // draw bottom-right
- implDrawGeometry(rOutputDevice, aDarkerColor, aOnePixelOffset.getX(), aOnePixelOffset.getY());
- }
-
- // draw original
- implDrawGeometry(rOutputDevice, getBaseColor(), 0.0, 0.0);
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
-void SwPostItAnkor::createBaseRange(OutputDevice& rOutputDevice)
-{
- // get range from geometry
- implEnsureGeometry();
- maBaseRange = basegfx::tools::getRange(maTriangle);
- maBaseRange.expand(basegfx::tools::getRange(maLine));
- maBaseRange.expand(basegfx::tools::getRange(maLineTop));
-
- /*
- basegfx::B2DHomMatrix aMatrix;
- aMatrix.translate(-maTriangle.getB2DPoint(0).getX(),-maTriangle.getB2DPoint(0).getY());
- aMatrix.scale(1.0,-1.0);
- aMatrix.translate(maTriangle.getB2DPoint(0).getX(),maTriangle.getB2DPoint(0).getY());
- aMatrix.translate(0,(mHeight*-1) + 13 * 15 );
- basegfx::B2DRange MyRange(basegfx::tools::getRange(maTriangle));
- MyRange.transform(aMatrix);
- maBaseRange.expand(MyRange);
- */
-
- // expand range for thick lines and shadowed geometry
- double fExpand(0.0);
-
- // take fat line into account
- if(0 != mLineInfo.GetWidth())
- {
- // expand range for logic half line width
- fExpand += static_cast< double >(mLineInfo.GetWidth()) / 2.0;
- }
-
- // take shadowed into account
- if(getShadowedEffect())
- {
- const basegfx::B2DVector aOnePixelOffset(rOutputDevice.GetInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0));
- fExpand += ::std::max(aOnePixelOffset.getX(), aOnePixelOffset.getY());
- }
-
- if(0.0 != fExpand)
- {
- maBaseRange.grow(fExpand);
- }
-}
-
-
void SwPostItAnkor::SetAllPosition(const basegfx::B2DPoint& rPoint1,
const basegfx::B2DPoint& rPoint2,
const basegfx::B2DPoint& rPoint3,
@@ -2311,16 +2443,25 @@ void SwPostItAnkor::SetAllPosition(const basegfx::B2DPoint& rPoint1,
const basegfx::B2DPoint& rPoint6,
const basegfx::B2DPoint& rPoint7)
{
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
- maThirdPosition = rPoint3;
- maFourthPosition = rPoint4;
- maFifthPosition = rPoint5;
- maSixthPosition = rPoint6;
- maSeventhPosition = rPoint7;
+ if(rPoint1 != getBasePosition()
+ || rPoint2 != GetSecondPosition()
+ || rPoint3 != GetThirdPosition()
+ || rPoint4 != GetFourthPosition()
+ || rPoint5 != GetFifthPosition()
+ || rPoint6 != GetSixthPosition()
+ || rPoint7 != GetSeventhPosition())
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+ maThirdPosition = rPoint3;
+ maFourthPosition = rPoint4;
+ maFifthPosition = rPoint5;
+ maSixthPosition = rPoint6;
+ maSeventhPosition = rPoint7;
- implResetGeometry();
- objectChange();
+ implResetGeometry();
+ objectChange();
+ }
}
void SwPostItAnkor::SetSixthPosition(const basegfx::B2DPoint& rNew)
@@ -2346,54 +2487,28 @@ void SwPostItAnkor::SetSeventhPosition(const basegfx::B2DPoint& rNew)
void SwPostItAnkor::SetTriPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2,const basegfx::B2DPoint& rPoint3,
const basegfx::B2DPoint& rPoint4,const basegfx::B2DPoint& rPoint5)
{
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
- maThirdPosition = rPoint3;
- maFourthPosition = rPoint4;
- maFifthPosition = rPoint5;
-
- implResetGeometry();
- objectChange();
-}
-
-void SwPostItAnkor::transform(const basegfx::B2DHomMatrix& rMatrix)
-{
- if(!rMatrix.isIdentity())
+ if(rPoint1 != getBasePosition()
+ || rPoint2 != GetSecondPosition()
+ || rPoint3 != GetThirdPosition()
+ || rPoint4 != GetFourthPosition()
+ || rPoint5 != GetFifthPosition())
{
- // transform base position
- OverlayObjectWithBasePosition::transform(rMatrix);
-
- maSecondPosition = rMatrix * GetSecondPosition();
- maThirdPosition = rMatrix * GetThirdPosition();
- maFourthPosition = rMatrix * GetFourthPosition();
- maFifthPosition = rMatrix * GetFifthPosition();
- maSixthPosition = rMatrix * GetSixthPosition();
- maSeventhPosition = rMatrix * GetSeventhPosition();
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+ maThirdPosition = rPoint3;
+ maFourthPosition = rPoint4;
+ maFifthPosition = rPoint5;
implResetGeometry();
objectChange();
}
}
-void SwPostItAnkor::SetLineInfo(const LineInfo &aLineInfo)
+void SwPostItAnkor::setLineSolid(bool bNew)
{
- if (aLineInfo != mLineInfo)
+ if(bNew != getLineSolid())
{
- mLineInfo = aLineInfo;
- if (mLineInfo.GetStyle()==LINE_DASH)
- {
- mLineInfo.SetDistance( 3 * 15);
- mLineInfo.SetDashLen( 5 * 15);
- mLineInfo.SetDashCount(100);
- }
- //remove and add overlayobject, so it is the last one inside the manager to draw
- //therefore this line is on top
- sdr::overlay::OverlayManager* pMgr = getOverlayManager();
- if (pMgr)
- {
- pMgr->remove(*this);
- pMgr->add(*this);
- }
+ mbLineSolid = bNew;
objectChange();
}
}
diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx
index 437f7eabb25c..50776ef80f11 100644
--- a/sw/source/ui/docvw/romenu.cxx
+++ b/sw/source/ui/docvw/romenu.cxx
@@ -34,12 +34,8 @@
#include <tools/urlobj.hxx>
-#ifndef _GRAPH_HXX //autogen
#include <vcl/graph.hxx>
-#endif
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <sot/formats.hxx>
#include <svtools/eitem.hxx>
#include <svtools/stritem.hxx>
@@ -61,30 +57,18 @@
#include <fmturl.hxx>
#include <fmtinfmt.hxx>
#include <docsh.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <wrtsh.hxx>
#include <viewopt.hxx>
#include <swmodule.hxx>
#include <romenu.hxx>
#include <pagedesc.hxx>
-#ifndef _MODCFG_HXX
#include <modcfg.hxx>
-#endif
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
-#ifndef _HELPID_H
#include <helpid.h>
-#endif
-#ifndef _DOCVW_HRC
#include <docvw.hrc>
-#endif
-#ifndef _DOCVW_HRC
#include <docvw.hrc>
-#endif
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
@@ -92,6 +76,7 @@
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::sfx2;
@@ -415,22 +400,13 @@ static void lcl_GetPreferedExtension( String &rExt, const Graphic &rGrf )
String SwReadOnlyPopup::SaveGraphic( USHORT nId )
{
-/* SvtPathOptions aPathOpt;
- String sGrfPath( aPathOpt.GetGraphicPath() );
-
- FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_SIMPLE, 0 );
- Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
-
-// aExpDlg.SetHelpId(HID_FILEDLG_ROMENU);
- INetURLObject aPath;
- aPath.SetSmartURL( sGrfPath);*/
//Namen der Grafik herausfischen.
String aName;
if ( MN_READONLY_SAVEBACKGROUND == nId )
{
if ( pItem->GetGraphicLink() )
- aName = *pItem->GetGraphicLink();
+ sGrfName = *pItem->GetGraphicLink();
((SvxBrushItem*)pItem)->SetDoneLink( Link() );
const Graphic *pGrf = pItem->GetGraphic( rView.GetDocShell() );
if ( pGrf )
@@ -442,12 +418,10 @@ String SwReadOnlyPopup::SaveGraphic( USHORT nId )
else
return aEmptyStr;
}
- else
- aName = sGrfName;
- return ExportGraphic( aGraphic, sGrfName, aName );
+ return ExportGraphic( aGraphic, sGrfName );
}
-String ExportGraphic( const Graphic &rGraphic, const String &rGrfName, const String &rName )
+String ExportGraphic( const Graphic &rGraphic, const String &rGrfName )
{
SvtPathOptions aPathOpt;
String sGrfPath( aPathOpt.GetGraphicPath() );
@@ -457,16 +431,16 @@ String ExportGraphic( const Graphic &rGraphic, const String &rGrfName, const Str
// aExpDlg.SetHelpId(HID_FILEDLG_ROMENU);
INetURLObject aPath;
- aPath.SetSmartURL( rName );
+ aPath.SetSmartURL( sGrfPath );
//Namen der Grafik herausfischen.
String aName = rGrfName;
+ aDlgHelper.SetTitle( SW_RESSTR(STR_EXPORT_GRAFIK_TITLE));
+ aDlgHelper.SetDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
INetURLObject aURL;
aURL.SetSmartURL( aName );
- aPath.Append( aURL.GetName() );
- xFP->setDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
- xFP->setTitle( SW_RESSTR(STR_EXPORT_GRAFIK_TITLE));
+ aDlgHelper.SetFileName( aURL.GetName() );
GraphicFilter& rGF = *GetGrfFilter();
const USHORT nCount = rGF.GetExportFormatCount();
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index 7b1170b35efe..fd9caec98c24 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -35,44 +35,27 @@
#endif
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
+#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
#include <svtools/urihelper.hxx>
#include <svtools/pathoptions.hxx>
#include <goodies/mailenum.hxx>
#include <svx/svxdlg.hxx>
#include <svx/dialogs.hrc>
-#ifndef _HELPID_H
#include <helpid.h>
-#endif
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
-#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED
#include <IDocumentDeviceAccess.hxx>
-#endif
#include <wrtsh.hxx>
-#ifndef _DBMGR_HXX
#include <dbmgr.hxx>
-#endif
#include <dbui.hxx>
#include <prtopt.hxx>
#include <swmodule.hxx>
-#ifndef _MODCFG_HXX
#include <modcfg.hxx>
-#endif
#include <mailmergehelper.hxx>
-#ifndef _ENVELP_HRC
#include <envelp.hrc>
-#endif
-#ifndef _MAILMRGE_HRC
#include <mailmrge.hrc>
-#endif
#include <mailmrge.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
@@ -83,9 +66,7 @@
#include <com/sun/star/sdbcx/XRowLocate.hpp>
#include <com/sun/star/sdb/XResultSetAccess.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
-#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/unohlp.hxx>
-#endif
#include <comphelper/processfactory.hxx>
#include <com/sun/star/form/XFormController.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -95,6 +76,8 @@
#include <unomid.h>
+#include <algorithm>
+
using namespace rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::container;
@@ -384,7 +367,11 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell,
aPrinterRB.SetClickHdl(aLk);
aMailingRB.SetClickHdl(aLk);
aFileRB.SetClickHdl(aLk);
- OutputTypeHdl(&aPrinterRB);
+
+ //#i63267# printing might be disabled
+ bool bIsPrintable = !Application::GetSettings().GetMiscSettings().GetDisablePrinting();
+ aPrinterRB.Enable(bIsPrintable);
+ OutputTypeHdl(bIsPrintable ? &aPrinterRB : &aFileRB);
aLk = LINK(this, SwMailMergeDlg, FilenameHdl);
aGenerateFromDataBaseCB.SetClickHdl( aLk );
@@ -402,6 +389,8 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell,
aLk = LINK(this, SwMailMergeDlg, ModifyHdl);
aFromNF.SetModifyHdl(aLk);
aToNF.SetModifyHdl(aLk);
+ aFromNF.SetMax(SAL_MAX_INT32);
+ aToNF.SetMax(SAL_MAX_INT32);
SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr();
if(_xConnection.is())
@@ -783,19 +772,16 @@ bool SwMailMergeDlg::ExecQryShell()
if (aFromRB.IsChecked()) // Liste Einfuegen
{
- ULONG nStart = static_cast< ULONG >(aFromNF.GetValue());
- ULONG nEnd = static_cast< ULONG >(aToNF.GetValue());
+ // Safe: the maximal value of the fields is limited
+ sal_Int32 nStart = sal::static_int_cast<sal_Int32>(aFromNF.GetValue());
+ sal_Int32 nEnd = sal::static_int_cast<sal_Int32>(aToNF.GetValue());
if (nEnd < nStart)
- {
- ULONG nZw = nEnd;
- nEnd = nStart;
- nStart = nZw;
- }
+ std::swap(nEnd, nStart);
m_aSelection.realloc(nEnd - nStart + 1);
Any* pSelection = m_aSelection.getArray();
- for (ULONG i = nStart; i <= nEnd; ++i, ++pSelection)
+ for (sal_Int32 i = nStart; i != nEnd; ++i, ++pSelection)
*pSelection <<= i;
}
else if (aAllRB.IsChecked() )
diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx
index 7f1b16c7abc1..2b72b1aec33a 100644
--- a/sw/source/ui/fldui/flddinf.hxx
+++ b/sw/source/ui/fldui/flddinf.hxx
@@ -45,7 +45,7 @@
/*--------------------------------------------------------------------
Beschreibung:
--------------------------------------------------------------------*/
-class SfxDocumentInfoItem;
+
class SwFldDokInfPage : public SwFldPage
{
FixedText aTypeFT;
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index df77741d5cd7..f35efbe41253 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -31,9 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
#include <hintids.hxx>
#include <svtools/stritem.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -63,21 +61,15 @@
#include <svtools/zforlist.hxx>
#include <svtools/zformat.hxx>
#include <vcl/mnemonic.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <wrtsh.hxx> // Actives Fenster
#include <doc.hxx> // Actives Fenster
-#ifndef _DOCSH_HXX
#include <docsh.hxx> // Actives Fenster
-#endif
#include <swmodule.hxx>
#include <charatr.hxx>
#include <fmtinfmt.hxx>
#include <cellatr.hxx>
-#ifndef _DBMGR_HXX
#include <dbmgr.hxx>
-#endif
#include <shellres.hxx>
#include <fldbas.hxx>
#include <docufld.hxx>
@@ -92,9 +84,8 @@
#include <fldmgr.hxx>
#include <crsskip.hxx>
#include <flddropdown.hxx>
-#ifndef _FLDUI_HRC
#include <fldui.hrc>
-#endif
+#include <tox.hxx>
using rtl::OUString;
using namespace com::sun::star::uno;
@@ -1552,6 +1543,27 @@ void SwFldMgr::UpdateCurFld(ULONG nFormat,
bSetPar1 = bSetPar2 = FALSE;
}
break;
+ case TYP_AUTHORITY :
+ {
+ //#i99069# changes to a bibliography field should change the field type
+ SwAuthorityField* pAuthorityField = static_cast<SwAuthorityField*>(pTmpFld);
+ SwAuthorityFieldType* pAuthorityType = static_cast<SwAuthorityFieldType*>(pType);
+ SwAuthEntry aTempEntry;
+ for( USHORT i = 0; i < AUTH_FIELD_END; ++i )
+ aTempEntry.SetAuthorField( (ToxAuthorityField)i,
+ rPar1.GetToken( i, TOX_STYLE_DELIMITER ));
+ if( pAuthorityType->ChangeEntryContent( &aTempEntry ) )
+ {
+ pType->UpdateFlds();
+ pSh->SetModified();
+ }
+
+ if( aTempEntry.GetAuthorField( AUTH_FIELD_IDENTIFIER ) ==
+ pAuthorityField->GetFieldText( AUTH_FIELD_IDENTIFIER ) )
+ bSetPar1 = FALSE; //otherwise it's a new or changed entry, the field needs to be updated
+ bSetPar2 = FALSE;
+ }
+ break;
}
// Format setzen
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 24c025fb55d8..b288d51cf520 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -265,7 +265,7 @@ void SwFldRefPage::Reset(const SfxItemSet& )
}
// Endnoten:
- if( pSh->HasFtns(TRUE) )
+ if ( pSh->HasFtns(true) )
{
nPos = aTypeLB.InsertEntry(sEndnoteTxt);
aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_ENDNOTE);
@@ -576,7 +576,7 @@ void SwFldRefPage::UpdateSubType()
{
aSelectionLB.SetStyle(aSelectionLB.GetStyle() & ~WB_SORT);
SwSeqFldList aArr;
- USHORT nCnt = pSh->GetSeqFtnList( aArr, TRUE );
+ USHORT nCnt = pSh->GetSeqFtnList( aArr, true );
for( USHORT n = 0; n < nCnt; ++n )
{
@@ -936,7 +936,7 @@ BOOL SwFldRefPage::FillItemSet(SfxItemSet& )
nSubType = REF_ENDNOTE;
aName.Erase();
- if (pSh->GetSeqFtnList(aArr, TRUE) && aArr.SeekEntry(aElem, &nPos))
+ if (pSh->GetSeqFtnList(aArr, true) && aArr.SeekEntry(aElem, &nPos))
{
aVal = String::CreateFromInt32( aArr[nPos]->nSeqNo );
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 03dd5fa36fdd..a9df9762ad92 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -230,6 +230,8 @@ SwColumnDlg::SwColumnDlg(Window* pParent, SwWrtShell& rSh) :
//#i80458# if no columns can be set then disable OK
if( !aApplyToLB.GetEntryCount() )
aOK.Enable( sal_False );
+ //#i97810# set focus to the TabPage
+ pTabPage->ActivateColumnControl();
}
/*--------------------------------------------------------------------
diff --git a/sw/source/ui/inc/column.hxx b/sw/source/ui/inc/column.hxx
index 491a603d52ab..a8e6597cf757 100644
--- a/sw/source/ui/inc/column.hxx
+++ b/sw/source/ui/inc/column.hxx
@@ -223,6 +223,7 @@ public:
void ShowBalance(BOOL bShow) {aBalanceColsCB.Show(bShow);}
void SetInSection(BOOL bSet);
+ void ActivateColumnControl() {aCLNrEdt.GrabFocus();}
};
#endif
diff --git a/sw/source/ui/inc/convert.hxx b/sw/source/ui/inc/convert.hxx
index bce24ac08018..6e550b4c9607 100644
--- a/sw/source/ui/inc/convert.hxx
+++ b/sw/source/ui/inc/convert.hxx
@@ -63,14 +63,14 @@ class SwConvertTableDlg: public SfxModalDialog
FixedText aRepeatHeaderAfterFT;
TextControlCombo aRepeatHeaderCombo;
+ FixedLine aOptionsFL;
CheckBox aDontSplitCB;
CheckBox aBorderCB;
- FixedLine aOptionsFL;
+ PushButton aAutoFmtBtn;
OKButton aOkBtn;
CancelButton aCancelBtn;
HelpButton aHelpBtn;
- PushButton aAutoFmtBtn;
String sConvertTextTable;
SwTableAutoFmt* pTAutoFmt;
diff --git a/sw/source/ui/inc/fldmgr.hxx b/sw/source/ui/inc/fldmgr.hxx
index e174ef56ffcf..6919e636fc58 100644
--- a/sw/source/ui/inc/fldmgr.hxx
+++ b/sw/source/ui/inc/fldmgr.hxx
@@ -229,7 +229,7 @@ inline const String& SwFldMgr::GetCurFldPar1() const
inline const String& SwFldMgr::GetCurFldPar2() const
{ return aCurPar2; }
-inline ULONG SwFldMgr::GetCurFldFmt() const
+inline ULONG SwFldMgr::GetCurFldFmt() const
{ return nCurFmt; }
diff --git a/sw/source/ui/inc/hidfunc.h b/sw/source/ui/inc/hidfunc.h
index a85d5181031a..b2b961a882d4 100644
--- a/sw/source/ui/inc/hidfunc.h
+++ b/sw/source/ui/inc/hidfunc.h
@@ -209,6 +209,7 @@
#define HID_SET_STANDARD_FONTS 1442
#define HID_COPY 1102
#define HID_PASTE 1113
+#define HID_PASTEUNFORMATTED 1115
#define HID_PASTESPECIAL 1114
#define HID_CUT 1103
#define HID_FLIP_HORZ_GRAFIC 1425
diff --git a/sw/source/ui/inc/insrc.hxx b/sw/source/ui/inc/insrc.hxx
deleted file mode 100644
index 85655f151bc5..000000000000
--- a/sw/source/ui/inc/insrc.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: insrc.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _INSRC_HXX
-#define _INSRC_HXX
-
-#include <svx/stddlg.hxx>
-
-#ifndef _FIXED_HXX //autogen
-#include <vcl/fixed.hxx>
-#endif
-
-#ifndef _FIELD_HXX //autogen
-#include <vcl/field.hxx>
-#endif
-
-#ifndef _BUTTON_HXX //autogen
-#include <vcl/button.hxx>
-#endif
-
-#ifndef _GROUP_HXX //autogen
-#include <vcl/group.hxx>
-#endif
-#include <tools/string.hxx>
-
-#ifndef _BUTTON_HXX //autogen
-#include <vcl/button.hxx>
-#endif
-
-class SwView;
-class SwInsRowColDlg : public SvxStandardDialog
-{
- FixedText aCount;
- NumericField aCountEdit;
- FixedLine aInsFL;
-
- RadioButton aBeforeBtn;
- RadioButton aAfterBtn;
- FixedLine aPosFL;
-
- String aRow;
- String aCol;
-
- OKButton aOKBtn;
- CancelButton aCancelBtn;
- HelpButton aHelpBtn;
-
- SwView& rView;
- BOOL bColumn;
-
-protected:
- virtual void Apply();
-
-public:
- SwInsRowColDlg( SwView& rView, BOOL bCol );
-};
-
-#endif
-
diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx
index 5cd5a2a319e1..d2a5a2ed4d2b 100644
--- a/sw/source/ui/inc/swdtflvr.hxx
+++ b/sw/source/ui/inc/swdtflvr.hxx
@@ -193,6 +193,7 @@ public:
static BOOL IsPasteSpecial( const SwWrtShell& rWrtShell,
const TransferableDataHelper& );
+ static int PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& );
static int PasteSpecial( SwWrtShell& rSh, TransferableDataHelper&, ULONG& rFormatUsed );
static int PasteFormat( SwWrtShell& rSh, TransferableDataHelper& rData,
ULONG nFormat );
diff --git a/sw/source/ui/inc/table.hrc b/sw/source/ui/inc/table.hrc
index 77ac72c12c33..0903a95453ad 100644
--- a/sw/source/ui/inc/table.hrc
+++ b/sw/source/ui/inc/table.hrc
@@ -33,7 +33,7 @@
#define DLG_INSERT_TABLE RC_TABLE_BEGIN
#define DLG_FORMAT_TABLE (RC_TABLE_BEGIN + 1)
#define DLG_CONV_TEXT_TABLE (RC_TABLE_BEGIN + 2)
-#define DLG_INS_ROW_COL (RC_TABLE_BEGIN + 3)
+//#define DLG_INS_ROW_COL (RC_TABLE_BEGIN + 3) moved to svx
#define DLG_ROW_HEIGHT (RC_TABLE_BEGIN + 4)
#define DLG_SPLIT (RC_TABLE_BEGIN + 5)
#define DLG_COL_WIDTH (RC_TABLE_BEGIN + 6)
diff --git a/sw/source/ui/inc/uivwimp.hxx b/sw/source/ui/inc/uivwimp.hxx
index 65b8d0b9b95b..d23da67e4209 100644
--- a/sw/source/ui/inc/uivwimp.hxx
+++ b/sw/source/ui/inc/uivwimp.hxx
@@ -153,7 +153,7 @@ public:
SfxObjectShellRef & GetTmpSelectionDoc() { return xTmpSelDocSh; }
- SfxObjectShellRef& GetEmbeddedObjRef() { return (SfxObjectShellRef&)(long&)aEmbeddedObjRef; }
+ SfxObjectShellRef& GetEmbeddedObjRef() { return *boost::addressof(aEmbeddedObjRef); }
void AddTransferable(SwTransferable& rTransferable);
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 70e509972ddb..5656f6df1ab4 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -157,6 +157,7 @@ public:
void SetInsMode( BOOL bOn = TRUE );
void ToggleInsMode() { SetInsMode( !bIns ); }
BOOL IsInsMode() const { return bIns; }
+ void SetRedlineModeAndCheckInsMode( USHORT eMode );
void EnterSelFrmMode(const Point *pStartDrag = 0);
void LeaveSelFrmMode();
diff --git a/sw/source/ui/index/cnttab.src b/sw/source/ui/index/cnttab.src
index 1bccc6c27765..8b84ca3d2b92 100644
--- a/sw/source/ui/index/cnttab.src
+++ b/sw/source/ui/index/cnttab.src
@@ -342,12 +342,12 @@ TabPage TP_TOX_SELECT
CheckBox CB_FROMFILE
{
Pos = MAP_APPFONT ( 136 , 124 ) ;
- Size = MAP_APPFONT ( 63 , 10 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
Text [ en-US ] = "~Concordance file";
};
MenuButton MB_AUTOMARK
{
- Pos = MAP_APPFONT ( 201 , 122 ) ;
+ Pos = MAP_APPFONT ( 136 , 137 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
ButtonMenu = Menu
@@ -486,32 +486,32 @@ TabPage TP_TOX_SELECT
};
FixedLine FL_SORTOPTIONS
{
- Pos = MAP_APPFONT ( 6, 150) ;
+ Pos = MAP_APPFONT ( 6, 153) ;
Size = MAP_APPFONT ( 248, 8 ) ;
Text [ en-US ] = "Sort";
};
FixedText FT_LANGUAGE
{
- Pos = MAP_APPFONT ( 12, 163) ;
+ Pos = MAP_APPFONT ( 12, 166) ;
Size = MAP_APPFONT ( 33, 8 ) ;
Text [ en-US ] = "Language";
};
ListBox LB_LANGUAGE
{
- Pos = MAP_APPFONT ( 47, 161) ;
+ Pos = MAP_APPFONT ( 47, 164) ;
Size = MAP_APPFONT ( 80, 50 ) ;
Border = TRUE;
DropDown = TRUE;
};
FixedText FT_SORTALG
{
- Pos = MAP_APPFONT ( 130, 163) ;
+ Pos = MAP_APPFONT ( 130, 166) ;
Size = MAP_APPFONT ( 50, 8 ) ;
Text [ en-US ] = "Key type";
};
ListBox LB_SORTALG
{
- Pos = MAP_APPFONT ( 201, 161) ;
+ Pos = MAP_APPFONT ( 201, 164) ;
Size = MAP_APPFONT ( 50, 50 ) ;
Border = TRUE;
DropDown = TRUE;
@@ -1049,7 +1049,7 @@ TabPage TP_TOX_STYLES
FixedText FT_LEVEL
{
Pos = MAP_APPFONT ( 11 , 14 ) ;
- Size = MAP_APPFONT ( 24 , 8 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
Text [ en-US ] = "~Levels" ;
Left = TRUE ;
};
@@ -1064,7 +1064,7 @@ TabPage TP_TOX_STYLES
FixedText FT_TEMPLATE
{
Pos = MAP_APPFONT ( 142 , 14 ) ;
- Size = MAP_APPFONT ( 54 , 8 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
Text [ en-US ] = "Paragraph ~Styles" ;
Left = TRUE ;
};
diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx
index 4ad5311307c9..a79e67eec31c 100644
--- a/sw/source/ui/misc/glshell.cxx
+++ b/sw/source/ui/misc/glshell.cxx
@@ -49,12 +49,8 @@
#include <sfx2/viewfrm.hxx>
#include <uitool.hxx>
#include <wrtsh.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
-#ifndef _GLSHELL_HXX
#include <glshell.hxx>
-#endif
#include <doc.hxx>
#include <glosdoc.hxx>
#include <shellio.hxx>
@@ -72,12 +68,8 @@
#define SwWebGlosDocShell
#define SwGlosDocShell
-#ifndef _ITEMDEF_HXX
-#include <itemdef.hxx>
-#endif
-#ifndef _SWSLOTS_HXX
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
-#endif
using namespace ::com::sun::star;
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 1f2f9e152c65..3fb0157b89f3 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -245,6 +245,7 @@ void SwTextGridPage::Reset(const SfxItemSet &rSet)
default: pButton = &aCharsGridRB;
}
pButton->Check();
+ aDisplayCB.Check(rGridItem.IsDisplayGrid());
GridTypeHdl(pButton);
aSnapToCharsCB.Check(rGridItem.IsSnapToChars());
aLinesPerPageNF.SetValue(rGridItem.GetLines());
@@ -254,7 +255,6 @@ void SwTextGridPage::Reset(const SfxItemSet &rSet)
aRubySizeMF.SetValue(aRubySizeMF.Normalize(rGridItem.GetRubyHeight()), FUNIT_TWIP);
aCharWidthMF.SetValue(aCharWidthMF.Normalize(rGridItem.GetBaseWidth()), FUNIT_TWIP);
aRubyBelowCB.Check(rGridItem.IsRubyTextBelow());
- aDisplayCB.Check(rGridItem.IsDisplayGrid());
aPrintCB.Check(rGridItem.IsPrintGrid());
aColorLB.SelectEntry(rGridItem.GetColor());
}
diff --git a/sw/source/ui/ribbar/conrect.cxx b/sw/source/ui/ribbar/conrect.cxx
index b079f70ff9a1..e5540dab1c11 100644
--- a/sw/source/ui/ribbar/conrect.cxx
+++ b/sw/source/ui/ribbar/conrect.cxx
@@ -163,15 +163,17 @@ BOOL ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
break;
case OBJ_CAPTION:
- if( bCapVertical && pObj )
+ {
+ SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj);
+ if( bCapVertical && pCaptObj )
{
- SdrCaptionObj* pCaptObj = (SdrCaptionObj*)pObj;
pCaptObj->ForceOutlinerParaObject();
OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject();
if( pOPO && !pOPO->IsVertical() )
pOPO->SetVertical( TRUE );
}
- break;
+ }
+ break;
default:; //prevent warning
}
}
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
index b4a4491c220d..054220be6707 100755
--- a/sw/source/ui/shells/annotsh.cxx
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -138,7 +138,7 @@ using namespace ::com::sun::star::i18n;
#define SwAnnotationShell
-#include <itemdef.hxx>
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
SFX_IMPL_INTERFACE(SwAnnotationShell, SfxShell, SW_RES(STR_SHELLNAME_DRAW_TEXT))
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 66276be3e4ff..0c17c85dd301 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -41,33 +41,22 @@
#include <svx/linkmgr.hxx>
#include <svx/htmlmode.hxx>
#include <svx/imapdlg.hxx>
-#ifndef _SFX_DISPATCH_HXX //autogen
#include <sfx2/dispatch.hxx>
-#endif
#include <sfx2/docfile.hxx>
-#ifndef _SFX_VIEWFRM_HXX //autogen
#include <sfx2/viewfrm.hxx>
-#endif
#include <sfx2/request.hxx>
#include <svtools/whiter.hxx>
#include <svtools/visitem.hxx>
#include <sfx2/objitem.hxx>
-#ifndef _SFX_DISPATCH_HXX //autogen
-#include <sfx2/dispatch.hxx>
-#endif
#include <svtools/filter.hxx>
#include <svx/gallery.hxx>
#include <svx/langitem.hxx>
#include <svx/clipfmtitem.hxx>
#include <svx/contdlg.hxx>
-#ifndef _GRAPH_HXX //autogen
#include <vcl/graph.hxx>
-#endif
#include <svx/impgrf.hxx>
#include <svtools/slstitm.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <svtools/ptitem.hxx>
#include <svtools/itemiter.hxx>
#include <svtools/stritem.hxx>
@@ -86,20 +75,14 @@
#include <fmturl.hxx>
#include <fmthdft.hxx>
#include <fmtclds.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <wrtsh.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <swmodule.hxx>
#include <swundo.hxx>
#include <fldbas.hxx>
#include <uitool.hxx>
-#ifndef _BASESH_HXX
#include <basesh.hxx>
-#endif
#include <viewopt.hxx>
#include <fontcfg.hxx>
#include <docstat.hxx>
@@ -171,7 +154,7 @@ static BYTE nFooterPos;
#define SwBaseShell
#define Shadow
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
#define SWCONTOURDLG(rView) ( (SvxContourDlg*) ( rView.GetViewFrame()->GetChildWindow( \
@@ -387,6 +370,41 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
}
break;
+ case SID_PASTE_UNFORMATTED:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &rSh.GetView().GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is() &&
+ SwTransferable::IsPaste( rSh, aDataHelper ))
+ {
+ // temp. Variablen, da die Shell nach dem Paste schon
+ // zerstoert sein kann
+ SwView* pView = &rView;
+ rReq.Ignore();
+ bIgnore = sal_True;
+ int nRet = SwTransferable::PasteUnformatted( rSh, aDataHelper );
+ if(nRet)// && rReq.IsRecording() )
+ {
+ SfxViewFrame* pViewFrame = pView->GetViewFrame();
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ pViewFrame->GetBindings().GetRecorder();
+ if(xRecorder.is()) {
+ SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
+ aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, SOT_FORMAT_STRING ) );
+ aReq.Done();
+ }
+ }
+
+ if (rSh.IsFrmSelected() || rSh.IsObjSelected())
+ rSh.EnterSelFrmMode();
+ pView->AttrChangedNotify( &rSh );
+ }
+ else
+ return;
+ }
+ break;
+
case FN_PASTESPECIAL:
{
TransferableDataHelper aDataHelper(
@@ -465,7 +483,10 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
case FN_PASTESPECIAL:
if( !GetView().IsPasteSpecialAllowed() )
+ {
rSet.DisableItem( FN_PASTESPECIAL );
+ rSet.DisableItem( SID_PASTE_UNFORMATTED );
+ }
break;
case SID_CLIPBOARD_FORMAT_ITEMS:
@@ -1730,9 +1751,12 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
rSh.GetGraphic(FALSE); // start the loading
}
else if( rSh.IsFrmSelected() )
- bDisable = GRAPHIC_NONE ==
- rSh.GetIMapGraphic().GetType()||
- nSel & nsSelectionType::SEL_FRM;
+ {
+ // #i102253# applied patch from OD (see task)
+ bDisable =
+ nSel & nsSelectionType::SEL_FRM ||
+ GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
+ }
}
bSet = bDisable ? FALSE : rWrap.IsContour();
@@ -2082,14 +2106,22 @@ void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq )
if( pArgs )
{
- SwTxtFmtColl* pColl;
- if( (!(RES_CHRATR_BEGIN <= nWhich && nWhich < RES_CHRATR_END ) ||
- ( rSh.HasSelection() && rSh.IsSelFullPara() ) ) &&
- 0 != (pColl = rSh.GetCurTxtFmtColl()) &&
- pColl->IsAutoUpdateFmt() )
- rSh.AutoUpdatePara( pColl, *pArgs );
- else
+ bool bAuto = false;
+ if ( !isCHRATR(nWhich) ||
+ ( rSh.HasSelection() && rSh.IsSelFullPara() ) )
+ {
+ SwTxtFmtColl * pColl = rSh.GetCurTxtFmtColl();
+ if ( pColl && pColl->IsAutoUpdateFmt() )
+ {
+ rSh.AutoUpdatePara( pColl, *pArgs );
+ bAuto = true;
+ }
+ }
+
+ if (!bAuto)
+ {
rSh.SetAttr( *pArgs );
+ }
}
delete pSSetItem;
}
diff --git a/sw/source/ui/shells/beziersh.cxx b/sw/source/ui/shells/beziersh.cxx
index b6bc159e7ecd..cc3493fe5120 100644
--- a/sw/source/ui/shells/beziersh.cxx
+++ b/sw/source/ui/shells/beziersh.cxx
@@ -52,7 +52,7 @@
#include "popup.hrc"
#include "shells.hrc"
#define SwBezierShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
#include <unomid.h>
diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx
index ed7d60e84e6f..4da015e2d586 100644
--- a/sw/source/ui/shells/drawsh.cxx
+++ b/sw/source/ui/shells/drawsh.cxx
@@ -69,7 +69,7 @@
#include "drawsh.hxx"
#define SwDrawShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
#include "swabstdlg.hxx" //CHINA001
#include "misc.hrc"
diff --git a/sw/source/ui/shells/drformsh.cxx b/sw/source/ui/shells/drformsh.cxx
index 254d01ccb960..97cac7006b98 100644
--- a/sw/source/ui/shells/drformsh.cxx
+++ b/sw/source/ui/shells/drformsh.cxx
@@ -60,14 +60,12 @@
#include "drwbassh.hxx"
#include "drformsh.hxx"
#include <svtools/urihelper.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <sfx2/docfile.hxx>
#include <docsh.hxx>
#define SwDrawFormShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
#include <unomid.h>
diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx
index 725d5239e6fe..339c332c9135 100644
--- a/sw/source/ui/shells/drwbassh.cxx
+++ b/sw/source/ui/shells/drwbassh.cxx
@@ -41,9 +41,7 @@
#include <sfx2/bindings.hxx>
#include <svtools/aeitem.hxx>
#include <svx/svdview.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <svx/srchitem.hxx>
#include <svtools/whiter.hxx>
#include <svx/swframevalidation.hxx>
@@ -56,20 +54,14 @@
#endif
#include <swmodule.hxx>
#include <wrtsh.hxx>
-#ifndef _WVIEW_HXX
#include <wview.hxx>
-#endif
#include <edtwin.hxx>
#include <viewopt.hxx>
#include <dcontact.hxx>
#include <frmfmt.hxx>
#include <wrap.hxx>
-#ifndef _DRAWBASE_HXX
#include <drawbase.hxx>
-#endif
-#ifndef _DRWBASSH_HXX
#include <drwbassh.hxx>
-#endif
#include <swdtflvr.hxx>
#include <svx/svdogrp.hxx>
#include <svx/svdpage.hxx>
@@ -77,12 +69,8 @@
#include <shells.hrc>
#define SwDrawBaseShell
-#ifndef _ITEMDEF_HXX
-#include <itemdef.hxx>
-#endif
-#ifndef _SWSLOTS_HXX
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
-#endif
#include <svx/svxdlg.hxx>
#include <svx/dialogs.hrc>
#include "swabstdlg.hxx"
diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx
index a0f38300fba2..99a2bf71bca7 100644
--- a/sw/source/ui/shells/drwtxtsh.cxx
+++ b/sw/source/ui/shells/drwtxtsh.cxx
@@ -59,15 +59,11 @@
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <swtypes.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <wrtsh.hxx>
#include <viewopt.hxx>
#include <initui.hxx> // fuer SpellPointer
-#ifndef _DRWTXTSH_HXX
#include <drwtxtsh.hxx>
-#endif
#include <swundo.hxx>
#include <breakit.hxx>
@@ -85,19 +81,13 @@
#endif
#define SwDrawTextShell
-#ifndef _ITEMDEF_HXX
-#include <itemdef.hxx>
-#endif
-#ifndef _SWSLOTS_HXX
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
-#endif
#ifndef _POPUP_HRC
#include <popup.hrc>
#endif
#include <uitool.hxx>
-#ifndef _WVIEW_HXX
#include <wview.hxx>
-#endif
#include <swmodule.hxx>
#include <svx/xtable.hxx>
diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx
index 4df31175e1aa..f7957a66077a 100644
--- a/sw/source/ui/shells/frmsh.cxx
+++ b/sw/source/ui/shells/frmsh.cxx
@@ -50,6 +50,10 @@
#include <sfx2/request.hxx>
#include <sfx2/objface.hxx>
#include <svx/hlnkitem.hxx>
+// --> OD 2009-07-07 #i73249#
+#include <svx/svdview.hxx>
+#include <vcl/msgbox.hxx>
+// <--
#include <fmturl.hxx>
@@ -57,9 +61,7 @@
#include <fmtcnct.hxx>
#include <swmodule.hxx>
#include <wrtsh.hxx>
-#ifndef _WVIEW_HXX
#include <wview.hxx>
-#endif
#include <frmatr.hxx>
#include <uitool.hxx>
#include <frmfmt.hxx>
@@ -84,6 +86,9 @@
#include <shells.hrc>
#include "swabstdlg.hxx"
#include "misc.hrc"
+// --> OD 2009-07-14 #i73249#
+#include <svx/dialogs.hrc>
+// <--
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -104,7 +109,7 @@ const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const String& rName)
}
#define SwFrameShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
SFX_IMPL_INTERFACE(SwFrameShell, SwBaseShell, SW_RES(STR_SHELLNAME_FRAME))
@@ -416,8 +421,13 @@ void SwFrameShell::Execute(SfxRequest &rReq)
}
aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
- if(nSel & nsSelectionType::SEL_OLE)
- aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
+ if( nSel & nsSelectionType::SEL_OLE )
+ {
+ // --> OD 2009-07-13 #i73249#
+// aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
+ aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
+ // <--
+ }
const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE);
SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
@@ -474,7 +484,10 @@ void SwFrameShell::Execute(SfxRequest &rReq)
}
if (SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_ALT_NAME, TRUE, &pItem))
{
- rSh.SetAlternateText(((const SfxStringItem*)pItem)->GetValue());
+ // --> OD 2009-07-13 #i73249#
+// rSh.SetAlternateText(((const SfxStringItem*)pItem)->GetValue());
+ rSh.SetObjTitle(((const SfxStringItem*)pItem)->GetValue());
+ // <--
}
// Vorlagen-AutoUpdate
SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
@@ -589,6 +602,40 @@ void SwFrameShell::Execute(SfxRequest &rReq)
rReq.SetReturnValue(SfxBoolItem(nSlot, bMirror));
}
break;
+ // --> OD 2009-07-14 #i73249#
+ case FN_TITLE_DESCRIPTION_SHAPE:
+ {
+ bUpdateMgr = FALSE;
+ SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
+ if ( pSdrView &&
+ pSdrView->GetMarkedObjectCount() == 1 )
+ {
+ String aDescription(rSh.GetObjDescription());
+ String aTitle(rSh.GetObjTitle());
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ OSL_ENSURE(pFact, "Dialogdiet fail!");
+ AbstractSvxObjectTitleDescDialog* pDlg =
+ pFact->CreateSvxObjectTitleDescDialog( NULL,
+ aTitle,
+ aDescription,
+ RID_SVXDLG_OBJECT_TITLE_DESC );
+ OSL_ENSURE(pDlg, "Dialogdiet fail!");
+
+ if ( pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetDescription(aDescription);
+ pDlg->GetTitle(aTitle);
+
+ rSh.SetObjDescription(aDescription);
+ rSh.SetObjTitle(aTitle);
+ }
+
+ delete pDlg;
+ }
+ }
+ break;
+ // <--
default:
ASSERT( !this, "falscher Dispatcher" );
return;
@@ -824,6 +871,20 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
rSet.DisableItem( nWhich );
}
break;
+ // --> OD 2009-07-07 #i73249#
+ case FN_TITLE_DESCRIPTION_SHAPE:
+ {
+ SwWrtShell &rWrtSh = GetShell();
+ SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
+ if ( !pSdrView ||
+ pSdrView->GetMarkedObjectCount() != 1 )
+ {
+ rSet.DisableItem( nWhich );
+ }
+
+ }
+ break;
+ // <--
default:
/* do nothing */;
break;
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 026e22a228c4..7203d9c91ebb 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -39,9 +39,7 @@
#endif
#include <hintids.hxx>
#include <tools/urlobj.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <svtools/stritem.hxx>
#include <svtools/whiter.hxx>
#include <svtools/urihelper.hxx>
@@ -64,21 +62,15 @@
#include <svx/grfflt.hxx>
#include <svx/tbxcolor.hxx>
#include <fmturl.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <wrtsh.hxx>
#include <viewopt.hxx>
#include <swmodule.hxx>
#include <frmatr.hxx>
#include <swundo.hxx>
#include <uitool.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
-#ifndef _GRFSH_HXX
#include <grfsh.hxx>
-#endif
#include <frmmgr.hxx>
#include <frmdlg.hxx>
#include <frmfmt.hxx>
@@ -90,7 +82,7 @@
#include <popup.hrc>
#define SwGrfShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
#include "swabstdlg.hxx"
@@ -122,7 +114,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
{
String sGrfNm, sFilterNm;
rSh.GetGrfNms( &sGrfNm, &sFilterNm );
- ExportGraphic( *pGraphic, sGrfNm, sGrfNm );
+ ExportGraphic( *pGraphic, sGrfNm );
}
}
break;
@@ -162,8 +154,13 @@ void SwGrfShell::Execute(SfxRequest &rReq)
aSet.Put( aFrmSize );
aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
- if(nSlot == FN_FORMAT_GRAFIC_DLG)
- aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
+ if ( nSlot == FN_FORMAT_GRAFIC_DLG )
+ {
+ // --> OD 2009-07-13 #i73249#
+// aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
+ aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
+ // <--
+ }
pRect = &rSh.GetAnyCurRect(RECT_PAGE_PRT);
aFrmSize.SetWidth( pRect->Width() );
@@ -332,10 +329,15 @@ void SwGrfShell::Execute(SfxRequest &rReq)
sFilterNm, 0 );
}
}
- if( SFX_ITEM_SET == pSet->GetItemState(
+ if ( SFX_ITEM_SET == pSet->GetItemState(
FN_SET_FRM_ALT_NAME, TRUE, &pItem ))
- rSh.SetAlternateText(
- ((const SfxStringItem*)pItem)->GetValue() );
+ {
+ // --> OD 2009-07-13 #i73249#
+// rSh.SetAlternateText(
+// ((const SfxStringItem*)pItem)->GetValue() );
+ rSh.SetObjTitle( ((const SfxStringItem*)pItem)->GetValue() );
+ // <--
+ }
SfxItemSet aGrfSet( rSh.GetAttrPool(), RES_GRFATR_BEGIN,
RES_GRFATR_END-1 );
diff --git a/sw/source/ui/shells/listsh.cxx b/sw/source/ui/shells/listsh.cxx
index c1c8435bd12f..34f349befbc9 100644
--- a/sw/source/ui/shells/listsh.cxx
+++ b/sw/source/ui/shells/listsh.cxx
@@ -65,7 +65,7 @@
#include "edtwin.hxx"
#define SwListShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
#include <IDocumentOutlineNodes.hxx>
diff --git a/sw/source/ui/shells/mediash.cxx b/sw/source/ui/shells/mediash.cxx
index 933d7254bb8a..ae1ed883cb8b 100644
--- a/sw/source/ui/shells/mediash.cxx
+++ b/sw/source/ui/shells/mediash.cxx
@@ -39,9 +39,7 @@
#endif
#include <hintids.hxx>
#include <tools/urlobj.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <svtools/stritem.hxx>
#include <svtools/whiter.hxx>
#include <svtools/urihelper.hxx>
@@ -60,21 +58,15 @@
#include <svx/brshitem.hxx>
#include <svx/grfflt.hxx>
#include <fmturl.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <wrtsh.hxx>
#include <viewopt.hxx>
#include <swmodule.hxx>
#include <frmatr.hxx>
#include <swundo.hxx>
#include <uitool.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
-#ifndef _MEDIASH_HXX
#include <mediash.hxx>
-#endif
#include <frmmgr.hxx>
#include <frmdlg.hxx>
#include <frmfmt.hxx>
@@ -95,7 +87,7 @@
#include <avmedia/mediaitem.hxx>
#define SwMediaShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
#include "swabstdlg.hxx"
diff --git a/sw/source/ui/shells/olesh.cxx b/sw/source/ui/shells/olesh.cxx
index 6d6f1985e56b..2bf523d27e3b 100644
--- a/sw/source/ui/shells/olesh.cxx
+++ b/sw/source/ui/shells/olesh.cxx
@@ -37,9 +37,7 @@
#include <sfx2/objface.hxx>
#include <sfx2/objitem.hxx>
#include <wrtsh.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#ifndef _HELPID_H
#include <helpid.h>
#endif
@@ -63,12 +61,8 @@
#define SwOleShell
-#ifndef _ITEMDEF_HXX
-#include <itemdef.hxx>
-#endif
-#ifndef _SWSLOTS_HXX
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
-#endif
SFX_IMPL_INTERFACE(SwOleShell, SwFrameShell, SW_RES(STR_SHELLNAME_OBJECT))
diff --git a/sw/source/ui/shells/slotadd.cxx b/sw/source/ui/shells/slotadd.cxx
index 804b6127de4f..333128a18db9 100644
--- a/sw/source/ui/shells/slotadd.cxx
+++ b/sw/source/ui/shells/slotadd.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: slotadd.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.30.124.1 $
*
* This file is part of OpenOffice.org.
*
@@ -147,7 +147,7 @@
#define avmedia_MediaItem ::avmedia::MediaItem
#define SFX_TYPEMAP
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx
index 3c1d84666c7a..7ba4d0b8e954 100644
--- a/sw/source/ui/shells/tabsh.cxx
+++ b/sw/source/ui/shells/tabsh.cxx
@@ -57,9 +57,7 @@
#include <svx/svxdlg.hxx>
#include <svtools/zformat.hxx>
#include <sfx2/bindings.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <sfx2/request.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/objface.hxx>
@@ -72,28 +70,20 @@
#include <fmtfsize.hxx>
#include <swmodule.hxx>
#include <wrtsh.hxx>
-#ifndef _WVIEW_HXX
#include <wview.hxx>
-#endif
#include <frmatr.hxx>
#include <uitool.hxx>
-#ifndef _INPUTWIN_HXX
#include <inputwin.hxx>
-#endif
#include <uiitems.hxx>
#include <usrpref.hxx>
-#ifndef _TABSH_HXX
#include <tabsh.hxx>
-#endif
#include "swtablerep.hxx"
#include <tablemgr.hxx>
#include <cellatr.hxx>
#include <frmfmt.hxx>
#include <swundo.hxx>
#include <swtable.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <tblsel.hxx>
#include <dialog.hrc>
@@ -130,12 +120,8 @@
#include <unoobj.hxx>
#define SwTableShell
-#ifndef _ITEMDEF_HXX
-#include <itemdef.hxx>
-#endif
-#ifndef _SWSLOTS_HXX
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
-#endif
#include "swabstdlg.hxx"
#include <table.hrc>
@@ -984,13 +970,18 @@ void SwTableShell::Execute(SfxRequest &rReq)
{
if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline())
{
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "Dialogdiet fail!");
- VclAbstractDialog* pDlg = pFact->CreateVclSwViewDialog( DLG_INS_ROW_COL,
- GetView(), FN_TABLE_INSERT_COL_DLG == nSlot );
- DBG_ASSERT(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( GetView().GetWindow(), nSlot == FN_TABLE_INSERT_COL_DLG, nSlot) : 0);
+
+ if( pDlg.get() && (pDlg->Execute() == 1) )
+ {
+ USHORT nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG) ? FN_TABLE_INSERT_COL : FN_TABLE_INSERT_ROW;
+ SfxUInt16Item aCountItem( nDispatchSlot, static_cast< UINT16 >(pDlg->getInsertCount()) );
+ SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() );
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if( pVFrame )
+ pVFrame->GetDispatcher()->Execute( nDispatchSlot, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aCountItem, &aAfter, 0L);
+ }
}
}
break;
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index f0874a954b97..742e93b646c2 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -46,18 +46,14 @@
#include <svtools/ptitem.hxx>
#include <svtools/stritem.hxx>
#include <svtools/moduleoptions.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <sfx2/fcontnr.hxx>
#include <svx/hlnkitem.hxx>
#include <svx/srchitem.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/docfile.hxx>
#include <svtools/urihelper.hxx>
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
#include <svtools/whiter.hxx>
#include <sfx2/request.hxx>
#include <svx/opaqitem.hxx>
@@ -71,9 +67,7 @@
#include <svx/htmlmode.hxx>
#include <svx/pfiledlg.hxx>
#include <svx/htmlcfg.hxx>
-#ifndef _COM_SUN_STAR_I18N_TRANSLITERATIONMODULES_HDL_
#include <com/sun/star/i18n/TransliterationModules.hdl>
-#endif
#include <sot/clsids.hxx>
#include <svx/acorrcfg.hxx>
@@ -84,12 +78,8 @@
#include <fmtfsize.hxx>
#include <swmodule.hxx>
#include <wrtsh.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <doc.hxx>
#include <uitool.hxx>
#ifndef _CMDID_H
@@ -99,9 +89,7 @@
#include <globals.hrc>
#endif
#include <frmmgr.hxx>
-#ifndef _TEXTSH_HXX
#include <textsh.hxx>
-#endif
#include <frmfmt.hxx>
#include <tablemgr.hxx>
#include <swundo.hxx> // fuer Undo-IDs
@@ -137,12 +125,8 @@
#define HyphenZone
#define TextFont
#define DropCap
-#ifndef _ITEMDEF_HXX
-#include <itemdef.hxx>
-#endif
-#ifndef _SWSLOTS_HXX
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
-#endif
#include <SwRewriter.hxx>
#include <undobj.hxx>
#ifndef _COMCORE_HRC
diff --git a/sw/source/ui/table/colwd.src b/sw/source/ui/table/colwd.src
index 8f83a797d2ab..609b080941bc 100644
--- a/sw/source/ui/table/colwd.src
+++ b/sw/source/ui/table/colwd.src
@@ -38,39 +38,39 @@ ModalDialog DLG_COL_WIDTH
HelpID = FN_TABLE_SET_COL_WIDTH ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 149 , 60 ) ;
+ Size = MAP_APPFONT ( 159 , 60 ) ;
Text [ en-US ] = "Column Width" ;
Moveable = TRUE ;
OKButton BT_OK
{
- Pos = MAP_APPFONT ( 94 , 6 ) ;
+ Pos = MAP_APPFONT ( 104 , 6 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton BT_CANCEL
{
- Pos = MAP_APPFONT ( 94 , 23 ) ;
+ Pos = MAP_APPFONT ( 104 , 23 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
HelpButton BT_HELP
{
- Pos = MAP_APPFONT ( 94 , 43 ) ;
+ Pos = MAP_APPFONT ( 104 , 43 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
FixedText FT_WIDTH
{
Pos = MAP_APPFONT ( 12 , 31 ) ;
- Size = MAP_APPFONT ( 22 , 8 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
Text [ en-US ] = "~Width" ;
Left = TRUE ;
};
MetricField ED_WIDTH
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 41 , 30 ) ;
+ Pos = MAP_APPFONT ( 51 , 30 ) ;
Size = MAP_APPFONT ( 38 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
@@ -88,20 +88,20 @@ ModalDialog DLG_COL_WIDTH
FixedLine FL_WIDTH
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 81 , 8 ) ;
+ Size = MAP_APPFONT ( 91 , 8 ) ;
Text [ en-US ] = "Width" ;
};
FixedText FT_COL
{
Pos = MAP_APPFONT ( 12 , 16 ) ;
- Size = MAP_APPFONT ( 29 , 8 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
Text [ en-US ] = "~Column" ;
Left = TRUE ;
};
NumericField ED_COL
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 41 , 14 ) ;
+ Pos = MAP_APPFONT ( 51 , 14 ) ;
Size = MAP_APPFONT ( 38 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index 1792b639e5d8..63f8ac8a2e00 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -141,14 +141,14 @@ SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable )
aRepeatHeaderAfterFT (this),
aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
+ aOptionsFL (this, SW_RES(FL_OPTIONS)),
aDontSplitCB (this, SW_RES(CB_DONT_SPLIT)),
aBorderCB (this, SW_RES(CB_BORDER)),
- aOptionsFL (this, SW_RES(FL_OPTIONS)),
+ aAutoFmtBtn(this,SW_RES(BT_AUTOFORMAT)),
aOkBtn(this,SW_RES(BT_OK)),
aCancelBtn(this,SW_RES(BT_CANCEL)),
aHelpBtn(this, SW_RES(BT_HELP)),
- aAutoFmtBtn(this,SW_RES(BT_AUTOFORMAT)),
#ifdef MSC
#pragma warning (default : 4355)
#endif
diff --git a/sw/source/ui/table/convert.src b/sw/source/ui/table/convert.src
index 3eec84232ba1..44a8923d9e48 100644
--- a/sw/source/ui/table/convert.src
+++ b/sw/source/ui/table/convert.src
@@ -36,7 +36,7 @@ ModalDialog DLG_CONV_TEXT_TABLE
{
HelpID = FN_CONVERT_TEXT_TABLE ;
OUTPUTSIZE = TRUE ;
- Size = MAP_APPFONT ( 203 , 152 ) ;
+ Size = MAP_APPFONT ( 203 , 169 ) ;
Text [ en-US ] = "Convert Table to Text" ;
MOVEABLE = TRUE ;
SVLOOK = TRUE ;
@@ -176,8 +176,8 @@ ModalDialog DLG_CONV_TEXT_TABLE
};
PushButton BT_AUTOFORMAT
{
- Pos = MAP_APPFONT ( 147 , 60 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 12 , 152 ) ;
+ Size = MAP_APPFONT ( 66 , 14 ) ;
TabStop = TRUE ;
Hide = TRUE ;
Text [ en-US ] = "Auto~Format..." ;
diff --git a/sw/source/ui/table/insrc.cxx b/sw/source/ui/table/insrc.cxx
deleted file mode 100644
index 0589b1351538..000000000000
--- a/sw/source/ui/table/insrc.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: insrc.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sw.hxx"
-#ifdef SW_DLLIMPLEMENTATION
-#undef SW_DLLIMPLEMENTATION
-#endif
-
-
-#include <sfx2/dispatch.hxx>
-#include <svtools/eitem.hxx>
-#include <svtools/intitem.hxx>
-
-#include "cmdid.h"
-#include "swtypes.hxx"
-#include "insrc.hxx"
-#include "view.hxx"
-#include "table.hrc"
-#include "insrc.hrc"
-
-void SwInsRowColDlg::Apply()
-{
- USHORT nSlot = bColumn ? FN_TABLE_INSERT_COL : FN_TABLE_INSERT_ROW;
- SfxUInt16Item aCountItem( nSlot, static_cast< UINT16 >(aCountEdit.GetValue()) );
- SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, aAfterBtn.IsChecked() );
- rView.GetViewFrame()->GetDispatcher()->Execute( nSlot,
- SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
- &aCountItem, &aAfter, 0L);
-}
-
-
-
-SwInsRowColDlg::SwInsRowColDlg(SwView& rVw, BOOL bCol )
- : SvxStandardDialog( rVw.GetWindow(), SW_RES(DLG_INS_ROW_COL) ),
- aCount( this, SW_RES( FT_COUNT ) ),
- aCountEdit( this, SW_RES( ED_COUNT ) ),
- aInsFL( this, SW_RES( FL_INS ) ),
- aBeforeBtn( this, SW_RES( CB_POS_BEFORE ) ),
- aAfterBtn( this, SW_RES( CB_POS_AFTER ) ),
- aPosFL( this, SW_RES( FL_POS ) ),
- aRow(SW_RES(STR_ROW)),
- aCol(SW_RES(STR_COL)),
- aOKBtn( this, SW_RES( BT_OK ) ),
- aCancelBtn( this, SW_RES( BT_CANCEL ) ),
- aHelpBtn( this, SW_RES( BT_HELP ) ),
- rView(rVw),
- bColumn( bCol )
-{
- FreeResource();
- String aTmp( GetText() );
- if( bColumn )
- {
- aTmp += aCol;
- SetHelpId( FN_TABLE_INSERT_COL_DLG );
- }
- else
- {
- aTmp += aRow;
- SetHelpId( FN_TABLE_INSERT_ROW_DLG );
- }
- SetText( aTmp );
-}
-
-
-
-
diff --git a/sw/source/ui/table/insrc.hrc b/sw/source/ui/table/insrc.hrc
deleted file mode 100644
index e07c7cb2f1d5..000000000000
--- a/sw/source/ui/table/insrc.hrc
+++ /dev/null
@@ -1,43 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: insrc.hrc,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#define FT_COUNT 1
-#define ED_COUNT 2
-#define FL_INS 3
-
-#define CB_POS_BEFORE 10
-#define CB_POS_AFTER 11
-#define FL_POS 12
-
-#define STR_ROW 20
-#define STR_COL 21
-
-#define BT_OK 100
-#define BT_CANCEL 101
-#define BT_HELP 102
diff --git a/sw/source/ui/table/insrc.src b/sw/source/ui/table/insrc.src
deleted file mode 100644
index 3c8c0e1311ba..000000000000
--- a/sw/source/ui/table/insrc.src
+++ /dev/null
@@ -1,155 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: insrc.src,v $
- * $Revision: 1.32 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "table.hrc"
-#include "insrc.hrc"
-#include "helpid.h"
- // #define DLG_INS_ROW_COL 256
-ModalDialog DLG_INS_ROW_COL
-{
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 136 , 84 ) ;
- /* ### ACHTUNG: Neuer Text in Resource? Einfgen : Einfgen */
- Text [ en-US ] = "Insert" ;
- Moveable = TRUE ;
- OKButton BT_OK
- {
- Pos = MAP_APPFONT ( 80 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton BT_CANCEL
- {
- Pos = MAP_APPFONT ( 80 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- HelpButton BT_HELP
- {
- Pos = MAP_APPFONT ( 80 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- RadioButton CB_POS_BEFORE
- {
- Pos = MAP_APPFONT ( 12 , 49 ) ;
- Size = MAP_APPFONT ( 56 , 10 ) ;
- Text [ en-US ] = "~Before" ;
- TabStop = TRUE ;
- };
- RadioButton CB_POS_AFTER
- {
- Pos = MAP_APPFONT ( 12 , 62 ) ;
- Size = MAP_APPFONT ( 56 , 10 ) ;
- Text [ en-US ] = "A~fter" ;
- TabStop = TRUE ;
- Check = TRUE ;
- };
- NumericField ED_COUNT
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 44 , 14 ) ;
- Size = MAP_APPFONT ( 24 , 12 ) ;
- TabStop = TRUE ;
- Left = TRUE ;
- Repeat = TRUE ;
- Spin = TRUE ;
- Minimum = 1 ;
- Maximum = 99 ;
- Value = 1 ;
- First = 1 ;
- Last = 5 ;
- };
- FixedLine FL_INS
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 68 , 8 ) ;
- Text [ en-US ] = "Insert" ;
- };
- FixedLine FL_POS
- {
- Pos = MAP_APPFONT ( 6 , 38 ) ;
- Size = MAP_APPFONT ( 68 , 8 ) ;
- Text [ en-US ] = "Position";
- };
- FixedText FT_COUNT
- {
- Pos = MAP_APPFONT ( 12 , 16 ) ;
- Size = MAP_APPFONT ( 30 , 8 ) ;
- Text [ en-US ] = "~Number" ;
- Left = TRUE ;
- };
- String STR_ROW
- {
- Text [ en-US ] = " Rows" ;
- };
- String STR_COL
- {
- Text [ en-US ] = " Columns" ;
- };
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sw/source/ui/table/makefile.mk b/sw/source/ui/table/makefile.mk
index f862365cc35f..5e39d0af3af3 100644
--- a/sw/source/ui/table/makefile.mk
+++ b/sw/source/ui/table/makefile.mk
@@ -50,7 +50,6 @@ SRC1FILES = \
colwd.src \
convert.src \
chartins.src \
- insrc.src \
instable.src \
mergetbl.src \
rowht.src \
@@ -63,7 +62,6 @@ SLOFILES = \
$(SLO)$/colwd.obj \
$(SLO)$/convert.obj \
$(SLO)$/chartins.obj \
- $(SLO)$/insrc.obj \
$(SLO)$/instable.obj \
$(SLO)$/mergetbl.obj \
$(SLO)$/rowht.obj \
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index cd450bc8134b..f4ef984a3352 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -39,9 +39,7 @@
#include <vcl/fixed.hxx>
#include <vcl/help.hxx>
#include <vcl/cmdevt.hxx>
-#ifndef _SV_BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
#include <svtools/printdlg.hxx>
#include <svtools/whiter.hxx>
#include <svtools/stritem.hxx>
@@ -71,20 +69,12 @@
#include <swmodule.hxx>
#include <modcfg.hxx>
#include <wrtsh.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <viewopt.hxx>
#include <doc.hxx>
-#ifndef _PVIEW_HXX
#include <pview.hxx>
-#endif
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
-#ifndef _TEXTSH_HXX
#include <textsh.hxx>
-#endif
#include <scroll.hxx>
#include <swprtopt.hxx>
#include <docstat.hxx>
@@ -109,12 +99,8 @@
#endif
#define SwPagePreView
-#ifndef _ITEMDEF_HXX
-#include <itemdef.hxx>
-#endif
-#ifndef _SWSLOTS_HXX
+#include <sfx2/msg.hxx>
#include <swslots.hxx>
-#endif
// OD 12.12.2002 #103492#
#include <pagepreviewlayout.hxx>
@@ -2318,13 +2304,11 @@ void SwPagePreView::DocSzChgd( const Size &rSz )
aDocSz = rSz;
- // die neue Anzahl von Seiten bestimmen
- USHORT nNewCnt = GetViewShell()->GetNumPages();
- if( nNewCnt == mnPageCount )
- return;
+ // --> OD 2009-08-20 #i96726#
+ // Due to the multiple page layout it is needed to trigger recalculation
+ // of the page preview layout, even if the count of pages is not changing.
+ mnPageCount = GetViewShell()->GetNumPages();
- // dann eine neue Startseite berechnen
- mnPageCount = nNewCnt;
if( aVisArea.GetWidth() )
{
ChgPage( SwPagePreViewWin::MV_CALC, TRUE );
@@ -2332,6 +2316,7 @@ void SwPagePreView::DocSzChgd( const Size &rSz )
aViewWin.Invalidate();
}
+ // <--
}
/*--------------------------------------------------------------------
diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx
index 7898e4db1cb2..34cfebe663a1 100644
--- a/sw/source/ui/uiview/srcview.cxx
+++ b/sw/source/ui/uiview/srcview.cxx
@@ -76,7 +76,7 @@
#include <srcview.hxx>
#include <viewfunc.hxx>
#include <doc.hxx>
-#include <itemdef.hxx>
+#include <sfx2/msg.hxx>
#include <shellio.hxx>
#include <cmdid.h> // FN_ ...
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index f5e84ee1048b..5e3afd2ed8fa 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -672,6 +672,7 @@ void SwView::_CheckReadonlyState()
SID_DELETE, FN_BACKSPACE, FN_SHIFT_BACKSPACE,
SID_UNDO,
SID_REDO, SID_REPEAT, SID_PASTE,
+ SID_PASTE_UNFORMATTED,
FN_PASTESPECIAL, SID_SBA_BRW_INSERT,
SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK,
SID_CHARMAP, FN_INSERT_SOFT_HYPHEN,
diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx
index 2e9a3bc783e7..38f885657450 100644
--- a/sw/source/ui/uiview/view0.cxx
+++ b/sw/source/ui/uiview/view0.cxx
@@ -49,9 +49,7 @@
#include <svx/srchdlg.hxx>
#include <sfx2/templdlg.hxx>
#include <uivwimp.hxx>
-#ifndef _AVMEDIA_MEDIAPPLAYER_HXX
#include <avmedia/mediaplayer.hxx>
-#endif
#include <swmodule.hxx>
#include <sfx2/objface.hxx>
@@ -92,7 +90,7 @@
#define WebListInText
#define WebListInTable
#define TextPage
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include <svx/svxslots.hxx>
#include "swslots.hxx"
#include <PostItMgr.hxx>
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index c063c72c5892..6a03909d92f9 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -584,7 +584,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq)
USHORT nOn = ((const SfxBoolItem*)pItem)->GetValue() ? nsRedlineMode_t::REDLINE_ON : 0;
USHORT nMode = pWrtShell->GetRedlineMode();
- pWrtShell->SetRedlineMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
+ pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
}
}
break;
@@ -624,7 +624,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq)
nOn = 0;
}
USHORT nMode = pIDRA->GetRedlineMode();
- pWrtShell->SetRedlineMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
+ pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, ((nMode&nsRedlineMode_t::REDLINE_ON)==0) ) );
}
else
@@ -641,7 +641,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq)
if( ((const SfxBoolItem*)pItem)->GetValue() )
nMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
- pWrtShell->SetRedlineMode( nMode );
+ pWrtShell->SetRedlineModeAndCheckInsMode( nMode );
}
break;
case FN_MAILMERGE_SENDMAIL_CHILDWINDOW:
diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx
index d366a5ddc16c..4fb7746db4d7 100644
--- a/sw/source/ui/uiview/viewdraw.cxx
+++ b/sw/source/ui/uiview/viewdraw.cxx
@@ -501,7 +501,7 @@ sal_Bool SwView::EnterDrawTextMode(const Point& aDocPos)
if( pSdrView->IsMarkedHit( aDocPos ) &&
!pSdrView->PickHandle( aDocPos ) && IsTextTool() &&
- pSdrView->PickObj( aDocPos, pObj, pPV, SDRSEARCH_PICKTEXTEDIT ) &&
+ pSdrView->PickObj( aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKTEXTEDIT ) &&
// #108784#
// To allow SwDrawVirtObj text objects to be activated, allow their type, too.
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index 65f4ae6240cf..fbc459eb170e 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -607,10 +607,10 @@ void SwView::Replace()
{
if (GetPostItMgr()->GetActivePostIt())
GetPostItMgr()->Replace(pSrchItem);
- pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(),
+ sal_Bool bReplaced = pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(),
pSrchItem->GetRegExp());
- if( pReplList && pReplList->Count() && pWrtShell->HasSelection() )
+ if( bReplaced && pReplList && pReplList->Count() && pWrtShell->HasSelection() )
{
SfxItemSet aReplSet( pWrtShell->GetAttrPool(),
aTxtFmtCollSetRange );
diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx
index dfdbacab354b..0c67e24b8d10 100644
--- a/sw/source/ui/uno/unoatxt.cxx
+++ b/sw/source/ui/uno/unoatxt.cxx
@@ -416,7 +416,7 @@ sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextR
if(pxCursor)
{
SwPaM* pUnoCrsr = pxCursor->GetPaM();
- bRet |= (true == pxCursor->GetDoc()->Copy( *pUnoCrsr, aPos ));
+ bRet |= (true == pxCursor->GetDoc()->Copy( *pUnoCrsr, aPos, false ));
}
else
{
@@ -424,7 +424,7 @@ sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextR
if(pBkmk && pBkmk->IsExpanded())
{
SwPaM aTmp(pBkmk->GetOtherMarkPos(), pBkmk->GetMarkPos());
- bRet |= (true == pxRange->GetDoc()->Copy(aTmp, aPos));
+ bRet |= (true == pxRange->GetDoc()->Copy(aTmp, aPos, false));
}
}
}
diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx
index 57a2a8ec6c1f..19d0faa0bfce 100644
--- a/sw/source/ui/uno/unomod.cxx
+++ b/sw/source/ui/uno/unomod.cxx
@@ -50,13 +50,13 @@
#include <com/sun/star/text/NotePrintMode.hpp>
#include <doc.hxx>
#include <comphelper/TypeGeneration.hxx>
-#ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
+#include <com/sun/star/view/DocumentZoomType.hpp>
#include <comphelper/ChainablePropertySetInfo.hxx>
#include <edtwin.hxx>
#include <rtl/ustrbuf.hxx>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -726,23 +726,28 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
if(!(rValue >>= nZoom))
throw IllegalArgumentException();
SvxZoomType eZoom = (SvxZoomType)USHRT_MAX;
- switch(nZoom)
+ switch (nZoom)
{
- case /*DocumentZoomType_OPTIMAL */0:
+ case view::DocumentZoomType::OPTIMAL:
eZoom = SVX_ZOOM_OPTIMAL;
break;
- case /*DocumentZoomType_PAGE_WIDTH */ 1:
+ case view::DocumentZoomType::PAGE_WIDTH:
eZoom = SVX_ZOOM_PAGEWIDTH;
break;
- case /*DocumentZoomType_ENTIRE_PAGE */ 2:
+ case view::DocumentZoomType::ENTIRE_PAGE:
eZoom = SVX_ZOOM_WHOLEPAGE;
break;
- case /*DocumentZoomType_BY_VALUE */ 3:
+ case view::DocumentZoomType::BY_VALUE:
eZoom = SVX_ZOOM_PERCENT;
break;
- case /*DocumentZoomType_PAGE_WIDTH_EXACT */ 4:
+ case view::DocumentZoomType::PAGE_WIDTH_EXACT:
eZoom = SVX_ZOOM_PAGEWIDTH_NOBORDER;
break;
+ default:
+ throw IllegalArgumentException(
+ ::rtl::OUString::createFromAscii(
+ "SwXViewSettings: invalid zoom type"), 0, 0);
+ break;
}
if(eZoom < USHRT_MAX)
{
@@ -915,23 +920,27 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
case HANDLE_VIEWSET_ZOOM_TYPE:
{
bBool = FALSE;
- sal_Int16 nRet;
- switch(mpConstViewOption->GetZoomType())
+ sal_Int16 nRet(0);
+ switch (mpConstViewOption->GetZoomType())
{
case SVX_ZOOM_OPTIMAL:
- nRet = /*DocumentZoomType_OPTIMAL*/ 0;
+ nRet = view::DocumentZoomType::OPTIMAL;
break;
case SVX_ZOOM_PAGEWIDTH:
- nRet = /*DocumentZoomType_PAGE_WIDTH */1;
+ nRet = view::DocumentZoomType::PAGE_WIDTH;
break;
case SVX_ZOOM_WHOLEPAGE:
- nRet = /*DocumentZoomType_ENTIRE_PAGE */ 2;
+ nRet = view::DocumentZoomType::ENTIRE_PAGE;
break;
case SVX_ZOOM_PERCENT:
- nRet = /*DocumentZoomType_BY_VALUE */ 3;
+ nRet = view::DocumentZoomType::BY_VALUE;
+ break;
+ case SVX_ZOOM_PAGEWIDTH_NOBORDER:
+ nRet = view::DocumentZoomType::PAGE_WIDTH_EXACT;
break;
default:
- ;
+ OSL_ENSURE(false, "SwXViewSettings: invalid zoom type");
+ break;
}
rValue <<= nRet;
}
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index ed997c6392ba..04a26d47b324 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -37,16 +37,12 @@
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
#include <sfx2/viewfrm.hxx>
-#ifndef _TOOLKIT_UNOHLP_HXX
#include <toolkit/helper/vclunohelper.hxx>
-#endif
#include <wdocsh.hxx>
#include <wrtsh.hxx>
#include <view.hxx>
#include <pview.hxx>
-#ifndef _SRCVIEW_HXX
#include <srcview.hxx>
-#endif
#include <viewsh.hxx>
#include <pvprtdat.hxx>
#include <swprtopt.hxx>
@@ -84,9 +80,7 @@
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
#include <com/sun/star/document/RedlineDisplayType.hpp>
#include <svx/linkmgr.hxx>
#include <svx/unofill.hxx>
@@ -94,13 +88,9 @@
#include <sfx2/progress.hxx>
#include <swmodule.hxx>
#include <docstat.hxx>
-#ifndef _MODOPT_HXX //
#include <modcfg.hxx>
-#endif
#include <ndtxt.hxx>
-#ifndef _UTLUI_HRC
#include <utlui.hrc>
-#endif
#include <swcont.hxx>
#include <unodefaults.hxx>
#include <SwXDocumentSettings.hxx>
@@ -2851,7 +2841,27 @@ uno::Reference< text::XFlatParagraphIterator > SAL_CALL SwXTextDocument::getFlat
{
return new SwXFlatParagraphIterator( *pDocShell->GetDoc(), nTextMarkupType, bAutomatic );
}
+/*-- 07.05.2009 09:21:12---------------------------------------------------
+ -----------------------------------------------------------------------*/
+uno::Reference< util::XCloneable > SwXTextDocument::createClone( ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ //create a new document - hidden - copy the storage and return it
+ SwDoc* pCopyDoc = pDocShell->GetDoc()->CreateCopy();
+ SfxObjectShell* pShell = new SwDocShell( pCopyDoc, SFX_CREATE_MODE_STANDARD );
+ pShell->DoInitNew();
+
+ uno::Reference< embed::XStorage > xSourceStorage = getDocumentStorage();
+ uno::Reference< frame::XModel > xNewModel = pShell->GetModel();
+ //copy this storage
+ uno::Reference< document::XStorageBasedDocument > xStorageDoc( xNewModel, uno::UNO_QUERY );
+ uno::Reference< embed::XStorage > xNewStorage = xStorageDoc->getDocumentStorage();
+ xSourceStorage->copyToStorage( xNewStorage );
+ return uno::Reference< util::XCloneable >( xNewModel, UNO_QUERY );
+}
/* -----------------------------20.06.00 09:54--------------------------------
---------------------------------------------------------------------------*/
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index eaba514a6e6a..6197bb489d61 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -38,9 +38,7 @@
#include <hintids.hxx>
#include <docsh.hxx>
#include <rubylist.hxx>
-#ifndef _SWDOC_HXX //autogen
#include <doc.hxx>
-#endif
#include <unotxvw.hxx>
#include <unodispatch.hxx>
#include <unomap.hxx>
@@ -1442,9 +1440,9 @@ void SwXTextViewCursor::gotoRange(
const ::sw::mark::IMark* const pBkmk = pRange->GetBookmark();
pSrcNode = &(pBkmk->GetMarkPos().nNode.GetNode());
}
- else if (pPara && pPara->GetCrsr())
+ else if (pPara && pPara->GetTxtNode())
{
- pSrcNode = pPara->GetCrsr()->GetNode();
+ pSrcNode = pPara->GetTxtNode();
}
const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : 0;
diff --git a/sw/source/ui/web/wdocsh.cxx b/sw/source/ui/web/wdocsh.cxx
index 9f7eff770172..dbfdf87dc94d 100644
--- a/sw/source/ui/web/wdocsh.cxx
+++ b/sw/source/ui/web/wdocsh.cxx
@@ -43,7 +43,7 @@
#include <sot/clsids.hxx>
#include <sfx2/objface.hxx>
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "cfgid.h"
#include "cmdid.h"
#include "swtypes.hxx"
diff --git a/sw/source/ui/web/wformsh.cxx b/sw/source/ui/web/wformsh.cxx
index 8a629fbfeac2..ed9a84667c79 100644
--- a/sw/source/ui/web/wformsh.cxx
+++ b/sw/source/ui/web/wformsh.cxx
@@ -33,7 +33,7 @@
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#ifndef _SVX_SVXIDS_HRC
#include <svx/svxids.hrc>
diff --git a/sw/source/ui/web/wfrmsh.cxx b/sw/source/ui/web/wfrmsh.cxx
index e43a0e2d7850..ee2f61884000 100644
--- a/sw/source/ui/web/wfrmsh.cxx
+++ b/sw/source/ui/web/wfrmsh.cxx
@@ -50,7 +50,7 @@
// STATIC DATA -----------------------------------------------------------
#define SwWebFrameShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
diff --git a/sw/source/ui/web/wgrfsh.cxx b/sw/source/ui/web/wgrfsh.cxx
index 5a935bb9e2e1..00a21da8e1b7 100644
--- a/sw/source/ui/web/wgrfsh.cxx
+++ b/sw/source/ui/web/wgrfsh.cxx
@@ -32,8 +32,7 @@
#include "precompiled_sw.hxx"
-
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include <svx/srchitem.hxx>
#include <sfx2/app.hxx>
diff --git a/sw/source/ui/web/wlistsh.cxx b/sw/source/ui/web/wlistsh.cxx
index a505928134b9..fc3f0635b54d 100644
--- a/sw/source/ui/web/wlistsh.cxx
+++ b/sw/source/ui/web/wlistsh.cxx
@@ -32,9 +32,7 @@
#include "precompiled_sw.hxx"
-#include "itemdef.hxx"
-
-
+#include <sfx2/msg.hxx>
#include <sfx2/app.hxx>
#include <sfx2/objface.hxx>
#include <svx/srchitem.hxx>
diff --git a/sw/source/ui/web/wolesh.cxx b/sw/source/ui/web/wolesh.cxx
index 481c9405e439..131b6d72da10 100644
--- a/sw/source/ui/web/wolesh.cxx
+++ b/sw/source/ui/web/wolesh.cxx
@@ -32,8 +32,7 @@
#include "precompiled_sw.hxx"
-
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include <sfx2/app.hxx>
#include <sfx2/objface.hxx>
#include <svx/srchitem.hxx>
diff --git a/sw/source/ui/web/wtabsh.cxx b/sw/source/ui/web/wtabsh.cxx
index 7af0bef34232..c47541214d58 100644
--- a/sw/source/ui/web/wtabsh.cxx
+++ b/sw/source/ui/web/wtabsh.cxx
@@ -51,7 +51,7 @@
#include "wtabsh.hxx"
#define SwWebTableShell
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "svx/svxids.hrc"
#include "swslots.hxx"
diff --git a/sw/source/ui/web/wtextsh.cxx b/sw/source/ui/web/wtextsh.cxx
index 2bbf79cfab94..abdcee987840 100644
--- a/sw/source/ui/web/wtextsh.cxx
+++ b/sw/source/ui/web/wtextsh.cxx
@@ -37,9 +37,7 @@
#include <sfx2/objface.hxx>
#include <sfx2/app.hxx>
#include <svx/srchitem.hxx> //***
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
#ifndef _SVX_SVXIDS_HRC //autogen
#include <svx/svxids.hrc>
#endif
@@ -63,7 +61,7 @@
#define HyphenZone
#define TextFont
#define DropCap
-#include "itemdef.hxx"
+#include <sfx2/msg.hxx>
#include "swslots.hxx"
diff --git a/sw/source/ui/web/wview.cxx b/sw/source/ui/web/wview.cxx
index 6d1b0ca68c03..34ccd8f72378 100644
--- a/sw/source/ui/web/wview.cxx
+++ b/sw/source/ui/web/wview.cxx
@@ -32,7 +32,7 @@
#include "precompiled_sw.hxx"
-#include <itemdef.hxx>
+#include <sfx2/msg.hxx>
#include <svx/srchitem.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/templdlg.hxx>
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index 5124cf66d687..5ed81c942ea4 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -140,8 +140,9 @@ long SwWrtShell::SelAll()
{
const BOOL bLockedView = IsViewLocked();
LockView( TRUE );
-
{
+ if(bBlockMode)
+ LeaveBlockMode();
MV_KONTEXT(this);
BOOL bMoveTable = FALSE;
SwPosition *pStartPos = 0;
@@ -191,9 +192,7 @@ long SwWrtShell::SelAll()
}
}
EndSelect();
-
LockView( bLockedView );
-
return 1;
}
@@ -701,6 +700,13 @@ void SwWrtShell::SetInsMode( BOOL bOn )
StartAction();
EndAction();
}
+//Overwrite mode is incompatible with red-lining
+void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode )
+{
+ SetRedlineMode( eMode );
+ if (IsRedlineOn())
+ SetInsMode( true );
+}
/*
* Rahmen bearbeiten
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
index 6624668fcd8a..42cfb1c3d64d 100644
--- a/sw/source/ui/wrtsh/wrtsh2.cxx
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -30,12 +30,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <hintids.hxx> // define ITEMIDs
#include <svtools/macitem.hxx>
#include <sfx2/frame.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <svtools/urihelper.hxx>
#include <svtools/eitem.hxx>
#include <svtools/stritem.hxx>
@@ -47,9 +46,7 @@
#include <frmatr.hxx>
#include <swtypes.hxx> // SET_CURR_SHELL
#include <wrtsh.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <fldbas.hxx> // Felder
#include <expfld.hxx>
#include <ddefld.hxx>
@@ -61,9 +58,7 @@
#include <frmfmt.hxx> // fuer UpdateTable
#include <swtable.hxx> // fuer UpdateTable
#include <mdiexp.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <swevent.hxx>
#include <poolfmt.hxx>
#include <section.hxx>
@@ -71,12 +66,8 @@
#include <navipi.hxx>
#include <crsskip.hxx>
#include <txtinet.hxx>
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
-#ifndef _WRTSH_HRC
#include <wrtsh.hrc>
-#endif
#include "swabstdlg.hxx"
#include "fldui.hrc"
@@ -355,8 +346,8 @@ void SwWrtShell::ClickToINetAttr( const SwFmtINetFmt& rItem, USHORT nFilter )
const SwTxtINetFmt* pTxtAttr = rItem.GetTxtINetFmt();
if( pTxtAttr )
{
- ((SwTxtINetFmt*)pTxtAttr)->SetVisited( sal_True );
- ((SwTxtINetFmt*)pTxtAttr)->SetValidVis( sal_True );
+ const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisited( true );
+ const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( true );
}
bIsInClickToEdit = FALSE;